学习如何编写MCP服务器
要通过Smithery自动安装mcp-server:
npx -y @smithery/cli install @yiGmMk/mcp-server --client claude
如果未安装UV,请参考文档UV安装文档
在MacOS或Linux上可以使用以下命令进行安装:
curl -LsSf https://astral.sh/uv/install.sh | sh
在Windows上,在PowerShell下安装:
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
优先使用以下配置方法:
{
"mcpServers": {
"yiGmMk/mcp-server": {
"command": "uv",
"args": [
"--directory",
"/path/to/your/mcp-server",
"run",
"main.py"
],
"env": {
"JINA_API_KEY": "jina_api_key,请从https://jina.ai/reader获取",
"GOOGLE_AI_STUDIO_KEY": "Google AI Studio api key,请从https://aistudio.google.com/apikey获取",
"PYTHONIOENCODING": "utf-8"
},
"disabled": false,
"autoApprove": []
}
}
}
或者使用虚拟环境(增加环境变量配置):
{
"mcpServers": {
"yiGmMk/mcp-server": {
"command": "uv",
"args": [
"run",
"/path/to/your/mcp-server/main.py"
],
"env": {
"VIRTUAL_ENV": "/path/to/your/mcp-server/.venv",
"JINA_API_KEY": "jina_api_key,请从https://jina.ai/reader获取",
"GOOGLE_AI_STUDIO_KEY": "Google AI Studio api key,请从https://aistudio.google.com/apikey获取",
"PYTHONIOENCODING": "utf-8"
},
"disabled": false,
"autoApprove": []
}
}
}
name.ai提供了各种工具,例如搜索和阅读网页等。