Skip to content

MCP (Model Context Protocol)

Model Context Protocol (MCP) is an open protocol developed by Anthropic that enables AI models to securely connect to external data sources and tools. It provides a standardized way for AI tools to access information and perform actions while maintaining security and user control.

With the MCP protocol, you can use your preferred AI tools to add transactions (e.g. create transactions using natural language or import multiple transactions from different formats), query transaction data (e.g. use your AI tools to analyze historical transaction records), and more.

Note: When using a third-party large language model service, be cautious with the MCP feature, because your private data may be sent to the third-party provider.

Configuration

By default, ezBookkeeping does not enable the MCP server. You can enable it by updating the enable_mcp setting in the configuration file or by setting the environment variable. For details, see the Configuration. After enabled, the "Generate Token" button will appear on "User Settings" -> "Security" page in the desktop version.

Integration with AI Tools

The MCP service of ezBookkeeping requires a special token to access. You can go to "User Settings" -> "Security" and click the "Generate Token" button in desktop version, and then enter your password. Alternatively, you can generate the token by the user-session-new command in ezBookkeeping's CLI, for more details, see the Command Line.

If the IP address used to access the MCP server is fixed (e.g., within a home network), you can restrict specific IP addresses that can access the MCP server. For details, see the Configuration.

Then, copy the following code into your AI tool's MCP server configuration to enable it to access and interact with ezBookkeeping data.

json
{
    "mcpServers": {
        "ezbookkeeping-mcp": {
            "type": "streamable-http",
            "url": "http://{domain}/mcp",
            "headers": {
                "Authorization": "Bearer {token}"
            }
        }
    }
}

Supported MCP Tool

Add transaction

MCP Tool Name

add_transaction

Request Parameters

FieldTypeRequiredDescription
typestringRequiredTransaction type (income, expense, transfer)
timestringRequiredTransaction time in RFC 3339 format (e.g. 2023-01-01T12:00:00Z)
category_namestringRequiredSecondary category name for the transaction
account_namestringRequiredAccount name for the transaction
amountstringRequiredTransaction amount
destination_account_namestringOptionalDestination account name for transfer transactions
destination_amountstringOptionalDestination amount for transfer transactions
tagsstring[]OptionalList of tags associated with the transaction (maximum 10 tags allowed)
commentstringOptionalTransaction description
dry_runbooleanOptionalIf true, the transaction will not be saved, only validated

Query transactions

MCP Tool Name

query_transactions

Request Parameters

FieldTypeRequiredDescription
start_timestringRequiredStart time for the query in RFC 3339 format (e.g. 2023-01-01T12:00:00Z)
end_timestringRequiredEnd time for the query in RFC 3339 format or (e.g. 2023-01-01T12:00:00Z)
typestringOptionalTransaction type to filter by (income, expense, transfer)
category_namestringOptionalPrimary or secondary category name to filter transactions by
account_namestringOptionalAccount name to filter transactions by
commentstringOptionalKeyword to search in transaction description
countnumberOptionalMaximum number of results to return (default: 100)
pagenumberOptionalPage number for pagination (default: 1)
response_fieldsstringOptionalComma-separated list of fields to include in the response (leave empty for all fields, available fields: time, currency, category_name, account_name, comment)

Query all account names

MCP Tool Name

query_all_accounts

Request Parameters

None

Query all account balances

MCP Tool Name

query_all_accounts_balance

Request Parameters

None

Query all transaction category names

MCP Tool Name

query_all_transaction_categories

Request Parameters

None

Query all transaction tag names

MCP Tool Name

query_all_transaction_tags

Request Parameters

None

Query latest exchange rates

MCP Tool Name

query_latest_exchange_rates

Request Parameters

FieldTypeRequiredDescription
currenciesstringRequiredComma-separated list of currencies to query exchange rates for (e.g. USD,CNY,EUR)

Released under the MIT License.