MCP (Model Context Protocol)
Overview
Section titled “Overview”Open Accountant supports Model Context Protocol (MCP) servers, allowing you to extend its capabilities with external tools. MCP is an open standard for connecting AI models to external data sources and tools.
Configuration
Section titled “Configuration”Add MCP servers in ~/.openaccountant/mcp.json:
{ "servers": { "my-server": { "command": "npx", "args": ["-y", "my-mcp-server"], "env": {} } }}Multiple Servers
Section titled “Multiple Servers”{ "servers": { "filesystem": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/dir"], "env": {} }, "web-search": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-brave-search"], "env": { "BRAVE_API_KEY": "your-key" } } }}SSE Transport
Section titled “SSE Transport”For HTTP-based MCP servers, use SSE transport instead of spawning a child process:
{ "servers": { "local-tools": { "command": "npx", "args": ["-y", "my-local-server"] }, "remote-server": { "transport": "sse", "url": "http://localhost:3001/sse" } }}The transport type is auto-detected: if url is set without command, SSE is used. You can also set "transport": "sse" explicitly.
Diagnostics
Section titled “Diagnostics”Verify your MCP connections with --mcp:
wilson --mcpThis connects to all configured servers and lists their names, tool counts, and tool descriptions. Use it to verify servers are reachable before starting interactive mode.
How It Works
Section titled “How It Works”- Startup — Open Accountant reads
~/.openaccountant/mcp.jsonand connects to configured servers (stdio or SSE) - Discovery — Each server advertises its available tools via the MCP protocol
- Registration — Discovered tools are added to Open Accountant’s tool registry alongside built-in tools
- Execution — When the AI decides to use an MCP tool, Open Accountant routes the call to the appropriate server
- Results — Tool results are returned to the AI agent loop like any other tool result
Architecture
Section titled “Architecture”Open Accountant’s MCP implementation consists of three modules:
| Module | File | Role |
|---|---|---|
| Config | src/mcp/config.ts | Reads and validates mcp.json |
| Client | src/mcp/client.ts | Manages MCP server lifecycle and communication |
| Adapter | src/mcp/adapter.ts | Converts MCP tools to Open Accountant’s internal tool format |
Use Cases
Section titled “Use Cases”- Custom data sources — Connect Open Accountant to proprietary APIs or databases
- Specialized calculations — Add domain-specific computation tools
- External services — Integrate with accounting software, banks, or other fintech APIs
- File access — Give Open Accountant read/write access to specific directories
Limitations
Section titled “Limitations”- Stdio servers run as child processes on your local machine
- SSE servers must be reachable over HTTP from the machine running Open Accountant
- Each server must implement the MCP protocol
- Server crashes are isolated — other tools continue to work
- MCP tools are available alongside (not replacing) Open Accountant’s built-in tools