mcpfreecad

mcpfreecad

An MCP server that drives a running FreeCAD session, exposing document management, modeling, inspection, snapshot, and optional workbench operations to MCP clients over stdio or authenticated remote HTTP.

Category
访问服务器

README

FreeCAD MCP Server mcpfreecad

mcpfreecad is an MCP server for driving a running FreeCAD session. It exposes document management, modeling, inspection, snapshot, and optional workbench operations to MCP clients over stdio or authenticated remote HTTP.

The server is designed around a small Python bridge that is loaded into FreeCAD's embedded interpreter. The MCP process then talks to that bridge over localhost.

Features

  • stdio and API-key authenticated remotehttp transports
  • document lifecycle tools for opening, saving, closing, and enumerating FreeCAD documents
  • explicit model inspection via document tree, topology, sketch status, and sketch details tools
  • modeling support for Part primitives, PartDesign bodies/pads/pockets, spreadsheets, Draft arrays, and snapshots
  • reusable object library backed by BREP plus JSON metadata
  • optional workbench integration for helpers such as freecad.gears, Fasteners, Curves sketch-on-surface workflows, and A2plus assembly operations when available
  • remote snapshot retrieval through authenticated URLs or tokenized snapshot download URLs

For LLM-facing operating guidance, see LLM_USAGE.md.

Further Information

There is an accompanying blog article that describes some of the usage and motivation behind this project.

Obligatory comic drawing

Installation

Install from PyPI:

pip install mcpfreecad

To enable remote HTTP mode:

pip install "mcpfreecad[remote]"

For local development:

git clone <repository-url>
cd mcpFreeCAD
pip install -e .
pip install -e ".[remote]"

Quick Start

  1. Start FreeCAD.
  2. Load the bridge module inside the FreeCAD Python console.
  3. Start mcpfreecad in stdio mode or remotehttp mode.
  4. Connect your MCP client and call bridge_status.

Example bridge loading from a checkout:

exec(open("/path/to/mcpFreeCAD/examples/freecad_bridge_loader.py").read(), globals(), globals())

The loader starts the bridge on 127.0.0.1:48111 with token change-me. Adjust the example or call start_bridge_server(...) directly if you need different values.

Configuration

The default configuration path is ~/.config/mcpfreecad.conf.

Example configuration:

{
  "mode": "remotehttp",
  "logging": {
    "level": "INFO"
  },
  "bridge": {
    "host": "127.0.0.1",
    "port": 48111,
    "token": "change-me",
    "timeout_seconds": 30.0
  },
  "remote_server": {
    "transport": {
      "uds": "/var/run/mcpfreecad.sock"
    },
    "url_prefix": "https://mcp.example.com/freecad/"
  },
  "stdio": {
    "library_root": "/srv/mcpfreecad/stdio-library",
    "allow_code_execution": true,
    "allow_library_write": true,
    "allow_snapshots": true
  },
  "api_keys": [
    {
      "id": "cad-agent",
      "kdf": {
        "algorithm": "argon2id",
        "salt": "BASE64",
        "time_cost": 3,
        "memory_cost": 65536,
        "parallelism": 1,
        "hash_len": 32,
        "hash": "BASE64"
      },
      "library_root": "/srv/mcpfreecad/cad-agent-library",
      "allow_code_execution": true,
      "allow_library_write": true,
      "allow_snapshots": true
    }
  ]
}

Generate or rotate a remote API key:

mcpfreecad --config ~/.config/mcpfreecad.conf --genkey cad-agent

Running

StdIO mode:

mcpfreecad --config ~/.config/mcpfreecad.conf

Remote HTTP mode:

mcpfreecad --config ~/.config/mcpfreecad.conf --transport remotehttp

The remote HTTP wrapper accepts:

  • Authorization: Bearer <token>
  • X-API-Key: <token>
  • ?mcp=<token>
  • legacy ?api_key=<token>

/status is intentionally public so it can be used for health checks.

Reverse Proxy Notes

The FastMCP instance is created with:

TransportSecuritySettings(enable_dns_rebinding_protection=False)

That is intentional for reverse-proxy deployments.

Example Apache layout:

ProxyPass        /freecad/status      http://127.0.0.1:18080/status
ProxyPassReverse /freecad/status      http://127.0.0.1:18080/status

ProxyPass        /freecad/mcp/        http://127.0.0.1:18080/mcp/
ProxyPassReverse /freecad/mcp/        http://127.0.0.1:18080/mcp/

ProxyPass        /freecad/snapshots/  http://127.0.0.1:18080/snapshots/
ProxyPassReverse /freecad/snapshots/  http://127.0.0.1:18080/snapshots/

When remote_server.url_prefix is configured, snapshot download URLs are returned as absolute URLs rooted there. Otherwise they fall back to relative ../snapshots/... paths.

Snapshot Retrieval

capture_snapshot(...) returns:

  • snapshot_id
  • download_url
  • download_url_with_token

download_url requires normal MCP auth again.

download_url_with_token is an easier direct-fetch URL for clients that cannot conveniently resend MCP auth. It contains a random in-memory token and returns image/png.

You can also retrieve a registered snapshot inline through:

get_snapshot_base64(snapshot_id="...")

Snapshots are exposed only if they were created through capture_snapshot(...). Arbitrary server files are not downloadable through the snapshot route.

FreeBSD rc.d Service

A sample rc.d script is included at freebsd/rc.d/mcpfreecad.

Install it as:

install -m 0555 freebsd/rc.d/mcpfreecad /usr/local/etc/rc.d/mcpfreecad

Default rc.conf settings:

mcpfreecad_enable="YES"
mcpfreecad_config="/usr/local/etc/mcpfreecad.conf"

Optional overrides:

mcpfreecad_daemon_user="mcpfreecad"
mcpfreecad_command="/usr/local/bin/mcpfreecad"
mcpfreecad_transport="remotehttp"
mcpfreecad_flags=""
mcpfreecad_pidfile="/var/run/mcpfreecad.pid"

Optional Workbenches

mcpfreecad only surfaces optional workbench tools when the corresponding workbench is available on the host. This currently includes support for areas such as:

  • freecad.gears
  • Fasteners
  • Curves
  • A2plus

Repository Layout

  • mcpfreecad/: package source
  • examples/: bridge loader and smoke examples
  • freebsd/: FreeBSD service helper
  • tests/: automated test suite
  • skill/: Codex skill material

Testing

Run the Python test suite with:

pytest -q

For bridge-side smoke testing from a checkout:

python3 examples/freecad_bridge_smoke.py
python3 examples/freecad_bridge_smoke.py --with-fasteners

推荐服务器

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

官方
精选