Fortnox

io.github.jakobwennberg由 GitHub 帳號 jakobwennberg 發布v1.0.0更新於 Oct 24, 2026

MCP server for Fortnox Swedish accounting API integration

概覽

AI 產生的概覽

將助理連接到瑞典 Fortnox 會計系統,可管理客戶、發票、供應商、科目與傳票,並進行財務分析。

可以做什麼
  • 列出、檢視、新增、更新與刪除客戶、供應商及會計科目
  • 列出、檢視、新增與更新發票,並可過帳、作廢、開立貸項通知單及以電子郵件寄送
  • 列出供應商發票、核准付款並取得應付帳款帳齡報告
  • 列出銷售訂單與報價,讀取公司資訊與財務年度
  • 列出、檢視、新增與搜尋傳票及傳票系列,檢視科目活動
  • 執行分析與商業智慧:發票統計、主要客戶、未付款報告、現金流預測、銷售漏斗、毛利率趨勢與期間比較
適用情境
適合需要操作瑞典公司 Fortnox 帳務的情境:草擬與寄送發票、維護客戶與供應商資料,或依據即時會計資料產出營收、現金流與毛利分析。
執行需求
以 npm 套件透過 npx 在本機執行,或自行架設 HTTP 伺服器。本機模式需要來自 Fortnox 開發者應用程式及 OAuth2 流程的 FORTNOX_CLIENT_ID、FORTNOX_CLIENT_SECRET 與 FORTNOX_REFRESH_TOKEN。自行架設遠端模式另需 AUTH_MODE、SERVER_URL、JWT_SECRET,並可選用 Upstash Redis 設定。需要可存取 Fortnox API 的網路。
安裝前請注意
FORTNOX_CLIENT_ID、FORTNOX_CLIENT_SECRET 與 FORTNOX_REFRESH_TOKEN 可存取公司會計資料。許多工具會寫入:新增、更新與刪除客戶、供應商及科目,過帳、作廢、開立貸項通知單與寄送發票,核准供應商發票以及新增傳票。更新權杖為一次性使用,並會儲存到本機權杖檔案。README 亦說明了在瀏覽器中授權的託管遠端端點。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Fortnox,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

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

ModeBest ForSetup
Remote ModeEnd usersJust add URL, authorize in browser
Local ModeDevelopers, self-hostedConfigure 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)

  1. Go to claude.ai
  2. Navigate to Settings → Integrations → Add Integration
  3. Enter the URL: https://fortnox-mcp.vercel.app/mcp
  4. 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:

