money-split-mcp

money-split-mcp

A remote, multi-user MCP server for splitting group expenses, enabling users to register, create groups, add members, log expenses, and view balances through MCP clients.

Category
访问服务器

README

money-split-mcp

A remote, multi-user MCP server for splitting group expenses (Splitwise-lite). Each user registers an account by email, gets an API key, and uses that key to create groups, add members by email, log expenses, and see who owes whom — all through an MCP client (Claude Desktop, claude.ai connectors, etc.).

How it works

  • POST /register is a plain REST endpoint (not an MCP tool) that creates a user and returns a one-time API key.
  • Every other call goes through POST /mcp (MCP Streamable HTTP) with Authorization: Bearer <api_key>. The server is stateless: each request resolves the caller from their API key and builds a fresh, user-scoped set of tools.
  • Data (users, groups, expenses, shares, settlements) lives in Postgres via Prisma.

Local setup

  1. Copy .env.example to .env and adjust DATABASE_URL if needed.
  2. Get a local Postgres running, matching .env's DATABASE_URL (moneysplit/moneysplit/db moneysplit on localhost:5432):
    • Native install: sudo apt-get install -y postgresql postgresql-contrib, then:
      sudo -u postgres psql -c "CREATE USER moneysplit WITH PASSWORD 'moneysplit';"
      sudo -u postgres psql -c "CREATE DATABASE moneysplit OWNER moneysplit;"
      
    • Docker (if available): docker compose up -d
  3. Install deps and run the first migration:
    npm install
    npm run prisma:migrate
    
  4. Start the dev server: npm run dev (listens on http://localhost:3000 by default).
  5. Run the unit tests any time: npm test (covers the split/balance math, no DB needed).

Manually testing the full flow

Register two users:

curl -s localhost:3000/register -H 'content-type: application/json' \
  -d '{"email":"alice@example.com","name":"Alice"}'
curl -s localhost:3000/register -H 'content-type: application/json' \
  -d '{"email":"bob@example.com","name":"Bob"}'

Each response includes an apiKey — save both, they're never shown again.

Then drive the MCP tools with the MCP Inspector:

npx @modelcontextprotocol/inspector

Connect it to http://localhost:3000/mcp (Streamable HTTP transport) with header Authorization: Bearer <alice's apiKey>, then call tools in order:

  1. create_group { "name": "Trip to Goa" } → note the returned group id
  2. add_member_to_group { "group_id": "...", "email": "bob@example.com" }
  3. add_expense { "group_id": "...", "description": "Hotel", "amount": 100 } (defaults: paid by Alice, split evenly across all members)
  4. get_balances { "group_id": "..." } → Alice should show +50, Bob -50, with a suggested settlement of Bob paying Alice 50.
  5. Reconnect the Inspector with Bob's API key and call settle_up { "group_id": "...", "to_email": "alice@example.com", "amount": 50 }, then get_balances again to confirm both are back to 0.

Deploying to Render

This repo includes a render.yaml Blueprint that provisions a Postgres database and a Node web service together.

  1. Push this repo to GitHub.
  2. In the Render dashboard: New > Blueprint, point it at the repo — it will read render.yaml and create both the money-split-db database and the money-split-mcp web service, wiring DATABASE_URL automatically.
  3. The web service's build command runs npx prisma migrate deploy after compiling, keeping the schema in sync on every deploy. (Render's free plan doesn't support the separate preDeployCommand step, so it's folded into the build instead.)
  4. Once deployed, verify:
    curl https://<your-service>.onrender.com/health
    

Note: Render's free Postgres plan expires after a fixed trial period — check current Render pricing before relying on it long-term; swap in any external Postgres (e.g. Neon, Supabase) by just changing DATABASE_URL if needed.

Using it from an MCP client

  1. Register a real account against the deployed URL:

    curl -s https://<your-service>.onrender.com/register -H 'content-type: application/json' \
      -d '{"email":"you@example.com","name":"Your Name"}'
    
  2. Add it as a remote MCP server in your client.

    Claude Code (CLI) — add it at local scope (not committed to git) with the key pulled from an env var, since .mcp.json would otherwise be shared/committed:

    export MONEY_SPLIT_API_KEY=<your apiKey>
    
    claude mcp add --transport http money-split https://<your-service>.onrender.com/mcp \
      --header "Authorization: Bearer \${MONEY_SPLIT_API_KEY}"
    

    Claude Desktop — add to its config:

    {
      "mcpServers": {
        "money-split": {
          "url": "https://<your-service>.onrender.com/mcp",
          "headers": { "Authorization": "Bearer <your apiKey>" }
        }
      }
    }
    

    (Check your specific client's docs for the exact key names it expects for a remote Streamable HTTP server with custom headers — some clients configure this through a UI instead of raw JSON.)

  3. Each group member registers their own account and adds the server with their own key — that's what ties MCP activity back to "their" groups and balances.

  4. From inside the client: "create a group called Goa Trip", "add bob@example.com to it", "log a ₹3000 hotel expense split evenly", "who owes whom in the Goa Trip group?".

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选