Back to MCP directory
publicPublicdnsLocal runtime

mathmcp

一个基于MCP协议的数学计算服务器,提供加减乘除、幂运算和对数等基础数学工具,支持通过Stdio传输与Pydantic AI代理集成

article

README

🚀 数学MCP服务器

本仓库包含一个用于数学计算的MCP(模型上下文协议)服务器。该服务器能为数学计算提供支持,解决在相关场景下的计算需求,具有重要的实用价值。

🚀 快速开始

与Pydantic AI建立连接

使用官方的Pydantic AI MCP客户端:https://ai.pydantic.dev/mcp/client/ 。此MCP服务器与标准输入输出(Stdio)传输方式兼容。

  1. 将仓库克隆到你的代理运行的工作目录中:
git clone https://github.com/ArjunKrish7356/MathAgent.git
  1. 在你的代理代码中创建一个MCP服务器包装器(name可以是任何唯一的ID;args是用于启动服务器进程的命令):
from pydantic_ai.mcp import MCPServerStdio

mcp_server = MCPServerStdio(
    'uv',
    args=[
        "run",
        "MathAgent/main.py"
    ]
)
  1. 向你的代理注册MCP服务器:
from pydantic_ai import Agent

agent = Agent(model="openai:gpt-4o", toolsets=[mcp_server])

⚠️ 重要提示

  • 确保MathAgent/main.py的路径相对于代理运行的位置是正确的,并且该脚本是可运行的。
  • 标准输入输出(Stdio)传输方式将使用提供的args生成配置好的进程;在启动之前,请验证是否已安装所有必需的环境或依赖项。
  • 在部署之前,先在本地测试连接。

✨ 主要特性

当前工具

  • 加法
  • 减法
  • 乘法
  • 除法
  • 幂运算
  • 对数运算

即将推出

  • 取模运算

📚 详细文档

更多资源

  • 官方MCP文档:https://modelcontextprotocol.io/docs/getting-started/intro
  • MCP介绍视频:https://www.youtube.com/watch?v=N3vHJcHBS-w

🤝 贡献

感谢您的关注!欢迎贡献代码,您可以自由地提出问题或提交拉取请求。

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client