Lucid导入MCP服务器
一个MCP(模型上下文协议)服务器,能够使用Lucid REST API创建Lucid图表流程图。此服务器设计为作为 无状态中间件,其中身份验证由MCP客户端(例如LibreChat)处理,令牌随每个请求传递给服务器。
特性
- 无状态架构:没有本地令牌存储;安全且可扩展。
- 流程图创建:使用自动形状放置创建简单的线性工艺流程。
- 自定义图表:构建复杂的图表,完全控制形状、连接器和样式。
- 逐步构建器:使用直观的API以编程方式构建图表。
- 标准导入支持:完全支持Lucid标准导入JSON格式。
- 多产品:与Lucidchart和Lucidspark合作。
安装
npm install
npm run build运行服务器
服务器作为具有SSE(服务器发送事件)终结点的Express应用程序运行。
npm start这将在端口3000(默认)上启动服务器。 SSE端点: http://localhost:3000/sse
使用Docker运行
您还可以使用Docker运行服务器:
# Build and run with Docker Compose
docker-compose up -d
# Or build and run manually
docker build -t lucid-import-mcp .
docker run -p 3000:3000 --env-file .env lucid-import-mcp配置
MCP客户端配置(例如LibreChat)
配置您的MCP客户端以使用SSE传输并处理OAuth 2.0。
mcpServers:
lucid-chart:
type: streamable-http
url: "http://localhost:3000/sse"
requiresOAuth: true
oauth:
client_id: "${LUCID_CLIENT_ID}"
client_secret: "${LUCID_CLIENT_SECRET}"
authorization_url: "https://lucid.app/oauth2/authorize"
token_url: "https://your-mcp-server-url.com/oauth/token"
scope: "lucidchart.document.app lucidchart.document.content lucidspark.document.app lucidspark.document.content user.profile"
redirect_uri: "https://your-client-url.com/api/mcp/lucid-chart/oauth/callback"重要提示: 这 token_url 指向此MCP服务器的OAuth代理端点(/oauth/token),而不是直接指向Lucid的API。代理将OAuth请求格式转换为符合Lucid的要求。替换 https://your-mcp-server-url.com 使用您的实际MCP服务器URL(例如。, https://lucid-mcp.amendllc.com).
环境变量(服务器)
服务器本身是无状态的,不需要OAuth密钥,但您可以配置端口:
PORT=3000可用工具
用户工具
lucid_get_user_profile
获取经过身份验证的用户的个人资料信息。
退货: 用户ID、姓名和电子邮件
文档创建工具
lucid_create_process_map
创建一个简单的线性过程图。
参数:
title(必填):文件标题steps(必填):流程步骤名称数组product(可选):'lucidchart'或'lucidspark'(默认:'lucid chart')parentFolderId(可选):用于创建文档的文件夹ID
例子:
{
"title": "Order Fulfillment Process",
"steps": [
"Start",
"Receive Order",
"Check Inventory",
"Process Payment",
"Ship Order",
"End"
],
"product": "lucidchart"
}lucid_build_diagram_step_by_step
使用形状和连接器逐步构建图表。
参数:
pageTitle(必填):页面标题shapes(必填):形状定义数组connectors(可选):连接器定义数组
形状类型:
process/rectangle:工艺箱decision/diamond:决策钻石start/end/ellipse:开始/结束椭圆形
例子:
{
"pageTitle": "Approval Workflow",
"shapes": [
{
"type": "start",
"x": 200,
"y": 50,
"text": "Start",
"fillColor": "#C5E0B4"
},
{
"type": "process",
"x": 200,
"y": 150,
"width": 120,
"height": 60,
"text": "Submit Request",
"fillColor": "#FFFFFF"
},
{
"type": "decision",
"x": 200,
"y": 250,
"text": "Approved?",
"fillColor": "#FFE699"
}
],
"connectors": [
{ "from": 0, "to": 1 },
{ "from": 1, "to": 2 }
]
}lucid_import_diagram
将完整的JSON图表导入Lucid。
参数:
title(必填):文件标题documentJson(必填):文档定义的JSON字符串product(可选):“清醒图表”或“清醒火花”parentFolderId(可选):文件夹ID
使用工作流程
- 连接:用户点击MCP客户端中的“连接”(例如LibreChat)。
- 验证:用户通过OAuth弹出窗口登录Lucid。
- 使用工具:用户要求Claude/LLM创建图表。
- 客户端在 Authorization 头球 - 服务器使用该令牌来调用Lucid API。
标准导入格式
服务器使用Lucid的标准导入格式,该格式由 .lucid 包含以下内容的文件(ZIP存档) document.json 文件。
文档结构
{
"version": "1.0",
"pages": [
{
"id": "page-uuid",
"title": "Page 1",
"shapes": [
{
"id": "shape-uuid",
"shapeType": "rectangle",
"boundingBox": {
"x": 100,
"y": 100,
"w": 120,
"h": 60
},
"text": "Process Step",
"style": {
"fill": { "color": "#FFFFFF", "type": "solid" },
"stroke": { "color": "#000000", "width": 2, "style": "solid" }
}
}
],
"lines": [
{
"id": "line-uuid",
"endpoint1": {
"x": 0,
"y": 0,
"shapeId": "shape-uuid-1",
"position": "auto"
},
"endpoint2": {
"x": 0,
"y": 0,
"shapeId": "shape-uuid-2",
"position": "auto"
},
"style": {
"stroke": { "color": "#000000", "width": 2, "style": "solid" }
}
}
]
}
]
}形状类型
rectangle:矩形/进程框ellipse:椭圆形diamond:菱形/决定形状circle:圆形triangle:三角形parallelogram:平行四边形trapezoid:梯形hexagon:六角形
颜色格式
颜色指定为十六进制字符串:
#FFFFFF-白色#000000-黑色#C5E0B4-浅绿色#FFE699-淡黄色#BDD7EE-浅蓝色
局限性
根据Lucid标准进口规范:
- ZIP文件内容:最大50MB
- document.json:最大2MB
- 所有项目必须具有唯一的UUID
- 至少需要一页
发展
# Install dependencies
npm install
# Build TypeScript
npm run build
# Start Server
npm start资源
许可证
麻省理工学院
