Fortnox MCP Server
An MCP server for integrating with the Fortnox Swedish accounting system. Enables LLMs to manage invoices, customers, suppliers, orders, accounts, vouchers, and provides business intelligence analytics.
README
Fortnox MCP Server
An MCP (Model Context Protocol) server for integrating with the Fortnox Swedish accounting system. This server enables LLMs to interact with Fortnox for managing invoices, customers, suppliers, orders, accounts, vouchers, and provides business intelligence analytics.
Two Ways to Use
| Mode | Best For | Setup |
|---|---|---|
| Remote Mode | End users | Just add URL, authorize in browser |
| Local Mode | Developers, self-hosted | Configure environment variables |
Quick Start: Remote Mode (Recommended)
The easiest way to use Fortnox MCP - no credentials needed, just authorize in your browser.
Option A: Add to Claude.ai (Web)
- Go to claude.ai
- Navigate to Settings → Integrations → Add Integration
- Enter the URL:
https://fortnox-mcp.vercel.app/mcp - Wait for it to load, then authorize access by clicking connect
Option B: Add to Claude Desktop
Open your Claude Desktop config file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
Add this configuration:
{
"mcpServers": {
"fortnox": {
"url": "https://fortnox-mcp.vercel.app/mcp"
}
}
}
Restart Claude Desktop. When you first ask Claude to do something with Fortnox, a browser window will open for you to authorize access to your Fortnox account. Once authorized, you're all set!
Quick Start: Local Mode (Self-Hosted)
For developers who want to run the server locally or use their own Fortnox app credentials.
1. Get your Fortnox credentials
- Register at Fortnox Developer Portal
- Create an application to get your Client ID and Client Secret
- Complete the OAuth2 flow to get a Refresh Token
2. Add to Claude Desktop
Open your Claude Desktop config file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
Add this configuration:
{
"mcpServers": {
"fortnox": {
"command": "npx",
"args": ["-y", "fortnox-mcp-server"],
"env": {
"FORTNOX_CLIENT_ID": "your-client-id",
"FORTNOX_CLIENT_SECRET": "your-client-secret",
"FORTNOX_REFRESH_TOKEN": "your-refresh-token"
}
}
}
}
3. Restart Claude Desktop
That's it! You can now ask Claude to manage your Fortnox invoices, customers, and more.
Features
Customer Management
fortnox_list_customers- List and search customersfortnox_get_customer- Get customer detailsfortnox_create_customer- Create new customerfortnox_update_customer- Update customerfortnox_delete_customer- Delete customer
Invoice Management
fortnox_list_invoices- List invoices with filteringfortnox_get_invoice- Get invoice details with line itemsfortnox_create_invoice- Create new invoicefortnox_update_invoice- Update draft invoicefortnox_bookkeep_invoice- Bookkeep invoicefortnox_cancel_invoice- Cancel invoicefortnox_credit_invoice- Create credit notefortnox_send_invoice_email- Send invoice by email
Supplier Management
fortnox_list_suppliers- List and search suppliersfortnox_get_supplier- Get supplier detailsfortnox_create_supplier- Create new supplierfortnox_update_supplier- Update supplierfortnox_delete_supplier- Delete supplier
Supplier Invoice Management
fortnox_list_supplier_invoices- List supplier invoices with filteringfortnox_get_supplier_invoice- Get supplier invoice detailsfortnox_approve_supplier_invoice- Approve supplier invoice for paymentfortnox_payables_report- Get accounts payable aging report
Order Management
fortnox_list_orders- List sales orders with filteringfortnox_list_offers- List offers/quotes with filtering
Account Management
fortnox_list_accounts- List chart of accountsfortnox_get_account- Get account detailsfortnox_create_account- Create new accountfortnox_update_account- Update accountfortnox_delete_account- Delete account
Voucher Management
fortnox_list_vouchers- List vouchers (journal entries)fortnox_get_voucher- Get voucher details with rowsfortnox_create_voucher- Create manual voucherfortnox_list_voucher_series- List available voucher seriesfortnox_account_activity- Get activity for a specific accountfortnox_search_vouchers- Search vouchers by description, account, or amount
Company Information
fortnox_get_company_info- Get company detailsfortnox_list_financial_years- List company financial years
Analytics
fortnox_invoice_summary- Get invoice statistics by periodfortnox_top_customers- Get top customers by revenuefortnox_unpaid_report- Get detailed unpaid invoice report
Business Intelligence
fortnox_cash_flow_forecast- Forecast cash flow based on invoices and payablesfortnox_order_pipeline- Analyze sales order pipelinefortnox_sales_funnel- Analyze sales funnel from offers to invoicesfortnox_product_performance- Analyze product/article performancefortnox_period_comparison- Compare financial metrics across periodsfortnox_customer_growth- Analyze customer acquisition and growthfortnox_project_profitability- Analyze project profitability (if using projects)fortnox_cost_center_analysis- Analyze costs by cost centerfortnox_expense_analysis- Analyze expenses by categoryfortnox_yearly_comparison- Compare year-over-year performancefortnox_gross_margin_trend- Track gross margin trends over time
Installation
Via npx (Recommended)
No installation needed! Just add the config above to Claude Desktop.
Manual Installation
npm install -g fortnox-mcp-server
From Source
git clone https://github.com/jakobwennberg/fortnox-mcp.git
cd fortnox-mcp
npm install
npm run build
Configuration
Environment Variables
Local Mode (default)
| Variable | Required | Description |
|---|---|---|
FORTNOX_CLIENT_ID |
Yes | Your Fortnox app client ID |
FORTNOX_CLIENT_SECRET |
Yes | Your Fortnox app client secret |
FORTNOX_REFRESH_TOKEN |
Yes | OAuth2 refresh token (only needed for initial setup; automatically persisted after first use) |
FORTNOX_ACCESS_TOKEN |
No | Current access token (auto-refreshed) |
TRANSPORT |
No | stdio (default) or http |
PORT |
No | HTTP port (default: 3000) |
Remote Mode (AUTH_MODE=remote)
| Variable | Required | Description |
|---|---|---|
AUTH_MODE |
Yes | Set to remote |
SERVER_URL |
Yes | Public URL of your server |
JWT_SECRET |
Yes | Secret for signing JWT tokens |
FORTNOX_CLIENT_ID |
Yes | Your Fortnox app client ID |
FORTNOX_CLIENT_SECRET |
Yes | Your Fortnox app client secret |
UPSTASH_REDIS_REST_URL |
Yes* | Upstash Redis URL for token storage |
UPSTASH_REDIS_REST_TOKEN |
Yes* | Upstash Redis token |
PORT |
No | HTTP port (default: 3000) |
*Falls back to in-memory storage if not provided (not recommended for production)
Getting OAuth Credentials
- Register as a developer at Fortnox Developer Portal
- Create a new application to get Client ID and Client Secret
- Complete the OAuth2 authorization flow to obtain a refresh token
- Set the environment variables
Usage
With Claude Desktop
See Quick Start above.
As HTTP Server
TRANSPORT=http PORT=3000 node dist/index.js
Then connect to http://localhost:3000/mcp
Tool Examples
List Unpaid Invoices
{
"tool": "fortnox_list_invoices",
"arguments": {
"filter": "unpaid",
"limit": 20
}
}
Create Invoice
{
"tool": "fortnox_create_invoice",
"arguments": {
"customer_number": "1001",
"rows": [
{
"description": "Consulting services",
"quantity": 10,
"price": 1000
}
]
}
}
Create Voucher
{
"tool": "fortnox_create_voucher",
"arguments": {
"voucher_series": "A",
"description": "Office supplies",
"transaction_date": "2025-01-24",
"rows": [
{ "account_number": 6110, "debit": 500 },
{ "account_number": 1910, "credit": 500 }
]
}
}
Rate Limiting
The Fortnox API allows 25 requests per 5 seconds. This server includes automatic rate limiting to prevent exceeding this limit.
Development
# Run in development mode with auto-reload
npm run dev
# Build for production
npm run build
# Clean build artifacts
npm run clean
Publishing & Distribution
This server is published to multiple registries for easy installation:
| Registry | URL | Purpose |
|---|---|---|
| npm | npmjs.com/package/fortnox-mcp-server | Package distribution via npx |
| MCP Registry | registry.modelcontextprotocol.io | Official MCP server discovery |
| GitHub | github.com/jakobwennberg/fortnox-mcp | Source code |
How It Works
- User adds config to Claude Desktop with
npx fortnox-mcp-server - Claude Desktop starts the server via npx (downloads latest version from npm)
- Server authenticates with Fortnox using OAuth2 credentials from environment variables
- Claude can now use tools like
fortnox_list_invoices,fortnox_create_customer, etc. - Server handles API calls to Fortnox, including automatic token refresh and rate limiting
Token Persistence (Local Mode)
Fortnox refresh tokens are single-use — each token refresh returns a new one. The server automatically persists the latest refresh token to ~/.fortnox-mcp/tokens.json so it survives process restarts without requiring manual config updates.
- On first run, the server reads
FORTNOX_REFRESH_TOKENfrom your environment/config - After each token refresh, the new refresh token is saved to
~/.fortnox-mcp/tokens.json - On subsequent restarts, the server uses the persisted token (which is always the latest)
- If the persisted file is missing or corrupt, the server falls back to the environment variable
The token file is created with restricted permissions (0600) for security.
Releasing New Versions
To release a new version, use the release script:
# Bug fixes (1.0.0 → 1.0.1)
npm run release:patch
# New features (1.0.0 → 1.1.0)
npm run release:minor
# Breaking changes (1.0.0 → 2.0.0)
npm run release:major
The release script automatically:
- Bumps the version in
package.json - Updates
server.jsonfor the MCP Registry - Builds the project
- Commits and tags the release
- Publishes to npm
- Publishes to MCP Registry
- Pushes to GitHub
Prerequisites for releasing:
npm login- Logged into npmmcp-publisher login github- Logged into MCP Registry- Clean git working directory
Users Get Updates Automatically
When you publish a new version, users running npx -y fortnox-mcp-server will automatically get the latest version the next time they restart Claude Desktop.
Deploying Your Own Remote Server
Want to host your own instance of the Fortnox MCP server? Follow these instructions.
Deploy to Vercel
1. Prerequisites
- A Vercel account
- An Upstash Redis database (for token storage)
- A Fortnox Developer account with an app created
2. Set Environment Variables
In your Vercel project settings, add these environment variables:
| Variable | Description |
|---|---|
AUTH_MODE |
Set to remote |
SERVER_URL |
Your Vercel deployment URL (e.g., https://your-app.vercel.app) |
JWT_SECRET |
A random secret string for signing tokens (generate with openssl rand -hex 32) |
FORTNOX_CLIENT_ID |
Your Fortnox app client ID |
FORTNOX_CLIENT_SECRET |
Your Fortnox app client secret |
UPSTASH_REDIS_REST_URL |
Upstash Redis REST URL |
UPSTASH_REDIS_REST_TOKEN |
Upstash Redis REST token |
3. Configure Fortnox OAuth Callback
In your Fortnox app settings, add this redirect URI:
https://your-app.vercel.app/oauth/fortnox/callback
4. Deploy
vercel --prod
Server Endpoints
| Endpoint | Description |
|---|---|
GET /health |
Health check |
GET /.well-known/oauth-authorization-server |
OAuth metadata |
POST /authorize |
Start OAuth flow |
POST /token |
Exchange code for tokens |
GET /oauth/fortnox/callback |
Fortnox OAuth callback |
POST /mcp |
Protected MCP endpoint |
Architecture
┌─────────────────────────────────────────────────────────────┐
│ fortnox-mcp-server │
├─────────────────────────────────────────────────────────────┤
│ Mode: AUTH_MODE=local | remote │
├─────────────────────────────────────────────────────────────┤
│ │
│ LOCAL MODE REMOTE MODE │
│ ─────────── ─────────── │
│ • Env var tokens • OAuth flow │
│ • Single user • Multi-user │
│ • stdio or HTTP • HTTP only │
│ • Auto-persisted tokens • Token storage (Redis) │
│ (~/.fortnox-mcp/) │
│ │
└─────────────────────────────────────────────────────────────┘
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。