Dolibarr MCP Server

Dolibarr MCP Server

Provides structured access to Dolibarr ERP/CRM API endpoints via the Model Context Protocol, supporting CRUD operations on resources like thirdparties, products, and orders.

Category
访问服务器

README

Dolibarr MCP Server

CI Release License: MIT Docker npm

A compliant Model Context Protocol (MCP) server that provides structured access to Dolibarr ERP/CRM API endpoints. Built with Nitro and implementing the JSON-RPC 2.0 specification.

Features

  • ✅ MCP Compliant: Full implementation of the Model Context Protocol specification
  • 🔧 Complete CRUD Operations: GET, POST, PUT, DELETE support for all Dolibarr endpoints
  • 🚀 Production Ready: Built with Nitro for optimal performance and deployment flexibility
  • 🔒 Secure: Environment-based configuration with API key authentication
  • 📦 Easy Integration: Compatible with n8n, Claude, and other MCP clients
  • 🌍 Multi-runtime: Supports Node.js, Bun, and Deno

Quick Start

Prerequisites

  • Node.js 18+
  • pnpm 9.0+
  • Dolibarr instance with REST API enabled
  • Valid Dolibarr API key

Installation

# Clone the repository
git clone https://github.com/ivanmartin33/dolibarr-mcp-server.git
cd dolibarr-mcp-server

# Install dependencies
pnpm install

# Copy environment file
cp .env.example .env
# Edit .env with your Dolibarr configuration

# Start development server
pnpm run dev

Environment Setup

Create a .env file in your project root:

DOLI_URL=https://your-dolibarr-instance.com/api/index.php
DOLI_KEY=your-dolibarr-api-key

Running the Server

# Development
pnpm run dev

# Production build
pnpm run build

# Start production server
pnpm run start

The server will be available at http://localhost:3000

MCP Tools Available

The server exposes four main tools for interacting with Dolibarr:

1. dolibarr_get

Fetch data from Dolibarr API using GET method.

{
  "name": "dolibarr_get",
  "arguments": {
    "endpoint": "thirdparties",
    "id": "1",
    "params": {
      "limit": "10"
    }
  }
}

2. dolibarr_post

Create new data in Dolibarr API using POST method.

{
  "name": "dolibarr_post",
  "arguments": {
    "endpoint": "thirdparties",
    "data": {
      "name": "New Company",
      "client": 1
    }
  }
}

3. dolibarr_put

Update existing data in Dolibarr API using PUT method.

{
  "name": "dolibarr_put",
  "arguments": {
    "endpoint": "thirdparties",
    "id": "1",
    "data": {
      "name": "Updated Company Name"
    }
  }
}

4. dolibarr_delete

Delete data from Dolibarr API using DELETE method.

{
  "name": "dolibarr_delete",
  "arguments": {
    "endpoint": "thirdparties",
    "id": "1"
  }
}

API Endpoints

Main MCP Endpoint

  • POST /mcp - Main JSON-RPC 2.0 endpoint for MCP communication

Additional Endpoints

  • GET /mcp/describe - Server information and tool descriptions
  • POST /mcp/tools/call - Direct tool execution endpoint
  • GET / - Landing page with server information

MCP Protocol Examples

Initialize Connection

curl -X POST http://localhost:3000/mcp \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "initialize",
    "params": {},
    "id": 1
  }'

List Available Tools

curl -X POST http://localhost:3000/mcp \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "tools/list",
    "params": {},
    "id": 2
  }'

Execute a Tool

curl -X POST http://localhost:3000/mcp \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "tools/call",
    "params": {
      "name": "dolibarr_get",
      "arguments": {
        "endpoint": "users"
      }
    },
    "id": 3
  }'

Integration with n8n

The Dolibarr MCP Server can be easily integrated with n8n for workflow automation:

Connection URLs

  • n8n in Docker: http://host.docker.internal:3000/mcp
  • Local n8n: http://localhost:3000/mcp

Starting Server for Docker Access

NITRO_HOST=0.0.0.0 NITRO_PORT=3000 pnpm run dev

HTTP Request Node Configuration

In your n8n workflow, add an HTTP Request node:

  • Method: POST
  • URL: http://host.docker.internal:3000/mcp (for Docker) or http://localhost:3000/mcp (local)
  • Headers:
    {
      "Content-Type": "application/json"
    }
    
  • Body:
    {
      "jsonrpc": "2.0",
      "method": "tools/call",
      "params": {
        "name": "dolibarr_get",
        "arguments": {
          "endpoint": "{{ $json.endpoint }}",
          "id": "{{ $json.id }}"
        }
      },
      "id": "{{ $runIndex }}"
    }
    

Dolibarr Configuration

API Setup in Dolibarr

  1. Enable REST API Module:

    • Go to Home > Setup > Modules/Applications
    • Activate "Web services REST API"
  2. Create API User:

    • Go to Users & Groups
    • Create a new user or select existing
    • Generate API key in user profile
  3. Set Permissions:

    • Assign appropriate permissions to the API user
    • Recommended: Create dedicated API user with minimal required rights

Common Dolibarr Endpoints

  • users - User management
  • thirdparties - Companies/customers
  • products - Product catalog
  • orders - Sales orders
  • invoices - Customer invoices
  • proposals - Commercial proposals
  • contracts - Contracts
  • projects - Project management

Production Deployment

Environment Variables

Variable Description Default
NITRO_DOLI_URL Dolibarr API base URL http://localhost/api/index.php
NITRO_DOLI_KEY Dolibarr API key super_api_key
NITRO_HOST Server host localhost
NITRO_PORT Server port 3000

Docker

FROM node:18-alpine

# Enable corepack for pnpm
RUN corepack enable

WORKDIR /app
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile --prod

COPY . .
RUN pnpm run build

ENV NITRO_HOST=0.0.0.0
ENV NITRO_PORT=3000

EXPOSE 3000
CMD ["node", ".output/server/index.mjs"]

Docker Compose

version: '3.8'
services:
  dolibarr-mcp:
    build: .
    ports:
      - "3000:3000"
    environment:
      - DOLI_URL=http://host.docker.internal:4000/api/index.php
      - DOLI_KEY=your-api-key
      - NITRO_HOST=0.0.0.0
      - NITRO_PORT=3000
    restart: unless-stopped

License

This project is licensed under the MIT License - see the LICENSE file for details.

Links

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选