https://api.ai2fin.com/mcp uses OAuth 2.1 for every assistant and connector. A second endpoint, /mcp/inspector, accepts API keys for MCP Inspector, scripts and testing.
OAuth for assistants
Nothing to configure. A client that supports MCP over Streamable HTTP discovers everything it needs:- The client calls
/mcpwithout a token and receives401with aWWW-Authenticateheader pointing at the protected-resource metadata:https://api.ai2fin.com/.well-known/oauth-protected-resource/mcp. - From there it reads the authorization-server metadata:
https://api.ai2fin.com/mcp/.well-known/oauth-authorization-server(also at/.well-known/openid-configuration). - It registers itself, either by Dynamic Client Registration (
POST https://api.ai2fin.com/api/oauth/register, RFC 7591) or by presenting a Client ID Metadata Document (itsclient_idis an HTTPS URL that serves its own metadata). - It sends the user to
https://api.ai2fin.com/api/oauth/authorizewith PKCE (S256, required) and an exact-match redirect URI. - The user signs in to 2Fin and sees the consent screen: the client’s name, the redirect address, and every scope requested by name. They choose Allow, Allow read-only access, or Deny.
- The client exchanges the code at
https://api.ai2fin.com/api/oauth/tokenand receives an access token plus a refresh token. Tokens are bound to the user, the client and the granted scopes.
The consent screen is shown for every third-party client, every time a new grant is made. There is no way for a client to skip it.
Scopes and what they unlock
- A client that registers without naming scopes is registered for
read:transactions write:transactions read:bills write:bills— the ceiling it may ask for. The user still decides per grant on the consent screen. - A client that names scopes at registration can never be granted more than those (an explicit read-only registration stays read-only).
- A token without a write scope gets
insufficient_scopeon every write tool and can never change data.
Read-only access
When a client asks for both read and write scopes, the consent screen offers Allow read-only access next to Allow. Choosing it issues a token with only the read scopes. The assistant can then answer questions about your finances but every attempt to change something is refused withinsufficient_scope, and nothing is written. You can connect again later with full access if you want it.
Confirmation before changes
For clients that have not told 2Fin they confirm writes themselves (Claude, ChatGPT, Cursor and most others), 2Fin adds its own step: the first call to a write tool returnsneedsConfirmation: true with a short-lived confirmToken and a preview of the arguments; the assistant shows you the preview and repeats the call with the token. A token that has expired, been reused or whose arguments changed is refused with confirmation_required.
Meta Muse asks you itself before every write (and every time for sensitive writes), so for Muse the extra step is skipped and the confirmToken parameter is not advertised. The outcome shapes are in the Connector reference.
Refresh and revoke
Access tokens are short-lived; the client refreshes them at the token endpoint withgrant_type=refresh_token. Disconnecting the assistant in its own settings, or revoking at https://api.ai2fin.com/api/oauth/revoke, ends access immediately.
Example: the first request
API keys (MCP Inspector and scripts)
Used by the/mcp/inspector endpoint only.
Create an API key
Generate a key in the 2Fin dashboard. It is shown once.
- Keys start with
mcp_and are stored hashed.Authorization: Bearer mcp_…is accepted too. - Scopes:
mcp:readandmcp:tools:list(list and call read tools),mcp:resources:read, andmcp:tools:callormcp:full(read and write tools). A key created without naming scopes getsmcp:full. For a script that only reads, create the key withmcp:readandmcp:tools:list. - Rotate keys (every 90 days is a good habit) and revoke a key the moment it is no longer needed.
Errors
Privacy
Every request is resolved to one account and returns only that account’s data, including transactions from bank accounts you have connected. Before a result leaves the server, emails, card numbers, bank account and BSB numbers, phone numbers and tax file numbers are stripped. Tokens, keys and secrets never appear in tool responses or logs. Details: privacy policy.Next steps
Quickstart
Connect an assistant in minutes
Connector reference
Every tool’s class, inputs, outcomes and limits
