CodePic

io.github.abelce由 GitHub 帳號 abelce 發布v1.0.0更新於 Nov 2, 2026

AI agent draws editable hand-drawn diagrams (flowchart, ER, architecture) via MCP, not static images

已驗證Streamable HTTP可網頁執行效率與工作流媒體與設計

概覽

AI 產生的概覽

CodePic 讓 AI 助理在託管編輯器中建立與修改手繪風格圖表(流程圖、ER 圖、架構圖),並回傳可分享的檢視與編輯連結。

可以做什麼
  • 依描述的節點與連線建立圖表,或從預設範本建立
  • 讀取現有圖表的元素、ID、位置及父子關係
  • 更新圖表:重新命名、整批替換節點與連線,或增刪個別元素
  • 查詢圖形中繼資料與完整圖形文件,用來規劃版面與容器
  • 在使用者明確要求瀏覽或挑選時列出可用範本
適用情境
適合讓助理把描述的系統架構、資料模型、時序流程或流水線變成可持續調整的可編輯圖表,而不是靜態圖片或 Mermaid 片段。也適合對已存放在 CodePic 中的圖表進行迭代修改。
執行需求
遠端 Streamable HTTP 端點,無需本機安裝。需要 CodePic 帳號及 API 金鑰(cpk_... 權杖),以 Bearer 形式放在 Authorization 標頭中。適用於任何支援遠端 Streamable HTTP 的 MCP 用戶端。
安裝前請注意
API 金鑰屬於機密,會寫入用戶端設定檔,請勿提交到共用儲存庫。建立與更新圖表會將資料寫入你的 CodePic 帳號,且新建圖表會產生公開檢視連結,需留意哪些內容會被公開。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 CodePic,將其新增到工作區。
  2. 連接 Authorization token 憑證。它們會被私密儲存,絕不會在公開頁面上展示。
  3. 為需要使用其工具的對話啟用該服務。

Web executable,透過 Streamable HTTP。 遠端服務在工作區中設定後即可從網頁執行環境執行。

交給代理程式安裝

把這段提示詞貼上到 Claude Code、Codex、Cursor 等代理程式,或 SourceWeft 對話中。代理程式會讀取該伺服器的安裝指南,先向你展示發布者、端點和登入方式,經你同意後再把它新增到你的客戶端。金鑰不會寫進任何命令。

閱讀 https://sourceweft.com/mcp/io.github.abelce%2Fcodepic/install.md,並按其中說明把這個 MCP 伺服器接入我的客戶端。修改任何設定之前,先告訴我它的發布者、端點和登入方式,等我確認。不要把 API 金鑰寫進命令或我會提交的檔案;問我金鑰應從哪裡取得。

檢視代理程式所依據的安裝指南

其他 MCP 客戶端

把它新增到你客戶端的 mcpServers 設定中。

{
  "mcpServers": {
    "codepic": {
      "type": "http",
      "url": "https://codepic.cc/api/mcp/mcp",
      "headers": {
        "Authorization": "Bearer <YOUR_TOKEN>"
      }
    }
  }
}

README

CodePic MCP

Let your AI coding agent draw editable diagrams — not another Mermaid snippet you have to paste.

[Server] [Website] [License]

Generate editable hand-drawn diagrams from Cursor, Claude Desktop, and other MCP clients.

CodePic MCP lets an AI coding agent create diagrams directly in CodePic instead of returning static images, Mermaid snippets, or JSON that you have to paste manually. The result opens in the CodePic editor, where you can still move shapes, edit labels, adjust connectors, share a read-only link, and export PNG or JSON.

Quick Start

It's a remote Streamable HTTP server — no local install. First create a free API key (the cpk_... token) at https://codepic.cc/settings/api-keys (sign in → New API key → copy), then add the config for your client and replace cpk_your_api_key_here.

Cursor

Create .cursor/mcp.json in your project:

json
{  "mcpServers": {    "codepic": {      "url": "https://codepic.cc/api/mcp/mcp",      "headers": {        "Authorization": "Bearer cpk_your_api_key_here"      }    }  }}

Claude Code

Add it with one command:

