Lightweight MCP-powered weather API with Docker, fast development, and cloud integration for scalable deployment
The Weather Microservice with MCP + UV is a lightweight and extensible weather API service built to support seamless local development, secure deployment in Docker containers, and integration with various AI applications like Claude Desktop. This server utilizes the Model Context Protocol (MCP) to enable robust data source and tool integration for AI applications.
The core features of this Weather Microservice are powered by MCP, which provides a standardized protocol for integrating diverse tools and data sources within AI applications. Here’s how MCP enhances the Weather Microservice:
uv
, developers can quickly iterate on their code without restarting the server. This is especially useful during development.uv
simplifies managing and syncing dependencies, ensuring that all required libraries are available..env
files or environment variables.The Weather Microservice leverages the Model Context Protocol (MCP) for its core architecture. MCP is designed to enable seamless integration between AI applications and various tools and data sources. The protocol defines a structured method for exchanging data and commands, ensuring compatibility across different AI platforms.
graph TD
A[AI Application] -->|MCP Client| B[MCP Protocol]
B --> C[MCP Server]
C --> D[Data Source/Tool]
style A fill:#e1f5fe
style C fill:#f3e5f5
style D fill:#e8f5e8
graph LR
DataSource((Data Source) -->|Fetch| API Gateway -->|Process| Weather Service -->|Transform| Client)
Client((Client) -->|Send Prompt| MCP Server -->|Execute| Weather Service -->|Return| API Gateway -->|Present| AI Application)
subgraph Weather Service
WeatherService([Weather Service])
end
To get started, follow these steps to set up and run the Weather Microservice.
Running the server in development mode allows for live reloading:
uv run mcp dev server.py
You can also add dependencies on-the-fly using uv
commands:
uv run mcp dev server.py --with pandas --with numpy
To mount your local code as editable, use the following command:
uv run mcp dev server.py --with-editable .
For a more controlled deployment or advanced scenarios, you can directly run the server via:
from mcp.server.fastmcp import FastMCP
mcp = FastMCP("My App")
if __name__ == "__main__":
mcp.run()
Or using uv
:
uv run python server.py
# or
uv run mcp run server.py
Building and Running the Docker Image
To build a Docker image, use the following command:
docker build -t weather-service .
And to run it with environment variables mounted:
docker run --env-file .env -p 6274:6274 weather-service
Imagine using the Weather Microservice to power an intelligent chatbot that provides real-time weather updates based on user prompts. Here’s how it works:
Integrating a forecast tool into an AI application can enhance decision-making capabilities. Here’s an example integration:
weather-service
endpoint, which then fetches data from the associated API or database.The Weather Microservice ensures compatibility with a variety of MCP clients:
MCP Client | Resources | Tools | Prompts | Status |
---|---|---|---|---|
Claude Desktop | ✅ | ✅ | ✅ | Full Support |
Continue | ✅ | ✅ | ❌ | No Prompts |
Cursor | ❌ | ✅ | ❌ | Tools Only |
The performance of the Weather Microservice is optimized for various deployment and integration scenarios. The following matrix provides an overview:
Deployment Mode | Local Development | Docker Container |
---|---|---|
Load Speed | Instantaneous | Minimal Delay |
Update Frequency | Real-time as code changes | Smooth through Docker rebuilds |
Here’s an example of how to configure the Weather Microservice:
{
"mcpServers": {
"[server-name]": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-[name]"],
"env": {
"API_KEY": "your-api-key"
}
}
}
}
Ensure that sensitive data, such as API keys and database URLs, are stored securely. Use environment variables or .env
files to manage these.
uv run mcp install server.py
, then configure it in Claude Desktop as per its documentation..env
file or environment variables to reflect the new API key, and uv sync
will update the dependencies accordingly.Contributions are welcome! To contribute to this project:
git checkout -b [branch-name]
.git commit -m 'Add some description'
.git push origin [branch-name]
.For more information on MCP and its ecosystem, visit the Model Context Protocol documentation at ModelContextProtocol.com. Stay updated with the latest developments in AI integration technologies by following our official blog or joining our community forums.
By utilizing the Weather Microservice with MCP + UV, developers can build robust AI applications that are easily integrated and deployable in diverse environments.
Learn how to use MCProto Ruby gem to create and chain MCP servers for custom solutions
AI Vision MCP Server offers AI-powered visual analysis, screenshots, and report generation for MCP-compatible AI assistants
Analyze search intent with MCP API for SEO insights and keyword categorization
Connects n8n workflows to MCP servers for AI tool integration and data access
Expose Chicago Public Schools data with a local MCP server accessing SQLite and LanceDB databases
Next-generation MCP server enhances documentation analysis with AI-powered neural processing and multi-language support