|
| 1 | +# SplitCount |
| 2 | + |
| 3 | +Expense splitting via MCP + Claude. Log expenses (including receipt photos), track who paid, and settle up conversationally. |
| 4 | + |
| 5 | +## Architecture |
| 6 | + |
| 7 | +- **MCP server**: Supabase Edge Function (Deno) at `supabase/functions/mcp/` |
| 8 | +- **Database**: Supabase PostgreSQL (groups, members, expenses, splits, settlements) |
| 9 | +- **Client**: Any MCP-compatible client (Claude Desktop, Claude.ai, etc.) |
| 10 | + |
| 11 | +## Setup |
| 12 | + |
| 13 | +### 1. Create a Supabase project |
| 14 | + |
| 15 | +Go to [supabase.com](https://supabase.com), create a new project, and note your: |
| 16 | +- Project URL: `https://<ref>.supabase.co` |
| 17 | +- Service role key (Settings → API) |
| 18 | +- Anon key (Settings → API) |
| 19 | + |
| 20 | +### 2. Run the migration |
| 21 | + |
| 22 | +In the Supabase dashboard → SQL Editor, run the contents of: |
| 23 | +``` |
| 24 | +supabase/migrations/20260315000000_initial_schema.sql |
| 25 | +``` |
| 26 | + |
| 27 | +Or with the Supabase CLI: |
| 28 | +```bash |
| 29 | +supabase link --project-ref <your-ref> |
| 30 | +supabase db push |
| 31 | +``` |
| 32 | + |
| 33 | +### 3. Deploy the Edge Function |
| 34 | + |
| 35 | +```bash |
| 36 | +supabase functions deploy mcp --no-verify-jwt |
| 37 | +``` |
| 38 | + |
| 39 | +The `--no-verify-jwt` flag is required since MCP clients don't send Supabase JWTs. |
| 40 | + |
| 41 | +Your MCP server URL will be: |
| 42 | +``` |
| 43 | +https://<your-ref>.supabase.co/functions/v1/mcp |
| 44 | +``` |
| 45 | + |
| 46 | +### 4. Configure your MCP client |
| 47 | + |
| 48 | +**Claude Desktop** (`~/Library/Application Support/Claude/claude_desktop_config.json`): |
| 49 | + |
| 50 | +```json |
| 51 | +{ |
| 52 | + "mcpServers": { |
| 53 | + "splitcount": { |
| 54 | + "command": "npx", |
| 55 | + "args": ["-y", "mcp-remote", "https://<your-ref>.supabase.co/functions/v1/mcp"] |
| 56 | + } |
| 57 | + } |
| 58 | +} |
| 59 | +``` |
| 60 | + |
| 61 | +> Uses [`mcp-remote`](https://github.com/geelen/mcp-remote) to bridge HTTP MCP servers to the Claude Desktop stdio transport. |
| 62 | +
|
| 63 | +**Claude.ai** (MCP integrations): |
| 64 | +Add the server URL directly: `https://<your-ref>.supabase.co/functions/v1/mcp` |
| 65 | + |
| 66 | +## Usage |
| 67 | + |
| 68 | +### Create a group |
| 69 | +> "Create a new expense group called 'Barcelona Trip' with my name as Alex" |
| 70 | +
|
| 71 | +Claude will return a **6-character join code** (e.g. `XK7M2P`) and your **member_id**. Share the join code with friends. |
| 72 | + |
| 73 | +### Join a group |
| 74 | +> "Join group XK7M2P, my name is Jordan" |
| 75 | +
|
| 76 | +### Log an expense |
| 77 | +> "Log a $45 dinner expense, I paid, split equally among everyone" |
| 78 | +
|
| 79 | +**From a receipt photo**: Share the image with Claude, then ask it to log it: |
| 80 | +> "Here's my receipt [image]. Add it as an expense split equally." |
| 81 | +
|
| 82 | +Claude will read the receipt, extract the amount and description, and call `add_expense` with the details. |
| 83 | + |
| 84 | +### Check balances |
| 85 | +> "Who owes what in our group?" |
| 86 | +
|
| 87 | +### Settle up |
| 88 | +> "Jordan just paid me back $22.50 — record that" |
| 89 | +
|
| 90 | +## Identity model |
| 91 | + |
| 92 | +There is no login. When you create or join a group, you receive a **member_id** (UUID). This is your permanent identity — save it. Claude stores it in conversation context and will remind you to note it down. |
| 93 | + |
| 94 | +If you switch devices or start a new conversation, use `get_member` to confirm your identity: |
| 95 | +> "My member ID is abc123... — what group am I in?" |
| 96 | +
|
| 97 | +## Tools |
| 98 | + |
| 99 | +| Tool | Description | |
| 100 | +|------|-------------| |
| 101 | +| `create_group` | Create a group, get a join code | |
| 102 | +| `join_group` | Join with a join code + display name | |
| 103 | +| `get_group` | Group info and member list | |
| 104 | +| `add_expense` | Log an expense (equal/exact/percent splits) | |
| 105 | +| `list_expenses` | View expenses with split details | |
| 106 | +| `delete_expense` | Soft-delete an expense you logged | |
| 107 | +| `get_balances` | Net balances + minimum payments to settle | |
| 108 | +| `record_settlement` | Record a payment between members | |
| 109 | +| `get_settlement_history` | Past settlements | |
| 110 | +| `get_member` | Look up your member info | |
| 111 | +| `rename_member` | Change your display name | |
| 112 | + |
| 113 | +## Local development |
| 114 | + |
| 115 | +```bash |
| 116 | +supabase start # starts local Postgres + Edge Functions runtime |
| 117 | +supabase functions serve mcp --no-verify-jwt |
| 118 | +``` |
| 119 | + |
| 120 | +Test with curl: |
| 121 | +```bash |
| 122 | +curl -X POST http://localhost:54321/functions/v1/mcp \ |
| 123 | + -H "Content-Type: application/json" \ |
| 124 | + -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' |
| 125 | +``` |
0 commit comments