A lightweight Model Context Protocol (MCP) server that provides Splitwise integrations and tools for managing users, groups, friends, expenses and notifications. This project is built for Cloudflare Workers using Durable Objects and exposes OAuth endpoints to authorize Splitwise access.
Live URL: https://splitwise-mcp.hifi.click
- MCP Endpoint:
https://splitwise-mcp.hifi.click/sse - OAuth Authorization:
https://splitwise-mcp.hifi.click/authorize
π‘ Ready to use: The server is deployed and ready for integration with Claude Desktop, Cursor, or any MCP-compatible client.
- π Deployed Server
- About
- Features
- Quick Start
- Environment & Configuration
- Local Development
- Endpoints & OAuth Flow
- Available MCP Tools
- MCP Inspector β Testing & Development
- Usage Examples
- Security
- Troubleshooting
- Interactive Examples
- Deployed MCP Server β Preferred for Integrations
- Contributing
- License & Contact
Splitwise MCP is an MCP server implementation designed to act as a bridge between an MCP client (such as an agent) and Splitwise APIs. It exposes a set of MCP tools to perform actions like creating expenses, managing groups, and retrieving notifications. This repository uses Cloudflare Workers (Wrangler), Durable Objects and a small OAuth provider for Splitwise.
- Durable Object based MCP agent (MyMCP) for stateful server behavior
- OAuth endpoints for Splitwise integration
- A rich set of MCP tools for user, group, friend, expense and notification management
- TypeScript, Biome for formatting/linting, and Wrangler for local dev & deploy
π¨ Deployed-first recommendation: This project is intended to be used from a public, deployed MCP server for real integrations (Claude, Cursor, agents). Use local (wrangler dev) only for development and testing. The README below focuses on the deployed-server workflow.
- Node.js (16+ recommended)
- pnpm (because this repo contains a pnpm-lock.yaml) or npm/yarn
- Wrangler (Cloudflare CLI)
# Clone the repository
git clone <your-repo-url>
cd splitwise-mcp-server
# Install dependencies
pnpm installFrom package.json:
pnpm devβ run wrangler dev locallypnpm startβ alias to wrangler devpnpm deployβ run wrangler deploy to publish to Cloudflare
pnpm dev
# or
pnpm startpnpm deployThe server expects several environment variables (set these as Wrangler secrets or in your Cloudflare environment):
SPLITWISE_CONSUMER_KEYβ Splitwise API consumer keySPLITWISE_CONSUMER_SECRETβ Splitwise API consumer secretSPLITWISE_CALLBACK_URLβ OAuth callback URL for SplitwiseBACKEND_URLβ optional backend URL used by the serverPHONE_NUMBERβ phone number used by the validate tool (formatted optionally with a +)
wrangler secret put SPLITWISE_CONSUMER_KEY
wrangler secret put SPLITWISE_CONSUMER_SECRET
wrangler secret put SPLITWISE_CALLBACK_URLThe Durable Object class is MyMCP, and in wrangler.jsonc a binding called MCP_OBJECT is defined. Wrangler will use this when you run local development and when deploying.
Run the development server:
pnpm devThe server will be available at http://127.0.0.1:8787 (or the URL shown by Wrangler).
This project mounts an OAuth provider and MCP API handler with the following routes (as configured in src/index.ts):
POST /sseβ MCP API handler (server mounted here viaMyMCP.mount("/sse")) β primary API endpoint for MCP trafficGET /authorizeβ Start OAuth authorization with SplitwisePOST /registerβ Client registration endpointPOST /tokenβ Token endpoint for exchanging authorization grants
Note: OAuth flows are interactive and usually start by visiting the
/authorizeURL in a browser.
The MCP server registers many tools for interacting with Splitwise. Key ones include:
aboutβ Returns package/about informationvalidateβ Basic server validation (returns phone number formatting)
splitwise_get_current_usersplitwise_update_user
splitwise_get_groupssplitwise_get_groupsplitwise_create_groupsplitwise_delete_groupsplitwise_undelete_groupsplitwise_add_user_to_groupsplitwise_remove_user_from_group
splitwise_get_friendssplitwise_get_friend
splitwise_get_expensesplitwise_get_expensessplitwise_create_expensesplitwise_update_expensesplitwise_delete_expensesplitwise_undelete_expense
splitwise_get_notificationssplitwise_check_auth
Each tool includes input validation via zod (see src/index.ts for parameter shapes).
The easiest way to test and interact with your deployed MCP server is using the official MCP Inspector tool. This provides a web-based interface to explore and test all available MCP tools.
-
Ensure your server is deployed and accessible
pnpm deploy # Note your deployed URL: https://your-deployed-url.workers.dev -
Launch MCP Inspector
# Using pnpx (recommended) pnpx @modelcontextprotocol/inspector@latest # Or using npx npx @modelcontextprotocol/inspector@latest # Or using bunx bunx @modelcontextprotocol/inspector@latest
-
Connect to your MCP server
- The inspector will open in your browser
- Enter your server URL:
https://your-deployed-url.workers.dev/sse - The inspector will automatically discover all available tools
-
Test OAuth flow
- First visit
https://your-deployed-url.workers.dev/authorizeto complete Splitwise OAuth - Then return to the inspector to test authenticated tools
- First visit
Once connected, you'll see all available tools including:
Server Info
aboutβ Get server information and versionvalidateβ Test server connectivity
User Management
splitwise_get_current_userβ Get authenticated user detailssplitwise_update_userβ Update user information
Group Management
splitwise_get_groupsβ List all groupssplitwise_create_groupβ Create new groupsplitwise_add_user_to_groupβ Add members to group
Expense Tracking
splitwise_create_expenseβ Create new expensesplitwise_get_expensesβ List expenses with filterssplitwise_update_expenseβ Modify existing expense
Authentication
splitwise_check_authβ Verify authentication status
β
Visual interface β No need to craft JSON requests manually
β
Schema validation β Built-in parameter validation and hints
β
Real-time testing β Immediate feedback on tool responses
β
Tool discovery β Automatically lists all available tools
β
Error debugging β Clear error messages and stack traces
- Start inspector:
pnpx @modelcontextprotocol/inspector@latest - Connect to:
https://your-deployed-url.workers.dev/sse - Test connection with
abouttool - Complete OAuth at
/authorizeendpoint - Test authenticated tools like
splitwise_get_current_user - Create expenses, manage groups, etc.
After testing with the inspector, use your deployed server with:
Claude Desktop
{
"mcpServers": {
"splitwise": {
"command": "node",
"args": [
"path/to/mcp-client.js",
"https://your-deployed-url.workers.dev/sse"
]
}
}
}Cursor or other MCP clients
- Configure MCP server URL:
https://your-deployed-url.workers.dev/sse - The client will automatically discover and use available tools
Custom Applications
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
const client = new Client({
name: "your-app",
version: "1.0.0",
});
// Connect to your deployed server
await client.connect("https://your-deployed-url.workers.dev/sse");π‘ Pro tip: Always test your tools with the MCP Inspector first before integrating with other clients. It's the fastest way to debug issues and understand tool behavior.
{
"tool": "splitwise_create_expense",
"input": {
"cost": "20.00",
"description": "Dinner at restaurant",
"users": [
{ "user_id": 123, "paid_share": "10.00", "owed_share": "10.00" },
{ "user_id": 456, "paid_share": "10.00", "owed_share": "10.00" }
]
}
}{
"tool": "splitwise_get_current_user",
"input": {}
}{
"tool": "splitwise_create_group",
"input": {
"name": "Weekend Trip",
"type": "trip"
}
}{
"tool": "splitwise_get_expenses",
"input": {
"group_id": 123,
"limit": 10,
"dated_after": "2024-01-01"
}
}- All Splitwise API calls use OAuth 2.0
- Secrets are stored as Wrangler/Cloudflare environment variables
- Redis connections use authenticated tokens
- No sensitive data is logged in production
- Ensure
SPLITWISE_CALLBACK_URLmatches exactly what's configured in your Splitwise app - Verify the callback URL is publicly accessible
- Verify
REDIS_URLandREDIS_TOKENare correct - Check Redis instance is accessible from Cloudflare Workers
- Most tools require a valid authenticated user session
- Use the
splitwise_check_authtool to verify authentication status - Complete OAuth flow at
/authorizeendpoint if not authenticated
- The server respects Splitwise API rate limits
- If you encounter rate limiting, the server will return appropriate error messages
- Consider implementing client-side retry logic with exponential backoff
-
Start local dev server and open the authorize URL in a browser to run the OAuth flow:
pnpm dev # then open http://127.0.0.1:8787/authorize (or the URL shown by Wrangler) -
Use the about tool via your MCP client to check the server is alive (MCP client or agent required). The server will respond with a JSON about payload. If you need to test tools manually, consult the MCP client you use (this repo provides the server side). Tools require a valid authenticated user prop for many actions.
You have deployed the MCP server β great. Use the deployed instance as the primary integration target for hosted LLM platforms (Claude, Cursor), external agents, and any production workflows.
- Public, stable URL that works with OAuth redirects and platform integrations
- Durable Object and Redis behave like production (no local environment gaps)
- Easier to share with teammates or third-party LLM platforms without exposing your machine
Typical deployed URL: https://<your-deployed-subdomain>.workers.dev (or your custom domain). The MCP API is mounted at /sse. OAuth endpoints remain at /authorize, /token, and /register.
curl -X POST "https://your-deployed-url.workers.dev/sse" \
-H "Content-Type: application/json" \
-d '{"tool":"about","input":{}}'If you integrate with hosted LLM platforms, point their tool/plugin/interceptor configuration to the deployed /sse endpoint or use a small proxy adapter to adapt request envelopes. If that returns an error, consult your MCP client for the exact request envelope. The goal is to reach the deployed /sse endpoint with the tool invocation that your client expects.
Contributions are welcome. Please follow these small guidelines:
- Fork the repo and open a PR
- Run formatting and linting before committing:
pnpm formatandpnpm lint:fix - Make sure TypeScript type checks pass:
pnpm type-check
- Add unit tests for the SplitwiseAuthService wrappers
- Add CI to run
pnpm type-check,pnpm format --checkandpnpm lint