mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-01-02 22:32:27 +08:00
* feat: add MCP server package for npx distribution - Self-contained MCP server with embedded HTTP server - Real-time browser preview via draw.io iframe - Tools: start_session, display_diagram, edit_diagram, get_diagram, export_diagram - Port retry limit (6002-6020) and session TTL cleanup (1 hour) - Published as @next-ai-drawio/mcp-server on npm * chore: bump version to 0.1.2 * docs: add MCP server section to README (preview feature) * docs: add multi-client installation instructions for MCP server * fix: exclude packages from Next.js build * docs: use @latest instead of -y flag for npx (match Playwright MCP style) * chore: bump version to 0.4.3 and add release notes * chore: remove release notes * feat: add MCP server notice to example panel
25 lines
785 B
TypeScript
25 lines
785 B
TypeScript
/**
|
|
* Logger for MCP server
|
|
*
|
|
* CRITICAL: MCP servers communicate via STDIO (stdin/stdout).
|
|
* Using console.log() will corrupt the JSON-RPC protocol messages.
|
|
* ALL logging MUST use console.error() which writes to stderr.
|
|
*/
|
|
|
|
export const log = {
|
|
info: (msg: string, ...args: unknown[]) => {
|
|
console.error(`[MCP-DrawIO] [INFO] ${msg}`, ...args)
|
|
},
|
|
error: (msg: string, ...args: unknown[]) => {
|
|
console.error(`[MCP-DrawIO] [ERROR] ${msg}`, ...args)
|
|
},
|
|
debug: (msg: string, ...args: unknown[]) => {
|
|
if (process.env.DEBUG === "true") {
|
|
console.error(`[MCP-DrawIO] [DEBUG] ${msg}`, ...args)
|
|
}
|
|
},
|
|
warn: (msg: string, ...args: unknown[]) => {
|
|
console.error(`[MCP-DrawIO] [WARN] ${msg}`, ...args)
|
|
},
|
|
}
|