使用说明
拆分MCP服务器
A. 模型上下文协议(MCP) 公开完整信息的服务器 API花键 作为LLM可调用工具。适用于Claude Desktop、VS Code Copilot和任何兼容MCP的客户端。
特性
- 27工具 涵盖所有Splitwise域:用户、组、朋友、费用、评论、通知、货币、类别
- 异步HTTP客户端 由...驱动
httpx用于快速、无阻塞的API调用 - LLM友好输出 --回复的格式为简洁易读的文本
- API密钥验证 现在,OAuth 2.0架构已经为未来的SaaS部署做好了准备
快速开始
1.安装依赖项
uv sync
2.配置API密钥
复制 .env.example 到 .env 并添加您的Splitwise API密钥:
cp .env.example .env
# Edit .env and set SPLITWISE_API_KEY=your-key-here
在获取API密钥 https://secure.splitwise.com/apps.
3.使用MCP检验员进行测试
uv run mcp dev src/splitwise_mcp/server.py
4.添加到克劳德桌面
将此添加到您的 claude_desktop_config.json:
{
"mcpServers": {
"splitwise": {
"command": "uv",
"args": [
"--directory",
"C:\\Users\\Rohan Gupta\\Documents\\coding\\splitwise_mcp",
"run",
"splitwise-mcp"
]
}
}
}
在macOS/Linux上,相应地调整路径。
可用工具
| 域 | 工具 |
|---|---|
| 用户 | get_current_user, get_user, update_user |
| 群组 | list_groups, get_group, create_group, delete_group, restore_group, add_user_to_group, remove_user_from_group |
| 老友记 | list_friends, get_friend, add_friend, add_friends, delete_friend |
| 开支 | list_expenses, get_expense, create_expense, update_expense, delete_expense, restore_expense |
| 评论 | get_comments, create_comment, delete_comment |
| 通知 | get_notifications |
| 其他 | list_currencies, list_categories |
项目结构
src/splitwise_mcp/
├── server.py # MCP server entry point (FastMCP + lifespan)
├── config.py # Settings loaded from .env
├── client.py # Async Splitwise API client (httpx)
├── models/ # Pydantic models for API responses
├── tools/ # MCP tool definitions (one file per domain)
│ ├── users.py
│ ├── groups.py
│ ├── friends.py
│ ├── expenses.py
│ ├── comments.py
│ ├── notifications.py
│ └── other.py
└── utils/
└── formatters.py # LLM-friendly text formatters
发展
# Install dev dependencies
uv sync --dev
# Lint
uv run ruff check src/
# Format
uv run ruff format src/
许可证
麻省理工学院
