Test FastMCP
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Test FastMCP calculate 156 plus 243"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Test FastMCP
一个使用 FastMCP 框架构建的 MCP 服务器,提供基本的数学运算功能。
🚀 功能特性
加法运算 (
add) - 计算两个整数的和减法运算 (
subtract) - 计算两个整数的差乘法运算 (
multiply) - 计算两个整数的积除法运算 (
divide) - 计算两个整数的商
Related MCP server: Fast MCP Local
📋 系统要求
Python 3.12+
uv 包管理器
Cursor IDE (用于MCP集成)
🛠️ 安装和设置
1. 安装 uv
如果你还没有安装 uv,请先安装:
# macOS/Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# 或者使用 pip
pip install uv2. 项目设置
克隆项目:
git clone <repository-url> cd test_fast_mcp安装依赖:
uv sync激活虚拟环境:
uv shell运行服务器:
uv run python main.py
🔧 开发命令
启动开发服务器:
uv run dev运行测试:
uv run test代码格式化:
uv run format代码检查:
uv run lint导入排序:
uv run sort
添加新依赖
# 添加生产依赖
uv add package-name
# 添加开发依赖
uv add --dev package-name更新依赖
uv lock --upgrade🔌 Cursor 集成
配置 MCP 服务器

将以下配置添加到你的 Cursor MCP 配置文件 (~/.cursor/mcp.json) 中:
{
"mcpServers": {
"test-fast-mcp": {
"command": "uv",
"args": ["run", "python", "/Users/guosong/Desktop/Sina/Code/test_fast_mcp/main.py"],
"env": {
"PYTHONPATH": ".",
"TRANSPORT": "stdio"
}
}
}
}重要配置说明:
使用绝对路径指向
main.py文件添加
"TRANSPORT": "stdio"环境变量确保
PYTHONPATH设置正确
验证集成
重启 Cursor IDE
检查 MCP 服务器状态(应该显示 "4 tools enabled")
测试工具调用
📁 项目结构
test_fast_mcp/
├── main.py # 主服务器文件,包含所有工具定义
├── pyproject.toml # 项目配置和依赖管理
├── uv.lock # 依赖锁定文件
├── mcp.json # Cursor MCP 配置示例
├── test_tools.py # 工具测试文件
└── README.md # 项目说明文档🧪 测试工具
运行测试脚本来验证数学函数:
python test_tools.py预期输出:
Testing math functions:
add(5, 4) = 9
subtract(10, 3) = 7
multiply(6, 7) = 42
divide(15, 3) = 5.0🔍 故障排除
常见问题
"No tools or prompts" 错误
确保使用绝对路径配置
添加
TRANSPORT: "stdio"环境变量重启 Cursor IDE
构建错误
运行
uv sync重新安装依赖检查
pyproject.toml配置
工具无法调用
确认 MCP 服务器正在运行
检查工具名称格式:
mcp_test-fast-mcp_<tool_name>
调试步骤
检查服务器状态:
ps aux | grep "python main.py"查看服务器日志:
uv run python main.py测试工具功能:
python -c "from main import add; print(add(5, 4))"
🏗️ 开发指南
这个项目使用 FastMCP 框架,它简化了 MCP 服务器的创建过程。
添加新工具
在
main.py中定义新函数使用
@mcp.tool装饰器添加详细的文档字符串
重启服务器
示例:
@mcp.tool
def new_tool(param: str) -> str:
"""Tool description.
Args:
param: Parameter description
Returns:
Return value description
"""
return f"Processed: {param}"工具命名规范
使用小写字母和下划线
提供清晰的参数类型注解
包含详细的文档字符串
添加适当的错误处理
📄 许可证
MIT License
🤝 贡献
欢迎提交 Issue 和 Pull Request!
📞 支持
如果遇到问题,请:
检查故障排除部分
查看项目 Issues
提交新的 Issue
Available Tools
4 toolsaddA
Add two integers together.
Args: a: First integer b: Second integer
Returns: The sum of a and b
Inputs: a (required), b (required). Returns: result
divideA
Divide the first integer by the second.
Args: a: First integer (dividend) b: Second integer (divisor)
Returns: The quotient of a divided by b
Inputs: a (required), b (required). Returns: result
multiplyA
Multiply two integers together.
Args: a: First integer b: Second integer
Returns: The product of a and b
Inputs: a (required), b (required). Returns: result
subtractA
Subtract the second integer from the first.
Args: a: First integer b: Second integer
Returns: The difference of a and b
Inputs: a (required), b (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool has a clearly distinct mathematical operation: addition, division, multiplication, and subtraction. There is no overlap in purpose, and the descriptions make it immediately obvious which tool to use for each basic arithmetic operation.
All tool names follow a consistent pattern of simple, single-word verbs describing the mathematical operation (add, divide, multiply, subtract). There is no mixing of naming conventions or styles, making the set highly predictable and readable.
With exactly four tools covering the four basic arithmetic operations, this server is perfectly scoped for its purpose. Each tool earns its place with no redundancy or missing core functionality, making it an ideal minimal set for arithmetic calculations.
For a server focused on basic arithmetic, this tool set is complete with full coverage of addition, subtraction, multiplication, and division. There are no gaps in the core operations, and agents can perform all fundamental calculations without dead ends.
Maintenance
Related MCP Connectors
This MCP server enables users to perform scientific computations regarding linear algebra and vect…
A simple MCP server built with FastMCP and python
Math MCP server for primality, factorization, Java templates, and integer multiplication.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceA simple MCP server that provides basic calculator functionality for performing mathematical operations. Built with FastMCP and demonstrates fundamental MCP server implementation patterns.-
- AlicenseNot gradedqualityDmaintenanceA minimal FastMCP server implementation that provides basic mathematical and greeting tools. Enables users to perform simple operations like adding numbers and greeting people by name through a lightweight MCP interface.MIT
- FlicenseNot gradedqualityDmaintenanceA simple educational MCP server providing basic math operations, string manipulation, and greeting functionality. Demonstrates how to implement MCP tools for learning purposes.-
- FlicenseNot gradedqualityDmaintenanceA demonstration MCP server that provides calculator functionality through both stdio and FastAPI implementations. Enables users to perform mathematical calculations via MCP tools using the FastMCP framework.-