mcp-server-multitask
mcp_training
一个MCP服务器,提供天气、地理编码和货币工具,以及一个控制台客户端,可与能够使用这些工具的OpenAI模型对话。
Tú › ¿Qué tiempo hace en Madrid?
Modelo:
En Madrid hay 24,3 °C, humedad del 41 % y cielo despejado.
· get_lat_lon_from_city → get_current_weather工作原理
main_client.py ──> OpenAI (Responses API) ──> [túnel] ──> main_server.py (MCP)
tu terminal el modelo decide 5 herramientas
qué herramientas usa sobre APIs públicas客户端不执行工具:它将MCP服务器的公共URL传递给OpenAI,由OpenAI列出、调用和链接这些工具(城市→坐标→天气)。因此,服务器必须可从互联网访问:OpenAI从其服务器连接,而不是从你的机器。
工具
工具 | 输入 | 输出 |
| 城市名称 | 纬度和经度 |
| 坐标 | 温度、湿度、天空状态 |
| 坐标 | 7天预报 |
| 两个ISO代码 | 当前汇率 |
| 金额 + 汇率 | 转换后的金额 |
天气和地理编码使用Open-Meteo(免费,无需密钥)。货币使用ExchangeRate-API,需要密钥,支持20种货币(CLI中使用/monedas)。
结构
config/settings.py configuración y logging (todo sale del .env)
server/ herramientas + clientes HTTP de las APIs externas
client/ cliente de OpenAI + interfaz de terminal
main_server.py arranca el servidor MCP
main_client.py arranca la conversaciónRelated MCP server: Python Weather MCP Server
安装
需要Python 3.11+。使用uv(推荐):
git clone <url-del-repo>
cd mcp_training
uv sync或者使用pip和虚拟环境:
python -m venv .venv
.venv\Scripts\activate # Windows; en Linux/macOS: source .venv/bin/activate
pip install -r requirements.txt配置
复制示例并填写你的密钥:
cp .env.example .env只有两个变量是必需的:
变量 | 用途 |
| 汇率(在此获取免费密钥) |
| 客户端的模型 |
还有第三个变量MCP_PUBLIC_URL,将在下一步填写。其他所有内容(模型、端口、传输、超时、日志级别)都有合理的默认值,并在.env.example中有文档说明。
使用
需要三个终端:服务器、隧道和客户端。
1. 启动MCP服务器
uv run python main_server.py监听在http://127.0.0.1:8002/mcp。
2. 通过隧道发布服务器
OpenAI需要一个公共URL来访问服务器。使用devtunnel:
devtunnel port create -p 8002 --allow-anonymous
devtunnel host复制输出的URL(https://xxxxxxx-8002.euw.devtunnels.ms)并放入.env文件中:
MCP_PUBLIC_URL=https://xxxxxxx-8002.euw.devtunnels.ms任何隧道都可以(ngrok、Cloudflare Tunnel等);只要URL可从外部访问即可。如果URL不包含/mcp,客户端会自动添加。
3. 启动客户端
uv run python main_client.py输入你的查询并按回车。对话有记忆:在询问马德里后,你可以简单地说“那明天呢?”。
Convierte 100 USD a EUR
¿Cuál es el clima actual en Madrid?
Dame el pronóstico del tiempo para Nueva YorkCLI命令:
命令 | 功能 |
| 工具、示例和命令 |
| 支持的货币代码 |
| 退出(也可用Ctrl+C和Ctrl+D) |
在没有客户端的情况下使用服务器
该服务器是标准的MCP服务器:适用于任何兼容的客户端。要将其作为子进程连接(Claude Desktop、Claude Code等),在.env中设置MCP_TRANSPORT=stdio;这样就不需要隧道和端口了。
常见问题
症状 | 原因 |
启动时提示 | 缺少 |
客户端无法启动并提示 |
|
模型说无法使用工具 | 服务器或隧道已关闭,或 |
OpenAI配额错误 | 余额不足;重试无法解决 |
要查看每次调用的详细信息(参数、响应、URL),在.env中设置LOG_LEVEL=DEBUG。日志输出到stderr,因此python main_client.py > charla.txt只保存对话内容。
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityDmaintenanceA server that integrates the MCP library with OpenAI's API, allowing users to interact with various tools, such as the weather tool, through natural language queries.MIT
- AlicenseBqualityDmaintenanceEnables AI agents to fetch real-time weather data for any location using the OpenWeatherMap API. Demonstrates how to build a simple MCP server that exposes weather information as a tool for LLMs.1GPL 3.0
- Alicense-qualityDmaintenanceAn MCP server that enables AI assistants to call weather tools, read resources, and use prompt templates for live weather data integration.1,299MIT
- Flicense-qualityCmaintenanceAn MCP server that integrates ExchangeRate-API and Open-Meteo to provide currency conversion and weather tools, enabling natural language queries for exchange rates, weather, and geocoding.
Related MCP Connectors
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
MCP server connecting AI agents to non-custodial staking data across 130+ networks.
MCP server for AI dialogue using various LLM models via AceDataCloud
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Jotarose/mcp-server-multitask'
If you have feedback or need assistance with the MCP directory API, please join our Discord server