From 7875f0120577faa633baa5ab64844c15e042437d Mon Sep 17 00:00:00 2001 From: Bruno Fargnoli Date: Sun, 19 Jul 2026 22:31:12 +0200 Subject: [PATCH] MCP: Added Wiki page --- wiki/content/39.md | 195 +++++++++++++++++++++++++++++++++++++++++++++ wiki/manifest.json | 9 +++ 2 files changed, 204 insertions(+) create mode 100644 wiki/content/39.md diff --git a/wiki/content/39.md b/wiki/content/39.md new file mode 100644 index 0000000..8d6cfb2 --- /dev/null +++ b/wiki/content/39.md @@ -0,0 +1,195 @@ +# MCP + +3D Gen Studio ships an **MCP** ([Model Context Protocol](https://modelcontextprotocol.io)) server, so any AI assistant — Claude, GitHub Copilot, ChatGPT, or a local LLM — can drive the app for you: create projects, build node graphs, run ComfyUI workflows, generate images and meshes, run the mesh tools (Auto UV, Retopo, Repair, Rig, Optimize), and import/export projects. + +## The endpoint + +The MCP server is built into the app backend — there is no extra process to start. Launch the desktop app (or run `npm run dev`) and the endpoint is live at: + +``` +http://localhost:3001/mcp +``` + +It speaks **Streamable HTTP**. The app must be running whenever a client wants to use the tools. + +### Security + +- **Local by default** — with no token set, only clients on the same machine can connect. +- **Remote access** — set a bearer token and remote clients must send `Authorization: Bearer `. +- **Disable** — turn the server off and the endpoint returns `404`. + +Settings are stored in the app database. Set them with a request to `POST /api/settings`: + +```json +{ "mcp": { "enabled": true, "token": "your-secret-token" } } +``` + +Leave `token` empty for local-only use. + +## Configure with Claude + +### Claude Code + +One command adds the server: + +```sh +claude mcp add --transport http 3d-gen-studio http://localhost:3001/mcp +``` + +Then just talk to Claude — the `3d-gen-studio` tools are available in any session. + +### Claude Desktop + +**Option A — Custom connector (recommended).** Open **Settings → Connectors → Add custom connector** and enter the URL: + +``` +http://localhost:3001/mcp +``` + +**Option B — Config file (stdio bridge).** Edit `claude_desktop_config.json` and add: + +```json +{ + "mcpServers": { + "3d-gen-studio": { + "command": "node", + "args": ["C:/Git/3DGenStudio/mcp/stdio.js"] + } + } +} +``` + +Adjust the path to your checkout. The bridge requires the app to be running and talks to `http://127.0.0.1:3001` (override with the `GENSTUDIO_URL` environment variable). + +If you don't have a local checkout, you can use `mcp-remote` instead: + +```json +{ + "mcpServers": { + "3d-gen-studio": { + "command": "npx", + "args": ["mcp-remote", "http://localhost:3001/mcp"] + } + } +} +``` + +Restart Claude Desktop after editing the file. + +## Configure with Visual Studio Code + +MCP tools in VS Code are used from **GitHub Copilot Agent mode**. You need VS Code 1.102+ with the **GitHub Copilot** and **GitHub Copilot Chat** extensions. + +**Fastest path:** open the Command Palette (`Ctrl+Shift+P`) → **MCP: Add Server…** → **HTTP** → enter `http://localhost:3001/mcp` → name it `3d-gen-studio`. + +**Or add it to your workspace** by creating `.vscode/mcp.json`. Note that VS Code uses the `servers` key (not `mcpServers`): + +```json +{ + "servers": { + "3d-gen-studio": { + "type": "http", + "url": "http://localhost:3001/mcp" + } + } +} +``` + +Start the server via the CodeLens shown in that file (or the MCP view), then: + +1. Open **Copilot Chat**. +2. Switch to **Agent** mode. +3. Click the tools (🔧) picker and enable the 3D Gen Studio tools. + +For a token-protected or remote endpoint, add an `Authorization` header and let VS Code prompt for the token: + +```json +{ + "servers": { + "3d-gen-studio": { + "type": "http", + "url": "http://localhost:3001/mcp", + "headers": { "Authorization": "Bearer ${input:genstudio-token}" } + } + }, + "inputs": [ + { + "id": "genstudio-token", + "type": "promptString", + "description": "3D Gen Studio MCP token", + "password": true + } + ] +} +``` + +A `stdio` server also works (`"type": "stdio"`, `"command": "node"`, `"args": ["C:/Git/3DGenStudio/mcp/stdio.js"]`) and likewise needs the app running. + +## Other clients + +Any client that supports Streamable HTTP MCP servers can connect to `http://localhost:3001/mcp` — for example **ChatGPT** (developer mode) or a local LLM stack. Remote clients need the bearer token (see [Security](#security)). + +To debug a connection, use the **MCP Inspector**: + +```sh +npx @modelcontextprotocol/inspector +``` + +Connect with transport **Streamable HTTP** to `http://localhost:3001/mcp`. + +## Example prompts + +Once connected, ask your assistant in plain language. A few things to try: + +**Explore & set up** + +- *"List my 3D Gen Studio projects and tell me what's in the latest one."* +- *"Create a new graph project called 'Robot Concept'."* +- *"Which ComfyUI workflows do I have available, and what parameters does the text-to-image one take?"* + +**Generate images** + +- *"In the 'Robot Concept' project, generate an image of a friendly retro robot on a white background."* +- *"Run my text-to-image workflow with the prompt 'weathered stone golem, moss on shoulders' and show me the result."* + +**Generate & refine meshes** + +- *"Generate a 3D mesh from the robot image and display it on a node."* +- *"Generate a mesh with Tripo from this image, then run Auto Retopo on it to clean up the topology."* +- *"Run Auto UV on the latest mesh, then export it as a GLB to my Desktop."* + +**Build a pipeline (graph projects)** + +- *"Create an image node, generate a concept image on it, then add a mesh node wired to it and generate a 3D model."* +- *"Show me the current graph, then connect the image node to the mesh node and run the mesh generation."* + +**Manage assets** + +- *"List the assets in this project and show me the ones that are meshes."* +- *"Download the final textured mesh to `C:/Exports`."* + +### Tips for good results + +- **In graph projects, mention the node** you want results on (e.g. *"display it on the mesh node"*). The assistant passes the node id so the result appears on the canvas; without it, assets are saved but no node shows them. +- **Wire inputs before running.** When editing or deriving assets, connect the source node first — the assistant is guided to do this, but saying *"connect it, then run"* keeps the order right. +- **Some things need external services running:** ComfyUI (for `run_workflow`), provider API keys (for the mesh/image generators), and the Python mesh-tools service on `:8200` (for Auto UV / Retopo / Repair). The desktop app can start the Python service from Settings. + +## What's available + +The server exposes tools grouped by area: + +| Group | What it covers | +|---|---| +| Projects | Create, list, update, delete, import, and export projects | +| Kanban cards | List and move cards, manage card attributes | +| Graph | Read the graph, create/move/delete nodes, connect and disconnect them | +| ComfyUI workflows | List, inspect, import, update, and run workflows | +| AI actions | Generate and edit images; generate meshes (built-in, Tencent, Tripo, Hitem3D); edit, texture, and rig meshes | +| Mesh tools | Auto UV, Auto Retopo, Repair, Auto Rig, Optimize, FBX convert, and export | +| Assets | List, view, download, upload, link, and delete assets | +| System | Read settings (secrets redacted) and system stats | + +## Limitations + +- The interactive **Mesh Editor** operations (sculpt, modeling, boolean, painting, projection, texture bake) and **Image Editor** pixel operations (crop, filters, shadow remover) run in the browser and are **not** exposed over MCP. Use the AI alternatives instead: ComfyUI workflows, prompt-based image edits, and the mesh-tool services. +- If the app is open in a browser while an MCP client changes data, open Graph and Kanban pages refresh automatically; other pages may need a manual refresh. diff --git a/wiki/manifest.json b/wiki/manifest.json index 5886e5b..283173d 100644 --- a/wiki/manifest.json +++ b/wiki/manifest.json @@ -341,6 +341,15 @@ "position": 1, "createdAt": 1784129609391, "updatedAt": 1784129619051 + }, + { + "id": 39, + "parentId": null, + "title": "MCP", + "icon": "description", + "position": 6, + "createdAt": 1784492754708, + "updatedAt": 1784492762736 } ] }