splitwise-chatgpt-mcp
A data-only MCP server that connects ChatGPT to Splitwise's official API, enabling listing groups, friends, and expenses, as well as creating expenses with equal or explicit splits via natural language.
README
Splitwise connector for ChatGPT
A data-only MCP server that connects ChatGPT to Splitwise's official API. It supports:
list_groups(compact, paginated groups and members)list_friends(compact, paginated balances)list_expenses(compact, paginated summaries)get_expensecreate_expense(equal group split or explicit shares)update_expense(complete replacement shares for an existing expense)
The server uses Streamable HTTP at /mcp. It also acts as a small OAuth 2.1 authorization bridge: ChatGPT completes PKCE with this server, while this server completes Splitwise OAuth and keeps the Splitwise token out of ChatGPT.
Prerequisites
- Node.js 20 or newer
- A stable public HTTPS URL for deployment (or a development tunnel while testing)
- A Splitwise account and Splitwise OAuth application
1. Register the Splitwise application
- Open https://secure.splitwise.com/apps and create an OAuth application.
- Set its callback URL to
https://YOUR-CONNECTOR-HOST/oauth/splitwise/callback. - Copy the client ID and client secret. Never commit them.
Splitwise must redirect to the connector, not directly to ChatGPT. The connector resumes ChatGPT's separate PKCE flow afterward.
2. Configure and run
cp .env.example .env
# Fill in .env, then:
npm install
npm run dev
Required variables:
| Variable | Purpose |
|---|---|
PUBLIC_BASE_URL |
Public HTTPS origin, without a trailing slash |
SPLITWISE_CLIENT_ID |
Splitwise OAuth app client ID |
SPLITWISE_CLIENT_SECRET |
Splitwise OAuth app secret |
SESSION_SECRET |
Stable random secret, at least 32 characters, used to authenticate and encrypt OAuth artifacts |
Optional variables: PORT, SPLITWISE_AUTHORIZE_URL, SPLITWISE_TOKEN_URL, and SPLITWISE_API_BASE_URL.
Generate a session secret with openssl rand -hex 32. For a container:
docker build -t splitwise-mcp .
docker run --env-file .env -p 3000:3000 splitwise-mcp
3. OAuth flow
- ChatGPT discovers
/.well-known/oauth-protected-resourcefrom the MCP server. - It discovers this connector's OAuth metadata at
/.well-known/oauth-authorization-serverand dynamically registers a public client at/register. - ChatGPT starts authorization-code + PKCE at
/authorize, including the MCPresourcevalue. - The connector redirects the user to Splitwise and receives the result at
/oauth/splitwise/callback. - The connector exchanges Splitwise's code server-side, creates a five-minute encrypted connector code, and redirects to ChatGPT.
- ChatGPT exchanges that code at
/tokenusing its PKCE verifier. The connector returns an authenticated, encrypted access token containing the minimum session context. - Every
/mcprequest decrypts and validates the token, expiry, scope context, and resource before calling Splitwise.
Dynamic client registrations, connector codes, and 30-day access tokens are stateless AES-256-GCM envelopes derived from SESSION_SECRET. They survive sleeping, restarts, redeploys, and multiple replicas as long as every instance keeps the same secret. Rotating SESSION_SECRET intentionally invalidates every existing registration and connection. This sample does not issue refresh tokens, so relinking is required after 30 days.
4. Test and connect to ChatGPT
Run:
npm run build
npm test
npx @modelcontextprotocol/inspector@latest
In the Inspector choose Streamable HTTP and use https://YOUR-CONNECTOR-HOST/mcp.
In ChatGPT, enable Developer mode under Settings → Security and login. In the Plugins page, add a connection, choose the public endpoint option, and enter https://YOUR-CONNECTOR-HOST/mcp. Review the five discovered tools, then invoke a read tool to start account linking.
Suggested checks:
- “List my Splitwise groups.”
- “Show balances with my Splitwise friends.”
- “List the latest five expenses in group 123.”
- “Get full details for expense 456.”
- “Create a $24 USD dinner expense in group 123, split equally.”
Production notes
The runnable server stores no OAuth session state. Before a larger multi-user deployment:
- Keep
SESSION_SECRETstable, secret, and identical across replicas. For stronger key management, derive or retrieve the encryption key from a managed KMS; never log tokens or secrets. - Stateless authorization codes cannot be marked consumed without storage. PKCE, exact client/redirect/resource binding, authenticated encryption, and the five-minute lifetime limit replay exposure. If strict single-use enforcement is required, add a short-lived shared replay cache keyed by a code identifier.
- Restrict dynamic-registration redirect URIs to the exact ChatGPT callback URLs shown by the app management page (plus explicitly configured development callbacks).
- Add rate limiting, structured security logs, secret rotation, a privacy policy, and token revocation/account unlinking.
- The service emits privacy-safe structured request and tool telemetry (request ID, tool name, duration, status) without OAuth tokens, arguments, or Splitwise response data.
- Preserve the
resourcebinding, PKCE verification, short code lifetime, and exact redirect-URI matching. - Run behind HTTPS. Do not expose this development server directly to the internet.
The create_expense tool is marked as a non-idempotent write. Its instructions tell the model to summarize the exact amount, currency, group, payer, and shares before calling it. Splitwise can return HTTP 200 with an application-level errors object, so the connector checks that object before reporting success.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。