bash
claude mcp add --transport http codepic https://codepic.cc/api/mcp/mcp \  --header "Authorization: Bearer cpk_your_api_key_here"

Claude Desktop

Add CodePic to your claude_desktop_config.json:

json
{  "mcpServers": {    "codepic": {      "type": "streamableHttp",      "url": "https://codepic.cc/api/mcp/mcp",      "headers": {        "Authorization": "Bearer cpk_your_api_key_here"      }    }  }}

VS Code (GitHub Copilot)

Add CodePic to .vscode/mcp.json:

json
{  "servers": {    "codepic": {      "type": "http",      "url": "https://codepic.cc/api/mcp/mcp",      "headers": {        "Authorization": "Bearer cpk_your_api_key_here"      }    }  }}

Codex CLI

Add CodePic to ~/.codex/config.toml:

toml
[mcp_servers.codepic]url = "https://codepic.cc/api/mcp/mcp"
[mcp_servers.codepic.headers]Authorization = "Bearer cpk_your_api_key_here"

Windsurf

Add CodePic to ~/.codeium/windsurf/mcp_config.json:

json
{  "mcpServers": {    "codepic": {      "serverUrl": "https://codepic.cc/api/mcp/mcp",      "headers": {        "Authorization": "Bearer cpk_your_api_key_here"      }    }  }}

Cline

Open Cline's MCP settings (cline_mcp_settings.json) and add:

json
{  "mcpServers": {    "codepic": {      "type": "streamableHttp",      "url": "https://codepic.cc/api/mcp/mcp",      "headers": {        "Authorization": "Bearer cpk_your_api_key_here"      }    }  }}

Other clients

Any MCP client that supports remote Streamable HTTP works — point it at the endpoint https://codepic.cc/api/mcp/mcp with header Authorization: Bearer cpk_....

Available MCP Tools

  • list_templates - list available diagram templates.
  • create_from_template - create a new diagram from a template.
  • create_diagram - create a custom diagram with nodes and edges.
  • get_diagram - fetch the current diagram structure by documentId before making targeted follow-up edits.
  • update_diagram - update an existing diagram by replacing, adding, or removing nodes and edges.

Iterate on an Existing Diagram

Use get_diagram when you already have a CodePic document and want the AI agent to inspect it before changing it. This keeps the workflow grounded in the current diagram instead of guessing from memory.

Example prompt:

text
Use get_diagram to inspect document <documentId>, then update the diagram by adding a Redis cache between the API server and Postgres database.

Examples

ExampleWhat It GeneratesPrompt
System architectureNext.js SaaS architecture diagramNext.js + Supabase + Postgres + R2 + Stripe + Vercel
Database ER diagramSaaS billing data modelUsers, teams, subscriptions, invoices, payments
OAuth sequence flowPKCE login sequence diagramBrowser, app server, identity provider, database
CI/CD pipelineGitHub Actions deployment pipelineType-check, lint, build, preview, production
Data pipelineAnalytics pipeline diagramSegment, Snowflake, dbt, Metabase
Iterate existing diagramRead an existing document, then update itget_diagram + update_diagram

Useful Links

Community Post Angle

If you share this project, lead with the workflow:

I connected Cursor to a diagram editor through MCP, so it can generate editable architecture diagrams instead of Mermaid text.

Avoid generic product claims like "best diagram tool". Developer communities respond better to a concrete workflow and real examples.

License

MIT — see LICENSE.

來源:README.md,提交 31b01b9

工具

7

get_shape_docs

Get Shape Docs

Return the full CodePic shape reference — all element types, their fields, data payloads, and JSON examples. Call get_shape_catalog first for concise shape selection and container capabilities; use this tool when you need complete fields or type-specific data (e.g. select options, triangle direction, callout tail). No authentication required.

無需輸入參數。

get_shape_catalog

Get Shape Catalog

Return compact machine-readable shape metadata for planning a diagram: semantic tags, geometry family, container support, recommended padding, default size, and MCP availability. Use this before create_diagram when choosing shapes or containers. Unlike get_shape_docs, this tool is concise and filterable.

輸入參數tagcategorycontainerMode

list_templates

List Templates

