这是一个天气应用程序,示例如何连接到Claude Desktop
Dockerfile
docker build -t weather .
docker run -p 8000:8000 weatherDocker Compose
docker-compose up --build -d
docker-compose logs -fClaude桌面配置
通过npx实现CLAUDE桌面
{ “mcpServers”:{ “天气”:{ “command”:“C:\\程序文件\\nodejs\\npx”, “args”:\[ y “mcp远程”, "http://127.0.0.1:8000/mcp" \] } } }
通过cli访问CLAUDE桌面
{ “mcpServers”:{ “天气”:{ “command”:“uv”, “args”:\[ “--目录”, “C:\\绝对\\路径\\到\\父母\\文件夹\\天气\\ src”, “运行”, “天气。py”, \] } } }
开放API
/openapi.json
{
"mcp-weather": {
"type": "openapi",
"url": "http://localhost:8000/openapi.json"
}
}MCP (se)
/mcp
{
"mcp-weather": {
"type": "sse",
"url": "http://localhost:8000/mcp"
}
}