@电路/mcp服务器
MCP(模型上下文协议)服务器,允许AI编码代理访问 电路 -可视化工作流程和图表平台。
它做什么
- 可视化代码:使用双向同步从项目文件创建代码节点
- 理解图表:AI代理可以理解用户绘制的流程图和图表
- 创建流程图:通过Circuitry的聊天代理生成可视化流程图
- 数据可视化:从代码分析创建电子表格和图表
先决条件
- 电路服务器 -下载自 电路.dev/下载
- Node.js 18+
- 兼容MCP的AI客户端 (克劳德代码、游标、VS代码、Gemini CLI等)
设置
1.安装和配置电路服务器
- 下载 电路服务器 从 电路.dev/下载
- 启动应用程序(出现在系统托盘中)
- 单击托盘图标→ 服务器→ 偏好
- 点击 “生成新的访问密钥”
- 复制密钥——下一步你需要它
2.运行MCP安装程序(必需)
npx @circuitry/mcp-server setup这将提示您输入:
- EServer地址 --按Enter键作为默认值(
http://localhost:3030) - 访问密钥 --粘贴上面生成的密钥
这会将您的凭据存储在 ~/.circuitry/mcp-config.json.
3.添加到您的AI客户端
克劳德代码
claude mcp add circuitry npx @circuitry/mcp-server或手动添加到 ~/.claude/config.json:
{
"mcpServers": {
"circuitry": {
"command": "npx",
"args": ["-y", "@circuitry/mcp-server"]
}
}
}光标
设置→ MCP → 添加新的MCP服务器:
{
"mcpServers": {
"circuitry": {
"command": "npx",
"args": ["-y", "@circuitry/mcp-server"]
}
}
}VS代码/副本
code --add-mcp '{"name":"circuitry","command":"npx","args":["-y","@circuitry/mcp-server"]}'Gemini CLI
gemini mcp add circuitry npx @circuitry/mcp-serverCline/Windsurf
使用上述标准格式添加到MCP配置中。
4.重新启动客户端
重新启动AI客户端以加载MCP服务器。
用法示例
可视化代码文件
You: Show me the auth files as code nodes in Circuitry
Agent: I'll create code nodes from your auth files...
Done! Created 4 code nodes:
- auth/login.ts
- auth/logout.ts
- auth/middleware.ts
- auth/types.ts
Changes sync bidirectionally with your source files.了解用户绘制的流程
You: I've drawn a flow of how I think the auth should work
Agent: I'll analyze your flow in Circuitry...
I can see you've drawn a 5-node authentication flow:
1. Start → Login Form
2. Login Form → Validate Credentials
3. Validate Credentials → branches to Success/Failure
...创建流程图
You: Create a flowchart showing the error handling flow
Agent: I'll ask Circuitry's agent to create this flowchart...
Done! Created a flowchart with 7 nodes showing:
- Error detection
- Classification (runtime vs validation)
- Logging paths
- User notification
- Recovery options可用工具
连接
| 工具 | 说明 |
|---|---|
circuitry.status | 检查连接状态 |
circuitry.connect | 请求连接(显示权限对话框) |
工作流理解
| 工具 | 说明 |
|---|---|
workflow.getActive | 获取当前可见的工作流信息 |
workflow.getStructure | 获得简化的工作流程结构 |
workflow.resolveFlow | 将用户引用(“此流”)解析为节点ID |
workflow.getNodeSummary | 获取简化的节点详细信息 |
节点操作
| 工具 | 说明 |
|---|---|
nodes.list | 列出工作流中的所有节点 |
nodes.get | 按ID获取节点 |
nodes.update | 更新节点配置 |
nodes.delete | 删除节点 |
代码节点
| 工具 | 说明 |
|---|---|
code.create | 创建代码节点(从同步的文件路径,或名称+内容) |
code.createBatch | 从文件创建多个代码节点 |
code.setCode | 更新代码内容(如果适用,同步到源代码) |
图纸节点
| 工具 | 说明 |
|---|---|
sheet.create | 使用数据创建电子表格节点 |
sheet.setData | 替换工作表数据 |
代理委托
| 工具 | 说明 |
|---|---|
agent.chat | 向Circuitry的聊天代理发送消息 |
agent.createFlowchart | 请代理创建流程图 |
agent.poll | 代理响应轮询(异步) |
配置
配置文件
地点: ~/.circuitry/mcp-config.json
{
"eserverUrl": "http://localhost:3030",
"accessKey": "your-key-here",
"configured": true
}环境变量
| 变量 | 描述 |
|---|---|
CIRCUITRY_ESERVER_URL | 覆盖EServer URL |
CIRCUITRY_ACCESS_KEY | 覆盖访问密钥 |
命令
# Run setup wizard
npx @circuitry/mcp-server setup
# Check current configuration
npx @circuitry/mcp-server status故障排除
“无法连接到EServer”
- 检查EServer是否正在运行:在系统托盘中查找电路图标
- 启动电路服务器:从下载 电路.dev/下载
- 验证URL:运行
npx @circuitry/mcp-server status
“无效的访问密钥”
- 创建新密钥:电路服务器→ 偏好→ 生成新的访问密钥
- 重新运行安装程序:
npx @circuitry/mcp-server setup
“未连接电路浏览器客户端”
- 开放式电路:确保Circuity应用程序已打开
- 刷新:尝试刷新电路页面
发展
# Clone and install
git clone https://github.com/circuitry-dev/circuitry-mcp-server.git
cd circuitry-mcp-server
npm install
# Build
npm run build
# Test locally
npx tsx src/index.ts setup
npx tsx src/index.ts status要测试本地更改,请将MCP配置指向构建的输出:
{
"mcpServers": {
"circuitry": {
"command": "node",
"args": ["/path/to/circuitry-mcp-server/dist/index.js"]
}
}
}许可证
麻省理工学院
