brew install uv
uv add mcp[cli]
uv run weather.py -- Server started. But you wont see anythiong
-- Now run
mcp dev weather.py -- Run a MCP server with the MCP Inspector.
mcp run weather.py -- Run a MCP server.
- Go to Claude settings and add this
- Open Claude
- Open Settings
- Select Developer
- Click Edit Config button
- This will launch explorer/finder
- Open the config file and add this
{
"mcpServers": {
"weather": {
"command": "uv",
"args": [
"--directory",
"/Users/kazhian/Lab/mcp_server",
"run",
"weather.py"
]
}
}
}
$ mcp install weather.py
INFO Added server 'WeatherAPI' to Claude config claude.py:136
INFO Successfully installed WeatherAPI in Claude app cli.py:485
Now Claude settings JSON will look like this
{
"mcpServers": {
"weather": {
"command": "uv",
"args": [
"--directory",
"/Users/kazhian/Lab/mcp_server",
"run",
"weather.py"
]
},
"WeatherAPI": {
"command": "/usr/local/bin/uv",
"args": [
"run",
"--with",
"mcp[cli]",
"mcp",
"run",
"/Users/kazhian/Lab/mcp_server/weather.py"
]
}
}
}
sequenceDiagram
participant User
participant ClaudeDesktop as Claude Desktop<br/>(Orchestrator)
participant LLM as Claude LLM
participant MCPClient as MCP Client
participant MCPServer as MCP Server (Weather)
participant WeatherAPI as Weather API/Tool
User->>ClaudeDesktop: "Get me the weather for Chennai"
ClaudeDesktop->>LLM: Send user message
LLM->>LLM: Analyze request & decide tool needed
LLM-->>ClaudeDesktop: Return tool call request:<br/>weather:weather(location="Chennai")
Note over ClaudeDesktop: Claude Desktop executes<br/>the tool call (not LLM)
ClaudeDesktop->>MCPClient: Execute tool via MCP Client
MCPClient->>MCPServer: Forward tool call via MCP protocol
MCPServer->>WeatherAPI: Fetch weather data for Chennai
WeatherAPI->>WeatherAPI: Retrieve current conditions<br/>(temp, humidity, condition)
WeatherAPI-->>MCPServer: Return weather data:<br/>{condition: "foggy", temp: 7°C,<br/>humidity: 27%, description: "..."}
MCPServer-->>MCPClient: Send response via MCP protocol
MCPClient-->>ClaudeDesktop: Return tool result
ClaudeDesktop->>LLM: Send tool results to LLM
LLM->>LLM: Process results & format response<br/>into readable paragraph
LLM-->>ClaudeDesktop: Return formatted response
ClaudeDesktop-->>User: Display: '"'The current weather in Chennai<br/>is foggy and windy with a temperature<br/>of 7°C and humidity at 27%...'"'