bottle-cap-mcp

bottle-cap-mcp

MCP server for bottle-cap CAD workflow, providing tools for generating precise caps, filling holes, repairing meshes, and generating visual meshes via CadQuery, PyMeshLab, and the Meshy API.

Category
访问服务器

README

bottle-cap-mcp

NitroStack MCP server exposing three tools for the bottle-cap-cad workflow. Vision/dimension extraction from the source photo happens client-side (in Claude, the MCP client) — none of these tools re-derive dimensions from pixels; generate_visual_mesh is the one exception, since Meshy infers geometry directly from the image itself.

Tools

Tool Input Backend Network
generate_precise_cap dimensions JSON CadQuery (Python — local subprocess, or remote via CAD_API_URL) none / HTTPS
fill hole/cavity geometry JSON (circle/rectangle/polygon, uniform or tapered) CadQuery (Python — local subprocess, or remote via CAD_API_URL) none / HTTPS
repair_mesh mesh URL or base64 PyMeshLab (Python — local subprocess, or remote via CAD_API_URL) none / HTTPS
generate_visual_mesh raw image (base64) Meshy API HTTPS

Setup

npm install
pip install -r requirements.txt --break-system-packages   # or your own venv
cp .env.example .env   # set MESHY_API_KEY
npm run build
npm start

For local iteration without a build step: npm run dev.

Deploying to NitroCloud (or any Node-only host)

NitroCloud's managed hosting runs this server in a Node-only container — there's no python3 there for getPythonCommand() to find, so fill/generate_precise_cap/repair_mesh fail with "Could not find a working Python interpreter" if deployed as-is.

The fix: run api/server.py (a small FastAPI wrapper around the same three CAD scripts) somewhere that does have Python — your own machine, a VPS, Render, Railway, Fly.io, etc. — and point the NitroCloud deployment at it.

1. Run the API somewhere with Python:

# locally, for testing (tunnel with ngrok/cloudflared if NitroCloud needs to reach it)
pip install -r requirements.txt --break-system-packages
export CAD_API_KEY=<pick-a-secret>
uvicorn api.server:app --host 0.0.0.0 --port 8787

# or as a container, anywhere that runs Docker:
docker build -f api/Dockerfile -t bottle-cap-cad-api .
docker run -d -p 8787:8787 -e CAD_API_KEY=<pick-a-secret> bottle-cap-cad-api

pymeshlab's mesh I/O plugins are Qt-based and need libgl1/libglu1-mesa present on the host even for fully headless use — the Dockerfile already includes them, but a bare VPS/Render/Railway box may need them installed separately (apt-get install libgl1 libglu1-mesa), or /repair calls will fail with Unknown format for load: stl.

2. Point the NitroCloud deployment at it — set these in NitroCloud's environment variables dashboard (not just your local .env, since that doesn't travel with the deploy):

CAD_API_URL=https://<wherever-you-ran-the-api-above>
CAD_API_KEY=<same secret as above>

That's it — fill.tools.ts/cap.tools.ts/repair.tools.ts check for CAD_API_URL at call time and switch to HTTP automatically. Leave it unset for local NitroStudio dev and they fall back to the original local-subprocess behavior, unchanged.

Structure

bottle-cap-mcp/
├── src/
│   ├── app.module.ts        # registers the tool providers
│   ├── main.ts               # bootstrap / entrypoint
│   └── tools/
│       ├── shapes.ts          # shared circle/rectangle/polygon zod schema
│       ├── cap.tools.ts       # generate_precise_cap
│       ├── fill.tools.ts      # fill
│       ├── repair.tools.ts    # repair_mesh
│       ├── mesh.tools.ts      # generate_visual_mesh (pure TS, calls Meshy)
│       ├── python-runtime.ts  # local python3/python/py auto-detection
│       └── cad-api-client.ts  # optional HTTP client for api/server.py (CAD_API_URL)
├── cad/
│   ├── precise_cap.py         # CadQuery threaded-cap builder
│   ├── fill.py                # CadQuery plug builder
│   └── repair_mesh.py         # PyMeshLab repair pipeline
├── api/
│   ├── server.py              # FastAPI wrapper exposing /fill /cap /repair over HTTP
│   └── Dockerfile              # standalone image for hosting api/server.py
├── package.json
├── tsconfig.json
└── requirements.txt

Known gaps (carried over from the design discussion)

  • Real threads — resolved: precise_cap.py now builds a solid, closed top and cuts a blind bore (not a through-hole), and unions one or more real helical thread ridges onto the skirt's inner wall via a triangular/trapezoidal profile swept along a cq.Wire.makeHelix() path (see make_thread_solid). threadStarts (1-4), threadDepth, and topThickness are new optional fields on generate_precise_cap — threadPitch still falls back to an approximate PCO 1810-style pitch (3.18mm, single start) when omitted. This is a parametric approximation tuned for FDM printing, not a certified thread-spec generator; swap in cq_warehouse's generators if you need an exact standard spec (e.g. a certified PCO 1881 mating thread).
  • Polygon flush caps: fill's capStyle: "flush" is implemented for circle/rectangle top shapes only. A polygon top with flush is downgraded to none by fill.tools.ts (with a warning returned to the caller) rather than silently failing.
  • Loft corner fillets: for tapered holes, rectangle corner radii are applied at the wire level before lofting (an approximation), since filleting a lofted solid's edges directly is more involved than filleting a simple extrusion's vertical edges.
  • NitroCloud deployment target — resolved: NitroCloud's managed hosting is Node-only (no Python interpreter available for the execFile calls). CadQuery/PyMeshLab now run behind a separate api/server.py microservice, called over HTTP when CAD_API_URL is set — see "Deploying to NitroCloud" above. Local NitroStudio dev is unaffected (falls back to the original subprocess path when CAD_API_URL is unset).
  • main.ts bootstrap call: NitroFactory.createMcpServer(...).listen() follows NitroStack's documented NestJS-style pattern, but the exact factory method wasn't pinned down in the source discussion — confirm against your installed NitroStack version.
  • Meshy polling: mesh.tools.ts polls for task completion; swap for Meshy's webhook callback in production to avoid long-held connections.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

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

官方
精选