FastMCP Todo Server
简单的MCP服务器,为我的本地光标提供访问权限,以便向我的MongoDB待办事项列表中添加项目。
概述
FastMCP 待办事项服务器是 Swarmonomicon 项目的组件,允许通过 MQTT 协议向 MongoDB 中添加待办事项。
快速安装
# 克隆仓库
git clone https://github.com/DanEdens/fastmcp-todo-server.git
cd fastmcp-todo-server
# 安装 uv (如需)
curl -LsSf https://astral.sh/uv/install.sh | sh
# 创建并激活虚拟环境
uv venv
source .venv/bin/activate # Unix/macOS
# 或 .venv\Scripts\activate # Windows
# 安装依赖
uv pip install -r requirements.txt
# 创建 .env 文件
echo "MONGODB_URI=mongodb://localhost:27017
MONGODB_DB=swarmonomicon
MONGODB_COLLECTION=todos" > .env
使用方法
启动服务器
python -m src.fastmcp_todo_server
添加待办事项
使用 Python 客户端:
from fastmcp import FastMCPClient
client = FastMCPClient()
response = await client.call_tool("add_todo", {
"description": "示例待办事项",
"priority": "high", # 可选
"target_agent": "user" # 可选
})
使用 MQTT:
mosquitto_pub -t "mcp/todo/new" -m '{
"description": "示例待办事项",
"priority": "high",
"target_agent": "user"
}'
开发
# 安装开发依赖
uv pip install -r requirements-dev.txt
# 运行测试
pytest tests/
# 运行带覆盖率的测试
pytest --cov=src tests/
许可证
MIT 许可证
更多信息请参阅 Swarmonomicon 项目文档