pymcp
a MCP server
SDK
https://github.com/modelcontextprotocol/python-sdk
项目结构
环境初始化
安装依赖
使用 uv 管理依赖:
环境变量配置
复制 .env.example
文件并重命名为 .env
,然后根据你的实际情况修改其中的值:
环境变量说明:
LLM_BASE_URL
:LLM API的基础URLLLM_API_KEY
:访问LLM API的密钥LLM_MODEL
:要使用的模型名称MCP_SERVER_PORT
:MCP服务器端口(默认为8000)
运行MCP服务器
MCP服务器支持多种传输方式:
stdio方式(默认)
SSE方式
服务器将在 http://127.0.0.1:8000 启动
Streamable HTTP方式
服务器将在 http://127.0.0.1:8000 启动
执行测试
基础功能测试
真实LLM调用测试
使用LangChain Agent的测试 (stdio方式)
使用LangChain Agent的测试 (SSE方式)
使用LangChain Agent的测试 (Streamable HTTP方式)
依赖说明
生产依赖:
mcp[cli]>=1.12.4
- MCP Python SDK
测试依赖:
openai>=1.99.9
- OpenAI Python客户端python-dotenv>=1.0.1
- 环境变量加载工具httpx[socks]>=0.28.1
- HTTP客户端(支持SOCKS代理)langchain>=0.3.27
- LangChain核心库langchain-openai>=0.3.29
- LangChain的OpenAI集成langchain-mcp-adapters>=0.1.9
- LangChain与MCP的适配器langgraph>=0.6.4
- LangGraph库,用于构建agent工作流
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
A simple MCP server that provides integer addition functionality. Enables users to perform basic arithmetic operations by adding two integers together through natural language interactions.
Related MCP Servers
- AsecurityFlicenseAqualityA simple and extendable MCP server that currently provides basic addition functionality and can be easily extended by defining new tools with docstrings.Last updated -4Python
- -securityFlicense-qualityA server that provides basic mathematical operations (addition, subtraction, multiplication, division, power, square root) through MCP tools for use with AI assistants like Claude.Last updated -Python
- -securityFlicense-qualityA containerized MCP (Model Context Protocol) server that provides a simple calculator tool for adding two numbers, deployable to Kubernetes/EKS environments.Last updated -4Python
- -securityFlicense-qualityA simple calculator MCP server that provides basic arithmetic functions (add and subtract) through HTTP transport, designed to be cloud-ready and easily deployable.Last updated -Python