拆分MCP服务器
 
一种集成了以下功能的模型上下文协议(MCP)服务器 分行.连接您的人工智能助手(Claude、Cursor等),使用自然语言管理Splitwise的费用,并提供语音支持!
运作原理
flowchart LR
Client[Claude / Cursor] -->|MCP| Server[splitwise-mcp]
Server -->|audio| Deepgram[Deepgram STT]
Deepgram -->|text| Gemini[Gemini 3 Flash]
Gemini -->|action| Splitwise[Splitwise API]特性
| 工具 | 说明 |
|---|---|
voice_command | 发送音频→ Deepgram转录→ 双子进程→ 执行拆分 |
text_command | 发送文本→ 双子进程→ 执行拆分 |
add_expense | 添加费用,支持团体、百分比、除外责任和特定付款人 |
delete_expense | 按ID删除费用 |
list_friends | 列出您的Splitwise好友 |
configure_splitwise | 配置API凭据 |
login_with_token | 使用OAuth2令牌登录 |
智能名称匹配:如果Deepgram转录了“Humeet”,但你的朋友是“Sumeet”的话,双子座会要求你澄清,而不是猜测。
高级拆分
- 百分比:“我分得40%,爱丽丝分得60%”
- 群组:“添加到公寓组”(自动获取成员)
- 除外条款:“添加到公寓,但排除Bob”
- 支付方:“爱丽丝付了50美元”
- 删除:“删除费用12345”
安装
选项1:从PyPI安装(推荐)
pip install splitwise-mcp选项2:从源代码安装
- 克隆存储库:
git clone https://github.com/hubshashwat/the-splitwise-mcp.git
cd the-splitwise-mcp- 创建并激活虚拟环境:
python3 -m venv .venv
source .venv/bin/activate- 安装软件包:
pip install -e .配置
您需要API密钥,具体取决于您想要的功能:
必需(核心拼接功能)
- 拆分API键 (https://secure.splitwise.com/apps/new)
- 注册新应用程序 - 获取:消费者密钥、消费者秘密和API密钥 - 要求……: add_expense, list_friends, delete_expense
可选(AI功能)
- Gemini API密钥 (https://aistudio.google.com/) - *可选的*
- 创建API密钥(可用的免费层) - 模型:使用Gemini 3.0 Flash-确保您的API密钥可以访问此模型 - 要求……: text_command (自然语言处理)
- Deegram API密钥 (https://console.deepgram.com/) - *可选的*
- 注册并获取API密钥(提供免费层) - 要求……: voice_command (音频转录)
摘要:
- 纯文本用户:需要Splitwise+Gemini密钥(跳过Deepgram)
- 语音用户:需要全部5把钥匙
- API基本用户:只需要3个拼接键
设置环境变量 在您的shell中或添加到您的Claude Desktop配置中(见下文)。
用法
您可以在中使用此服务器 两种方式:
选项A:独立终端代理(不需要Claude!)🖥️
直接在终端中运行语音/文本代理:
# Install the package
pip install splitwise-mcp
# Download the agent script
curl -O https://raw.githubusercontent.com/hubshashwat/the-splitwise-mcp/main/run_agent.py
# Set environment variables
export SPLITWISE_CONSUMER_KEY="your_key"
export SPLITWISE_CONSUMER_SECRET="your_secret"
export SPLITWISE_API_KEY="your_api_key"
export GEMINI_API_KEY="your_gemini_key"
export DEEPGRAM_API_KEY="your_deepgram_key"
# Run the agent
python run_agent.py命令:
v或voice-录制10秒的音频并对其进行处理t或text-键入命令q或quit-退出
示例会话:
🤖 Splitwise Voice Agent
Enter command (voice/text/quit): t
Enter request: Add expense of $50 with John for dinner
⚠️ Proposed Action:
Function: add_expense
Args: {
"description": "dinner",
"cost": 50.0,
"split_with": ["John"]
}
Proceed? (yes/edit/cancel): yes
✅ Expense added!选项B:使用MCP客户端💬
此服务器使用 stdio传输 并与 所有MCP兼容客户端:
克劳德桌面
添加到您的配置中:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - 视窗:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"splitwise": {
"command": "full path of python",
"args": ["-m", "splitwise_mcp.server"],
"env": {
"SPLITWISE_CONSUMER_KEY": "your_consumer_key",
"SPLITWISE_CONSUMER_SECRET": "your_consumer_secret",
"SPLITWISE_API_KEY": "your_api_key",
"GEMINI_API_KEY": "your_gemini_key",
"DEEPGRAM_API_KEY": "your_deepgram_key"
}
}
}
}备注:如果splitwise-mcp控制台命令可用,您可以使用"command": "splitwise-mcp"没有args。
然后在克劳德: *“加上与约翰共进晚餐的费用50美元”*
Claude CLI
使用相同的配置格式 claude-cli --mcp-config.
游标/VS代码(反重力、Cline、Continue.dev)
添加到MCP设置(.vscode/settings.json 或光标设置):
{
"mcp.servers": {
"splitwise": {
"command": "full path of python",
"args": ["-m", "splitwise_mcp.server"],
"env": {
"SPLITWISE_CONSUMER_KEY": "your_consumer_key",
"SPLITWISE_CONSUMER_SECRET": "your_consumer_secret",
"SPLITWISE_API_KEY": "your_api_key",
"GEMINI_API_KEY": "your_gemini_key",
"DEEPGRAM_API_KEY": "your_deepgram_key"
}
}
}
}然后你可以问你的AI助手: *“使用Splitwise添加费用…”*
其他MCP客户端
此服务器与支持stdio传输的任何MCP客户端兼容。使用相同的配置模式。
______________________________________________________________________
备注:如果从源代码而不是pip安装,请使用可执行文件的完整路径:
- macOS/Linux:
"/path/to/the-splitwise-mcp/.venv/bin/splitwise-mcp" - 视窗:
"C:\\path\\to\\the-splitwise-mcp\\.venv\\Scripts\\splitwise-mcp.exe"
远程访问(SSE)
要通过HTTP为远程客户端运行MCP服务器,请执行以下操作:
.venv/bin/uvicorn splitwise_mcp.sse:app --host 0.0.0.0 --port 8000连接方式: http://YOUR_IP:8000/sse
发展
运行测试:
.venv/bin/python tests/test_logic.py故障排除
麦克风问题(macOS)
如果代理立即说“录制完成”,但没有捕获到音频(音量:0.0),则您的终端可能缺乏麦克风权限。
- 首选 系统设置>隐私和安全>麦克风.
- 允许访问您的终端应用程序(终端、iTerm、VS代码等)。
- 重新启动终端 以使更改生效。
许可证
麻省理工学院