List all available CodePic diagram templates. Use this ONLY when the user has explicitly asked to browse, list, or pick from templates (e.g. "show me templates", "列出模板"). Do NOT call this as a preparatory step when the user just described a diagram they want — in that case go straight to `create_diagram`. Discovering slugs here is only meaningful before a user-confirmed `create_from_template` call.

輸入參數category

create_from_template

Create from Template

Create a new CodePic diagram from a predefined template. Requires API Key authentication. Returns a public view URL and edit URL. **STRICT USAGE RULE — READ BEFORE CALLING:** Only call this tool when the user has **explicitly** asked to use a template. Explicit signals include phrases like: "use a template", "from template", "用模板", "从模板创建", "list templates and pick one", or the user directly naming/selecting a template slug. If the user merely describes a diagram they want (e.g. "draw an A/B test flowchart", "帮我画一个登录流程", "给我做一个系统架构图"), **DO NOT** call this tool. Call `create_diagram` instead and build the diagram from the user's description. Never silently substitute a template for a described diagram — the user will get a generic result that does not match what they asked for. When responding to the user, present the returned URL as a clickable markdown link (e.g. `[Open in CodePic →](URL)`) so the user can click it directly in their AI client (Cursor / Claude / etc.).

輸入參數nameslug必填locale

create_diagram

Create Diagram

Create a custom CodePic hand-drawn style diagram by specifying nodes and edges. Requires API Key authentication. Returns a public view URL. **THIS IS THE DEFAULT TOOL FOR ANY USER-DESCRIBED DIAGRAM.** Whenever the user describes a diagram they want ("draw an A/B test flowchart", "帮我画一个登录流程", "a system architecture with a load balancer and 3 servers", etc.), build it here from their description. Do NOT fall back to `create_from_template` / `list_templates` unless the user explicitly asked for a template. When responding to the user, present the returned URL as a clickable markdown link (e.g. `[Open in CodePic →](URL)`) so the user can click it directly in their AI client (Cursor / Claude / etc.). **Container nesting (IMPORTANT — use whenever possible):** - Set `parentId` on a node to nest it inside another node. ANY node type can be a container. - The parent automatically becomes draggable-as-a-group and users can keep dropping elements into it. - Call `get_shape_catalog` with tag `container-capable` to choose among native structural containers and adaptive semantic shapes such as rectangles, circles, ellipses, diamonds, cylinders, and hexagons. - Parent bounds are expanded automatically using the selected shape's title and outline safe area. - Use absolute canvas coordinates for all nodes — child coordinates are auto-converted to parent-relative. - Set node `name`, `description`, and `tags` when later MCP/Agent reads need stable business semantics beyond visible text. - **Rule**: whenever 2+ nodes logically belong to the same module / component / region, create a container node first and set `parentId` on each child. **Design tips for beautiful diagrams:** - Use semantic types: `button-primary` for CTA buttons (auto blue), `diamond` for decisions - Pick a color palette and apply it consistently — light fill + darker stroke of the same hue: • Blue: fillColor #e3f2fd / #bbdefb, strokeColor #1565c0, fontColor #1565c0 (or #ffffff on dark fill) • Green: fillCo

輸入參數name必填edgesnodes必填backgroundColor

get_diagram

Get Diagram

Fetch the current state of an existing CodePic diagram. Returns a compact summary of all elements with their IDs, types, positions, and parent-child relationships. Use this before update_diagram when you need to: add nested children to existing containers, make targeted edits to specific elements, or understand the current structure. Requires API Key authentication.

輸入參數documentId必填

update_diagram

Update Diagram

Update an existing CodePic diagram. You can rename it, replace all nodes/edges, or add/remove individual nodes and edges. Requires API Key authentication. When responding to the user, present the returned URL as a clickable markdown link (e.g. `[Open in CodePic →](URL)`) so the user can click it directly in their AI client (Cursor / Claude / etc.).

輸入參數nameedgesnodesaddEdgesaddNodesdocumentId必填removeEdgeIdsremoveNodeIdsbackgroundColor

版本歷史

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

評分

已滿足適用檢查項的 100%

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

  • 近 30 天內可連通必需25 分
  • 已宣告認證方式必需10 分
  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分