MCP Integration
Let AI agents directly call Lingie
Generate images, videos, and audio
Lingie's official MCP server (Lingie.Mcp) wraps the client's generation capabilities as standard MCP tools. Any MCP-compatible AI agent, such as Claude Desktop, Cursor, and ZCode, can connect in one click: write a prompt, and leave the rest to the agent.
Why Lingie MCP
Zero-dependency single file
A pure Node.js (>=18) single-file implementation. No npm install needed; clone and run.
Full coverage: local + cloud
Free local ComfyUI workflows, or call cloud GPUs and third-party models such as DALL·E, Midjourney, and Kling through the gateway.
Long tasks never lose results
If not completed in about 20 seconds, it automatically falls back and returns a task ID; the agent polls to retrieve the result, unaffected by the host's 30-second call timeout.
Zero-modification integration
Directly reuse Lingie's built-in local API; gateway credentials are issued with one click in Lingie settings and take effect automatically in about 10 seconds.
Quick start
Three steps to integrate: clone the repository, copy the config, and restart the agent to see the lingie tools.
1. Prerequisites
- 1灵姬客户端正在运行(官网免费下载)
- 2灵姬 设置 → 本地 API → 开启「外部工作流 API」(端口默认 17856)
- 3无需手动启动 ComfyUI 引擎:提交任务时灵姬会自动拉起(首次约 30-120 秒)
2. Clone the repository
git clone https://github.com/MechaBabyAi/Lingie.Mcp.git C:\MCP\Lingie.Mcp
3. Configure the agent
Add the following to the MCP configuration file of ZCode / Claude Desktop / Cursor (replace the path with your actual clone directory):
{
"mcpServers": {
"lingie": {
"command": "node",
"args": ["C:\\MCP\\Lingie.Mcp\\server.mjs"]
}
}
}Tool list
By default, the Workflow API tool is exposed (local ComfyUI engine, free):
lingie_health检查灵姬本地 API 与本地 ComfyUI 引擎是否在线(未运行时提交会自动拉起)lingie_list_workflows列出可用工作流(图片/视频/音频生成等)lingie_workflow_capabilities查看某工作流的参数模式(类型/必填/默认值/可选值/提交方式)lingie_upload_file上传本地文件到 ComfyUI 输入目录(供图生图/参考图/首帧等参数使用)lingie_run_workflow执行工作流:完成直接返回输出文件本地路径,超过约 20 秒自动降级返回 run_idlingie_run_result轮询 run_id 并取回结果,完成时返回输出文件本地路径lingie_run_status查询任务状态与进度(不下载输出)lingie_cancel_run取消任务(会中断本地引擎当前正在执行的任务)When gateway credentials are available (Lingie Settings → Local API → enable Agent (MCP) Gateway Access, or set environment variables), additional gateway tools are exposed, covering local/cloud ComfyUI and third-party models (billed by Lingie credits):
lingie_list_models列出网关可用模型(本地/云端 ComfyUI 与第三方模型)lingie_generate_image一键调用模型生成图片(超时自动降级返回 task_id)lingie_generate_video一键调用模型生成视频(超时自动降级返回 task_id)lingie_task_status查询网关任务状态与输出lingie_cancel_task取消网关任务lingie_estimate_cost预估一次模型调用的灵力值消耗(不实际生成)lingie_spirit_balance查询灵力值余额(可用 = 余额 − 冻结)Port, token, output directory, logs, etc. can all be overridden via environment variables; see the repository README for details. After enabling gateway access on the Lingie side, credentials are automatically written to local mcp-credentials.json, no manual configuration needed.
Typical agent invocation flow
Take text-to-image as an example: a complete generation takes only 6 steps:
lingie_healthlingie_list_workflowslingie_workflow_capabilitieslingie_upload_file(可选)lingie_run_workflowlingie_run_resultReady to let the agent do it for youCreateReally?
Clone Lingie.Mcp and get integrated in minutes; generation runs entirely through the Lingie client, with transparent and controllable Lingie points billing.
LingieAI.com
