天气 MCP Server
docs: https://modelcontextprotocol.io/quickstart/server
服务运行测试
uv run weather.py
使用 Claude for Desktop 作为客户端测试
配置
打开并编辑文件: ~/Library/Application\ Support/Claude/claude_desktop_config.json,内容如下:
{
"mcpServers": {
"weather": {
"command": "/ABSOLUTE/PATH/TO/uv",
"args": [
"--directory",
"/ABSOLUTE/PATH/TO/mcp-weather-server",
"run",
"weather.py"
]
}
}
}
重启 Claude for Desktop
重启不报错,且有锤子图标显示两个 Available MCP Tools,即为成功;否则,查看日志排查
Claude for Desktop 日志
日志文件夹:~/Library/Logs/Claude
来自具体 MCP Server 的日志:mcp-server-weather.log
MCP 连接通用日志:mcp.log
工作原理
- 客户将您的问题发送给 Claude
- Claude 分析可用的工具并决定使用哪一个
- 客户端通过 MCP 服务器执行所选工具
- 结果被发回给 Claude
- Claude 制定了自然语言响应
- 答案已经展示给你了!
Recommend MCP Servers 💡
pubchem-mcp-server
An MCP server that enables AI assistants to search and access chemical compound information from PubChem, providing tools for compound search, property data retrieval, and advanced queries.
@professional-wiki/mediawiki-mcp-server
An MCP server that enables Large Language Model (LLM) clients to interact with any MediaWiki wiki.
mcp-server-any-openapi
A MCP server that enables Claude to discover and call any API endpoint through semantic search, handling large OpenAPI specifications and executing requests.
tavily-mcp
Production ready MCP server with real-time search, extract, map & crawl.
@pluggedin/pluggedin-mcp-proxy
A powerful middleware that aggregates multiple Model Context Protocol (MCP) servers into a single unified interface, enabling seamless integration with any MCP client and providing advanced management capabilities.
device-info-mcp
An MCP server that provides information about electronic devices, allowing search by model number and retrieval of detailed information.