json
{  "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

  1. Register at Fortnox Developer Portal
  2. Create an application to get your Client ID and Client Secret
  3. 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:

json
{  "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 customers
  • fortnox_get_customer - Get customer details
  • fortnox_create_customer - Create new customer
  • fortnox_update_customer - Update customer
  • fortnox_delete_customer - Delete customer

Invoice Management

  • fortnox_list_invoices - List invoices with filtering
  • fortnox_get_invoice - Get invoice details with line items
  • fortnox_create_invoice - Create new invoice
  • fortnox_update_invoice - Update draft invoice
  • fortnox_bookkeep_invoice - Bookkeep invoice
  • fortnox_cancel_invoice - Cancel invoice
  • fortnox_credit_invoice - Create credit note
  • fortnox_send_invoice_email - Send invoice by email

Supplier Management

  • fortnox_list_suppliers - List and search suppliers
  • fortnox_get_supplier - Get supplier details
  • fortnox_create_supplier - Create new supplier
  • fortnox_update_supplier - Update supplier
  • fortnox_delete_supplier - Delete supplier

Supplier Invoice Management

  • fortnox_list_supplier_invoices - List supplier invoices with filtering
  • fortnox_get_supplier_invoice - Get supplier invoice details
  • fortnox_approve_supplier_invoice - Approve supplier invoice for payment
  • fortnox_payables_report - Get accounts payable aging report

Order Management

  • fortnox_list_orders - List sales orders with filtering
  • fortnox_list_offers - List offers/quotes with filtering

Account Management

  • fortnox_list_accounts - List chart of accounts
  • fortnox_get_account - Get account details
  • fortnox_create_account - Create new account
  • fortnox_update_account - Update account
  • fortnox_delete_account - Delete account

Voucher Management

  • fortnox_list_vouchers - List vouchers (journal entries)
  • fortnox_get_voucher - Get voucher details with rows
  • fortnox_create_voucher - Create manual voucher
  • fortnox_list_voucher_series - List available voucher series
  • fortnox_account_activity - Get activity for a specific account
  • fortnox_search_vouchers - Search vouchers by description, account, or amount

Company Information

  • fortnox_get_company_info - Get company details
  • fortnox_list_financial_years - List company financial years

Analytics

  • fortnox_invoice_summary - Get invoice statistics by period
  • fortnox_top_customers - Get top customers by revenue
  • fortnox_unpaid_report - Get detailed unpaid invoice report

Business Intelligence

  • fortnox_cash_flow_forecast - Forecast cash flow based on invoices and payables
  • fortnox_order_pipeline - Analyze sales order pipeline
  • fortnox_sales_funnel - Analyze sales funnel from offers to invoices
  • fortnox_product_performance - Analyze product/article performance
  • fortnox_period_comparison - Compare financial metrics across periods
  • fortnox_customer_growth - Analyze customer acquisition and growth
  • fortnox_project_profitability - Analyze project profitability (if using projects)
  • fortnox_cost_center_analysis - Analyze costs by cost center
  • fortnox_expense_analysis - Analyze expenses by category
  • fortnox_yearly_comparison - Compare year-over-year performance
  • fortnox_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

bash
npm install -g fortnox-mcp-server

From Source

bash
git clone https://github.com/jakobwennberg/fortnox-mcp.gitcd fortnox-mcpnpm installnpm run build

Configuration

Environment Variables

Local Mode (default)
VariableRequiredDescription
FORTNOX_CLIENT_IDYesYour Fortnox app client ID
FORTNOX_CLIENT_SECRETYesYour Fortnox app client secret
FORTNOX_REFRESH_TOKENYesOAuth2 refresh token (only needed for initial setup; automatically persisted after first use)
FORTNOX_ACCESS_TOKENNoCurrent access token (auto-refreshed)
TRANSPORTNostdio (default) or http
PORTNoHTTP port (default: 3000)
Remote Mode (AUTH_MODE=remote)
VariableRequiredDescription
AUTH_MODEYesSet to remote
SERVER_URLYesPublic URL of your server
JWT_SECRETYesSecret for signing JWT tokens
FORTNOX_CLIENT_IDYesYour Fortnox app client ID
FORTNOX_CLIENT_SECRETYesYour Fortnox app client secret
UPSTASH_REDIS_REST_URLYes*Upstash Redis URL for token storage
UPSTASH_REDIS_REST_TOKENYes*Upstash Redis token
PORTNoHTTP port (default: 3000)

*Falls back to in-memory storage if not provided (not recommended for production)

Getting OAuth Credentials

  1. Register as a developer at Fortnox Developer Portal
  2. Create a new application to get Client ID and Client Secret
  3. Complete the OAuth2 authorization flow to obtain a refresh token
  4. Set the environment variables

Usage

With Claude Desktop

See Quick Start above.

As HTTP Server

bash
TRANSPORT=http PORT=3000 node dist/index.js

Then connect to http://localhost:3000/mcp

Tool Examples

List Unpaid Invoices

json
{  "tool": "fortnox_list_invoices",  "arguments": {    "filter": "unpaid",    "limit": 20  }}

Create Invoice

json
{  "tool": "fortnox_create_invoice",  "arguments": {    "customer_number": "1001",    "rows": [      {        "description": "Consulting services",        "quantity": 10,        "price": 1000      }    ]  }}

Create Voucher

json
{  "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

bash
# Run in development mode with auto-reloadnpm run dev
# Build for productionnpm run build
# Clean build artifactsnpm run clean

Publishing & Distribution

This server is published to multiple registries for easy installation:

RegistryURLPurpose
npmnpmjs.com/package/fortnox-mcp-serverPackage distribution via npx
MCP Registryregistry.modelcontextprotocol.ioOfficial MCP server discovery
GitHubgithub.com/jakobwennberg/fortnox-mcpSource code

How It Works

  1. User adds config to Claude Desktop with npx fortnox-mcp-server
  2. Claude Desktop starts the server via npx (downloads latest version from npm)
  3. Server authenticates with Fortnox using OAuth2 credentials from environment variables
  4. Claude can now use tools like fortnox_list_invoices, fortnox_create_customer, etc.
  5. 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_TOKEN from 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:

bash
# 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:

  1. Bumps the version in package.json
  2. Updates server.json for the MCP Registry
  3. Builds the project
  4. Commits and tags the release
  5. Publishes to npm
  6. Publishes to MCP Registry
  7. Pushes to GitHub

Prerequisites for releasing:

  • npm login - Logged into npm
  • mcp-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

[Deploy with Vercel]

1. Prerequisites
2. Set Environment Variables

In your Vercel project settings, add these environment variables:

VariableDescription
AUTH_MODESet to remote
SERVER_URLYour Vercel deployment URL (e.g., https://your-app.vercel.app)
JWT_SECRETA random secret string for signing tokens (generate with openssl rand -hex 32)
FORTNOX_CLIENT_IDYour Fortnox app client ID
FORTNOX_CLIENT_SECRETYour Fortnox app client secret
UPSTASH_REDIS_REST_URLUpstash Redis REST URL
UPSTASH_REDIS_REST_TOKENUpstash 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
bash
vercel --prod

Server Endpoints

EndpointDescription
GET /healthHealth check
GET /.well-known/oauth-authorization-serverOAuth metadata
POST /authorizeStart OAuth flow
POST /tokenExchange code for tokens
GET /oauth/fortnox/callbackFortnox OAuth callback
POST /mcpProtected 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

來源:README.md,提交 501ee13

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v1.0.0最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分