FreeAgent MCP #
A read-only, single-company FreeAgent MCP server, written in TypeScript and run with Nub. It uses stdio so Hermes can run it on the agent's own server.
It exposes typed tools for invoices, expenses, supplier bills, banking, accounting reports, contacts, projects, tax and payroll, plus explicit document retrieval. This is broad API coverage, not complete FreeAgent UI parity. See the tool catalogue.
Setup #
Requires Node 24.21.0 and Nub 0.9.7 (mise.toml pins both).
mise install
nub install --frozen-lockfile
cp .env.example .env
chmod 600 .env
Edit .env with your registered FreeAgent OAuth application's credentials and exact redirect URI. Set an absolute credential path on the agent server. Then, in an interactive terminal:
nub run auth -- login
nub run auth -- status
Open the printed authorization URL in your browser. After approval, paste the full redirected URL into the hidden terminal prompt. No callback listener is started. See authentication before registering the redirect URI.
Copy and adapt examples/hermes.yaml into your Hermes configuration. Use absolute paths and explicitly supply its environment; do not depend on the agent's working directory. Start a new Hermes session after configuration.
For a manual stdio process:
nub run serve
Stdout is reserved for MCP. Human diagnostics go to stderr.
Behavior #
- Only registered read operations can reach FreeAgent. No generic HTTP tool or write tool is exposed; OAuth exchanges are the only POST requests. Read-only annotations describe this enforced policy.
- OAuth tokens are bound to one company and environment, stored privately and refreshed under a cross-process lock.
- List results contain one page. Follow
pagination; a full page without continuation evidence explicitly reports unknown completeness. - Monetary values remain decimal strings. Use FreeAgent's reports for totals; do not add expense claims, bills and bank transactions together as though they were independent spending.
- Attachment download links require explicit opt-in. PDFs use MCP resources; binary inspection depends on the client.
Configuration · Tool conventions · Coverage · Evaluation
Development and verification #
nub run test
nub run typecheck
The tests use synthetic FreeAgent responses, real MCP SDK transports and separate Nub processes. They do not contact your account. Actual Hermes conversations and live OAuth/API reads have not been verified in this environment. A clean dependency installation also remains unverified: shell DNS was unavailable, so tests used locally available packages at the pinned versions. The lockfile contains registry URLs and integrity hashes, not those local paths.