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 分