toshl-mcp-server
The server lets AI agents access and manage Toshl Finance data, query financial records, and run spending, budget, and balance analyses.
Read accounts, categories, tags, budgets, user profile/summary, payment types, payments, and budget history.
Create categories and tags; create, update, delete, and bulk-manage entries.
Convert entries into transfers between accounts.
List/filter entries by date, tags, accounts, categories, type, or search; get entry details, daily sums, and timelines.
Run analyses for spending by category, budget adherence/performance, and account balances.
Integrate through MCP over stdio or Streamable HTTP, with token auth, OAuth/sign-in options, and Docker deployment support.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@toshl-mcp-server show my current budget status for this month"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Toshl MCP Server
An MCP (Model Context Protocol) server for integrating Toshl Finance with AI agents.
Overview
The Toshl MCP Server provides a bridge between AI agents and the Toshl Finance API. It allows AI agents to access financial data from Toshl, analyze it, and provide insights and advice based on the data.
Related MCP server: Actual Budget MCP Server
Features
READ access to Toshl Finance API endpoints:
Accounts
Categories
Tags
Budgets
User information
Planning
MCP Resources:
List accounts
Get account details
List categories
Get category details
List tags
Get tag details
Create tag
List budgets
Get budget details
Get budget history
Get user profile
Get account summary
List entries
MCP Tools:
Account tools (list accounts, get account details)
Category tools (list categories, get category details, create category, update category, delete category)
Tag tools (list tags, get tag details, create tag, update tag, delete tag)
Budget tools (list budgets, get budget details, get budget history)
User tools (get profile, get summary, get payment types, get payments)
Entry tools (list entries, get entry details, get entry sums, get entry timeline, create entry, update entry, delete entry, manage entries, split entry, undo split)
Analysis tools (analyze spending by category, analyze budget performance, analyze account balances)
Prerequisites
Node.js (v18.x or higher)
npm (v8.x or higher)
Toshl Finance API token
Get API Token
create new personal token. Insert name for token under "Description" and your account password under "Password"
Installation
Clone the repository:
git clone https://github.com/hktari/toshl-mcp-server.git
cd toshl-mcp-serverInstall dependencies:
npm installCreate a
.envfile based on the.env.examplefile:
cp .env.example .envEdit the
.envfile and add your Toshl API token:
TOSHL_API_TOKEN=your_api_tokenBuilding
Build the project:
npm run buildRunning
Start the server:
npm startConfigure MCP server
The server speaks MCP over stdio. Point your client at dist/index.js and pass
TOSHL_API_TOKEN in its environment — step-by-step instructions for Claude Code,
OpenCode, and Codex CLI are in docs/mcp-clients.md.
For any other client that takes a generic mcpServers config:
{
"mcpServers": {
"toshl": {
"command": "node",
"args": ["/absolute/path/to/toshl-mcp-server/dist/index.js"],
"env": {
"TOSHL_API_TOKEN": "your-token"
}
}
}
}Remote use (Streamable HTTP)
stdio is the default and needs nothing below. To reach the server from clients that can't spawn a local process (web and mobile apps, a server you run elsewhere), switch it to Streamable HTTP:
MCP_TRANSPORT=http MCP_AUTH_TOKEN="$(openssl rand -hex 32)" TOSHL_API_TOKEN=your-token npm startIt serves:
Path | Methods | Checks | Purpose |
|
| Host, Origin, bearer token (static or OAuth) | MCP endpoint, one session per client |
|
| Host | Liveness check. Returns |
| Host | Only when OAuth is on |
Variable | Default | Meaning |
|
|
|
|
| Interface to bind |
|
| Port to bind |
| unset |
|
| unset |
|
| unset | Comma-separated |
| unset | Comma-separated origins ( |
Security
Anyone who can get a request through to /mcp can read and change your Toshl data.
Each layer below closes a different path to it:
Authentication is mandatory. In HTTP mode the server refuses to start without
MCP_AUTH_TOKENor the built-in OAuth server, which is how claude.ai connectors sign in. To use an authenticating proxy in front instead, setMCP_ALLOW_NO_AUTH=true. The server then logs aSECURITY WARNINGat error level on every start. Never expose/mcpwithout authentication, and don't count on an unguessable URL to protect it.TLS and loopback. Keep the default loopback bind and reach the server only through a TLS-terminating reverse proxy. The bearer token travels in a header, so plain HTTP across a network gives it away.
Host check (DNS rebinding). Every request's
Hostmust be loopback or listed inMCP_ALLOWED_HOSTS. That stops a web page you visit from pointing its own name at127.0.0.1and driving a local server. A proxy usually forwards the public name asHost, so list that name.Origin check. As the MCP spec requires,
/mcpvalidatesOrigin. Requests without one are accepted, because native clients, CLIs and server-side connectors don't send it. A presentOrigin, including the opaquenull, must be listed inMCP_ALLOWED_ORIGINSor the request gets403, before authentication is even checked. The list is empty by default, so no browser page can call/mcpunless you allow it.
# Caddyfile: automatic TLS, forwards Host unchanged
example.com {
reverse_proxy 127.0.0.1:3000
}MCP_ALLOWED_HOSTS=example.comSign-in with OAuth
claude.ai connectors (on the web, Desktop, mobile and Cowork) sign in with OAuth rather
than a fixed header. The server has a small OAuth 2.1 authorization server of its own for
that. There is a single user, and approving a client means typing a passphrase you set.
Add https://<your host>/mcp as a custom connector in Claude and leave the OAuth client
on "Use Claude's published identity".
Variable | Meaning |
| Public origin, e.g. |
| Typed on the sign-in page to approve a client. At least 20 characters |
| Signs access tokens and sign-in forms. At least 32 characters ( |
| Optional. A retired key that still verifies, for rotation without signing everyone out |
| Where refresh-token hashes are kept. Must survive restarts ( |
|
|
| A header the proxy in front overwrites with the client address, e.g. |
OAuth turns on when the passphrase and signing key are set. It works alongside
MCP_AUTH_TOKEN, so Claude Code or a script can keep using a static token.
How it behaves:
Clients. Only Claude (callback
https://claude.ai/api/mcp/auth_callback) and Claude Code (loopback callbacks onlocalhostand127.0.0.1, any port, RFC 8252) are accepted. Both are pinned by their published client IDs. The server never fetches the metadata documents, so it still contacts no host but the Toshl API. Dynamic client registration is not offered.PKCE with S256 is required. The
resourceparameter must name this server, and tokens are bound to it.Access tokens last 1 hour. They are signed with
MCP_OAUTH_SIGNING_KEYand not stored anywhere. Changing the key without keeping the old one as_PREVIOUSinvalidates every access token at once.Refresh tokens rotate on every use, expire after 30 days unused and 180 days at most, and are stored only as SHA-256 hashes in
MCP_OAUTH_STATE_DIR/refresh-tokens.json.An already-used refresh token may be retried once within 30 seconds, which covers a client's two concurrent refreshes.
Any other reuse revokes every token from that sign-in.
Deleting the file signs every client out.
Authorization codes work once. A failed exchange burns the code. A replayed code revokes the tokens the first exchange issued.
The sign-in page:
five wrong passphrases from one IP (or one IPv6 /64) lock that address out for 15 minutes
twenty from anywhere close sign-in for an hour. Tokens already issued keep working, but this means anyone can delay a new sign-in by an hour.
every failure is delayed by half a second
the form only accepts posts from its own origin, and has no scripts, no external assets and a strict Content Security Policy
Logs record sign-ins, failures, lockouts and token reuse, with the client ID and IP. Passphrases, codes and tokens are never logged.
Sign in with Toshl (one server, many users)
The passphrase mode above serves one person. With a Toshl OAuth app, one hosted server serves
anyone with a Toshl account: they add https://<your host>/mcp as a custom connector in Claude,
click Connect, sign in to Toshl and approve. No personal token, no passphrase.
Register an app at developer.toshl.com/apps with the redirect URI
https://<your host>/oauth/toshl/callbackand the scopes the tools need (user:r,entries:rw,accounts:r,budgets:r,categories:rw,tags:rw). Until Toshl approves the app for other users, only your own account can sign in.Set
TOSHL_OAUTH_CLIENT_IDandTOSHL_OAUTH_CLIENT_SECRETinstead ofMCP_OAUTH_PASSPHRASE, alongsideMCP_PUBLIC_URL,MCP_OAUTH_SIGNING_KEYandMCP_OAUTH_STATE_DIR. LeaveTOSHL_API_TOKENandMCP_AUTH_TOKENunset; the server refuses to start with either.
How it works: Claude's sign-in is handed to Toshl's, and our callback stores the user's Toshl
tokens in <MCP_OAUTH_STATE_DIR>/toshl-tokens.json, encrypted (AES-256-GCM, key derived from
MCP_OAUTH_SIGNING_KEY). Every /mcp request runs as the user its access token names: that
user's Toshl token (refreshed before it expires), that user's cache entries, and only sessions that
user opened. If Toshl revokes the grant, the user's tokens are deleted and Claude asks them to
connect again. Design notes: docs/superpowers/specs/2026-11-13-sign-in-with-toshl-design.md.
Personal-token sign-in (many users, no Toshl OAuth app)
Toshl issues OAuth apps on request only; developer.toshl.com/apps
offers personal tokens. Until an OAuth app exists, set MCP_SIGN_IN=personal-token instead of the
Toshl client variables. The consent page then asks each person to create a personal token in
Toshl and paste it once. The server checks it against Toshl's /me, stores it encrypted under
that user, and everything else works as in Sign in with Toshl: per-user requests, cache and
sessions. Wrong tokens count towards the sign-in lockout. Deleting the token in Toshl disconnects
the user; Claude then asks them to connect again. Each connection is logged with the number of
connected users.
Operator, terms and privacy (hosted instances)
A server that holds other people's financial data should say who runs it. Set MCP_OPERATOR_NAME
(and optionally MCP_OPERATOR_URL, MCP_TERMS_URL, MCP_PRIVACY_URL, all https) and the consent
page shows "Run by …", states that the service is independent of Toshl and Anthropic, and that
connecting means agreeing to the terms of use.
Sessions
Sessions are held in memory. A session with no request for 30 minutes is closed, and the
client opens a new one on its next call. SIGTERM and SIGINT close every session
before exiting.
Docker
The Dockerfile builds an image that starts in HTTP mode, listening on port 3000 as the
unprivileged node user. Inside the container it binds 0.0.0.0 so the published port
can reach it. Publish that port on loopback only, and pass secrets at run time; the image
contains none:
docker build -t toshl-mcp-server .
docker run -d --restart unless-stopped \
-p 127.0.0.1:3000:3000 \
--env-file /path/outside/the/repo/toshl-mcp.env \
toshl-mcp-serverThe env file holds TOSHL_API_TOKEN, MCP_ALLOWED_HOSTS, and either MCP_AUTH_TOKEN or
the OAuth settings. Without any of them the container exits at startup unless
MCP_ALLOW_NO_AUTH=true. Make the file readable only by its owner (chmod 600).
.dockerignore keeps every .env* file out of the build context.
With OAuth on, mount a volume at /app/state (writable by uid 1000) so sign-ins survive
redeploys, e.g. -v /srv/toshl-mcp/state:/app/state.
Development
Run the server in development mode:
npm run devDocumentation
Project Structure
toshl-mcp-server/
├── src/
│ ├── index.ts # Entry point
│ ├── server/ # MCP server implementation
│ │ └── server.ts # Main server class
│ ├── api/ # Toshl API client
│ │ ├── toshl-client.ts # Base API client
│ │ ├── auth.ts # Authentication module
│ │ └── endpoints/ # Endpoint-specific clients
│ │ ├── accounts.ts # Accounts API client
│ │ ├── categories.ts # Categories API client
│ │ ├── tags.ts # Tags API client
│ │ ├── budgets.ts # Budgets API client
│ │ ├── entries.ts # Entries API client
│ │ ├── me.ts # User API client
│ │ └── planning.ts # Planning API client
│ ├── resources/ # MCP resource handlers
│ │ ├── account-resources.ts # Account resources
│ │ ├── category-resources.ts# Category resources
│ │ ├── tag-resources.ts # Tag resources
│ │ ├── budget-resources.ts # Budget resources
│ │ └── user-resources.ts # User resources
│ ├── tools/ # MCP tool handlers
│ │ ├── account-tools.ts # Account tools
│ │ ├── category-tools.ts # Category tools
│ │ ├── tag-tools.ts # Tag tools
│ │ ├── budget-tools.ts # Budget tools
│ │ ├── user-tools.ts # User tools
│ │ └── analysis-tools.ts # Financial analysis tools
│ └── utils/ # Utility functions
│ ├── cache.ts # Caching utilities
│ ├── error-handler.ts # Error handling utilities
│ ├── logger.ts # Logging utilities
│ └── types.ts # TypeScript type definitions
├── dist/ # Compiled JavaScript files
├── .env # Environment variables
├── .env.example # Example environment variables
├── package.json # Project dependencies
├── tsconfig.json # TypeScript configuration
└── README.md # Project documentationConfiguration
The server can be configured using environment variables:
TOSHL_API_TOKEN: Your Toshl API tokenTOSHL_API_BASE_URL: The base URL for the Toshl API (default: https://api.toshl.com)MCP_SERVER_NAME: The name of the MCP server (default: toshl-mcp-server)MCP_SERVER_VERSION: The version of the MCP server (default: 0.1.0)CACHE_TTL: Time to live for cached data in seconds (default: 3600)CACHE_ENABLED: Whether caching is enabled (default: true)LOG_LEVEL: Logging level (default: info)API_TIMEOUT: How long one attempt at a Toshl request may take, in milliseconds (default: 12000)API_RETRIES: Extra attempts for a read that timed out or that Toshl answered 502/503/504 (default: 1). Writes are never repeated: one that Toshl did not answer may still have been applied, so it is reported instead. KeepAPI_TIMEOUT × (API_RETRIES + 1)inside your MCP client's tool timeout.API_RETRY_DELAY_MS: Pause before the first retry, doubled for each further one (default: 500)MCP_TRANSPORT,MCP_HTTP_HOST,MCP_HTTP_PORT,MCP_AUTH_TOKEN,MCP_ALLOW_NO_AUTH,MCP_ALLOWED_HOSTS,MCP_ALLOWED_ORIGINS: see Remote use (Streamable HTTP)
License
MIT
Available Tools
27 toolsaccount_getB
Get details of a specific account in Toshl Finance
Inputs: id (required).
account_listA
List all accounts in Toshl Finance
Inputs: no named parameters.
analyze_account_balanceC
Analyze account balances
Inputs: no named parameters.
analyze_budget_performanceC
Analyze budget adherence
Inputs: no named parameters.
analyze_spending_by_categoryB
Analyze spending patterns by category
Inputs: no named parameters.
budget_getA
Get details of a specific budget in Toshl Finance
Inputs: id (required).
budget_historyB
Get history of a specific budget in Toshl Finance
Inputs: id (required).
budget_listB
List all budgets in Toshl Finance
Inputs: no named parameters.
category_createA
Create a new category in Toshl Finance
Inputs: name (required), type (required).
category_getA
Get details of a specific category in Toshl Finance
Inputs: id (required).
category_listB
List all categories in Toshl Finance
Inputs: no named parameters.
entry_convert_to_transferA
Convert a regular entry to a transfer between accounts in Toshl Finance
Inputs: id (required), destination_account (required), description.
entry_createA
Create a new entry in Toshl Finance. To create a transfer between accounts, include a transaction object with the destination account ID and currency.
Inputs: date (required), amount (required), account (required), category (required), +4 more.
entry_deleteB
Delete an entry in Toshl Finance
Inputs: id (required), deleteMode.
entry_getA
Get details of a specific entry in Toshl Finance
Inputs: id (required).
entry_listC
List entries in Toshl Finance
Inputs: to (required), from (required), tags, type, +3 more.
entry_manageD
Manage entries in bulk in Toshl Finance.
Inputs: with (required), add, set, remove.
entry_sumsC
Get daily sums of entries in Toshl Finance
Inputs: to (required), from (required), currency (required), tags, +4 more.
entry_timelineC
Get timeline of entries in Toshl Finance
Inputs: to (required), from (required), tags, accounts, +1 more.
entry_updateC
Update an existing entry in Toshl Finance
Inputs: id (required), date, desc, tags, +5 more.
tag_createB
Create a new tag in Toshl Finance
Inputs: name (required), type (required), category.
tag_getA
Get details of a specific tag in Toshl Finance
Inputs: id (required).
tag_listA
List all tags in Toshl Finance
Inputs: no named parameters.
user_paymentsB
Get payments from Toshl Finance
Inputs: no named parameters.
user_payment_typesB
Get payment types from Toshl Finance
Inputs: no named parameters.
user_profileB
Get user profile information from Toshl Finance
Inputs: no named parameters.
user_summaryC
Get account summary from Toshl Finance
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 27 tools
Several tools overlap in scope: entry_list, entry_sums, and entry_timeline all query entries in different ways, and entry_manage may subsume create/update/delete operations. user_summary and account_list could be confused. However, most resource-specific tools are distinct.
Most tools use a resource_verb pattern (account_list, entry_get), but analyze_* breaks the pattern with verb_noun, and tools like user_profile, budget_history are noun-only. This mixing is inconsistent but still readable.
27 tools is above the 25 threshold, making the surface feel heavy. Although the finance domain has many resources, the count is excessive and some tools (e.g., entry_manage) could be merged with CRUD operations.
Entries have full CRUD coverage, but accounts, categories, tags, and budgets lack update/delete operations, and accounts have no create at all. This creates significant gaps for full lifecycle management, though read and analysis are well covered.
Maintenance
Related MCP Connectors
Personal finance for AI agents — onboard, import statements, categorize & budget over MCP.
Log, query, and edit expenses, budgets, and accounts in Manilo from any MCP-compatible AI assistant.
Log, query, and edit expenses, budgets, and accounts in Manilo (formerly Ledgy) from any MCP-compatible AI assistant.
Log, query, and edit expenses, budgets, and accounts in Ledgy from any MCP-compatible AI assistant.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to manage personal finances through MCP tools for transaction management, spending analytics, and goal tracking.1-
- AlicenseCqualityBmaintenanceEnables AI assistants and agents to securely query, reconcile, analyze, and manage personal finances in Actual Budget through MCP tools and APIs.87MIT
- FlicenseNot gradedqualityAmaintenanceEnables AI assistants and other MCP clients to access and manage personal finance data, including transactions, budgets, accounts, categories, tags, recurring items, and cryptocurrency. It provides automated financial insights and comprehensive CRUD operations through LunchMoney's API.41 npm-
- AlicenseNot gradedqualityAmaintenanceEnables AI assistants and other MCP clients to access and manage personal finance data through LunchMoney's API, including transactions, budgets, categories, tags, accounts, recurring items, and crypto.41 npmMIT