Dhiraj123-star/MCP_Server_Practice
If you are the rightful owner of MCP_Server_Practice and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
A modular FastAPI-based server powered by FastMCP, showcasing practical implementations of AI tools, math operations, web search, audio response generation, and external API integration.
๐ง MCP Server Practice
A modular FastAPI-based server powered by FastMCP, showcasing practical implementations of AI tools, math operations, web search, audio response generation, and external API integration.
๐ Core Functionalities
๐ง Math Utilities
add(a, b): Returns the sum of two integers.multiply(a, b): Returns the product of two integers.
๐ค๏ธ Weather API Integration
get_weather(city): Fetches live weather data for a specified city using the WeatherAPI.
๐ Web Search (via OpenAI Tools)
web_search(query): Performs a live web search using OpenAIโs web search tool and returns a concise result.
๐ Audio Response Generation
audio_query(text): Converts a text query into spoken audio (WAV format) using OpenAIโsgpt-4oaudio capabilities. Audio files are saved automatically to the/audiofolder.
๐โโ๏ธ Custom Resource Example
greeting://{name}: Returns a personalized greeting string using the resource-based route.
๐ ๏ธ Built With
- FastMCP: A server interface for tool-based workflows.
- FastAPI: Web framework for high-performance APIs.
- OpenAI: Powering AI-based search, chat, and audio generation.
- WeatherAPI: External API for real-time weather updates.
- Python + dotenv: For scripting and secure environment variable handling.
๐ป How It Works
Each tool is defined using the @mcp.tool() decorator, making it accessible as a callable interface for AI agents or CLI tools. The server runs with:
mcp.run(transport="stdio")