FreeAgent MCP Server

FreeAgent MCP Server

Enables Claude to manage FreeAgent accounting tasks such as listing bank transactions, explaining and approving them with receipts, creating expenses, and logging mileage.

Category
访问服务器

README

FreeAgent MCP Server

A Model Context Protocol server for FreeAgent accounting. Gives Claude (or any MCP client) the ability to list bank transactions, explain/approve them with receipts, create expenses, and log mileage.

What access this server requires

FreeAgent

The FreeAgent OAuth credentials grant full access to the connected FreeAgent account. This server uses that access to:

Action Tools that use it
Read bank accounts freeagent_list_bank_accounts
Read bank transactions and explanations freeagent_list_transactions
Update transaction explanations (category, description, approval, attachments) freeagent_explain_transaction
Create expense claims freeagent_create_expense, freeagent_create_mileage_expense
Read expense categories freeagent_list_categories

FreeAgent does not offer granular OAuth scopes — authorising an app grants access to all of the above. The server does not delete transactions, invoices, contacts, or any other data.

Email and file sources (external — not provided by this server)

This server has no email tools. For receipt/invoice search to work automatically, connect one or more of the following MCP servers alongside this one:

  • Gmail (e.g. mcp__claude_ai_Gmail) — personal email
  • Microsoft 365 / Outlook (e.g. mcp__claude_ai_microsoft-365) — business email

When both are connected, Claude will search all of them automatically for matching receipts before asking you to provide a file manually.


Tools

Tool Description
freeagent_list_bank_accounts List all bank accounts and their IDs
freeagent_list_transactions List transactions (unexplained / explained / all / marked_for_review) with date filters
freeagent_explain_transaction Update, approve or attach a receipt to a transaction explanation
freeagent_list_categories List the FreeAgent chart of accounts (expense categories)
freeagent_create_expense Create an expense claim with optional receipt attachment and bank-transaction auto-matching
freeagent_create_mileage_expense Create a mileage expense using HMRC rates, with optional distance auto-calculation

Prerequisites

FreeAgent OAuth credentials

  1. Log in to FreeAgent → Settings → Developer API.
  2. Create an OAuth application. Set the redirect URI to http://localhost:8080/callback.
  3. Note your Client ID and Client Secret.
  4. Run the bundled auth command to complete the OAuth flow and save a refresh token to .mcp.json automatically:
npx @oxygenbubbles/freeagent-mcp-server auth

The command prompts for your Client ID and Client Secret, opens the FreeAgent authorization page in your browser, listens for the callback, exchanges the code for a long-lived refresh token, and writes everything to .mcp.json in the current directory. If .mcp.json already exists, it updates just the freeagent entry.


Installation

git clone https://github.com/OxygenBubbles/freeagent-mcp-server.git
cd freeagent-mcp-server
npm install
npm run build

Configuration

All settings are read from environment variables.

Required

Variable Description
FREEAGENT_CLIENT_ID OAuth client ID
FREEAGENT_CLIENT_SECRET OAuth client secret
FREEAGENT_REFRESH_TOKEN Long-lived refresh token

Optional

Variable Description
VENDOR_CATEGORIES JSON object extending the built-in vendor → category mapping (see below)
MILEAGE_CATEGORY_URL FreeAgent category URL for mileage expenses (default /v2/categories/311)
MILEAGE_RATE_PENCE Fixed pence-per-mile rate; overrides HMRC logic when set
HMRC_RATE_HIGH_PENCE HMRC high-band rate in pence (default 45)
HMRC_RATE_LOW_PENCE HMRC low-band rate in pence (default 25)
HMRC_THRESHOLD_MILES Miles per tax year before the low band kicks in (default 10000)
ORS_API_KEY OpenRouteService API key for drive-distance lookups
GOOGLE_MAPS_API_KEY Google Maps API key for drive-distance lookups (alternative to ORS)
PORT If set, serves over HTTP on this port instead of stdio
AUTH_TOKEN Bearer token required on every HTTP request. Strongly recommended whenever PORT is set

Built-in vendor → category mappings

The server ships with mappings for common vendors (IONOS, OpenAI, Anthropic, AWS, GitHub, Stripe, Google, Microsoft, Zoom, Notion, Dropbox, Slack, Adobe, Netlify, Vercel, Heroku, DigitalOcean, Cloudflare, Fastmail, Mailchimp). Extend via VENDOR_CATEGORIES:

VENDOR_CATEGORIES='{"ACME CORP":"/v2/categories/285","NETFLIX":"/v2/categories/270"}'

Claude Desktop setup

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "freeagent": {
      "command": "node",
      "args": ["/path/to/freeagent-mcp-server/dist/index.js"],
      "env": {
        "FREEAGENT_CLIENT_ID": "...",
        "FREEAGENT_CLIENT_SECRET": "...",
        "FREEAGENT_REFRESH_TOKEN": "..."
      }
    }
  }
}

Usage examples

List my unexplained Starling transactions for April 2026

Approve explanation 12345678 and attach the base64 receipt

Create an expense for the £22.80 IONOS charge on 3 April — here's the PDF: <base64>

Log 24 miles for a coaching session from Wakefield to Ackworth on 10 April

Mileage rates

When ratePence and MILEAGE_RATE_PENCE are both unset, HMRC approved rates apply automatically:

  • 45p/mile for the first 10,000 business miles in the tax year
  • 25p/mile above 10,000 miles

Pass cumulativeMilesYTD to enable the threshold crossover calculation.

HMRC has adjusted these rates historically. If they change again, override without editing source by setting HMRC_RATE_HIGH_PENCE, HMRC_RATE_LOW_PENCE, and/or HMRC_THRESHOLD_MILES.


Development

npm run dev        # watch mode (tsx)
npm run build      # compile TypeScript → dist/
npm start          # run compiled server
npm test           # run unit tests once
npm run test:watch # watch mode for tests

Claude Code setup

Create .mcp.json in your project directory (or ~/.mcp.json for global access):

{
  "mcpServers": {
    "freeagent": {
      "command": "node",
      "args": ["/path/to/freeagent-mcp-server/dist/index.js"],
      "env": {
        "FREEAGENT_CLIENT_ID": "...",
        "FREEAGENT_CLIENT_SECRET": "...",
        "FREEAGENT_REFRESH_TOKEN": "..."
      }
    }
  }
}

HTTP mode

Set PORT to run as an HTTP server (for webhooks, iPhone Shortcuts, Power Automate):

PORT=3000 AUTH_TOKEN=a-long-random-string node dist/index.js

Always set AUTH_TOKEN when exposing HTTP mode — every request must include Authorization: Bearer <AUTH_TOKEN> or it is rejected with 401. Without AUTH_TOKEN the server starts anyway but prints a warning to stderr and accepts all requests; only do that on a trusted loopback interface.


Security

  • Credentials are environment variables, never in code
  • FreeAgent tokens are cached in memory and refreshed automatically
  • Transactions are never approved without a confirmed receipt or explicit instruction
  • The server never creates new categories — only selects from existing ones
  • .mcp.json is excluded from git via .gitignore

Licence

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选