mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-01-02 22:32:27 +08:00
Compare commits
1 Commits
7bdc1fe612
...
fix/image-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e598891322 |
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@next-ai-drawio/mcp-server",
|
"name": "@next-ai-drawio/mcp-server",
|
||||||
"version": "0.1.11",
|
"version": "0.1.10",
|
||||||
"description": "MCP server for Next AI Draw.io - AI-powered diagram generation with real-time browser preview",
|
"description": "MCP server for Next AI Draw.io - AI-powered diagram generation with real-time browser preview",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
|
|||||||
@@ -127,12 +127,7 @@ function cleanupExpiredSessions(): void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const cleanupIntervalId = setInterval(cleanupExpiredSessions, 5 * 60 * 1000)
|
setInterval(cleanupExpiredSessions, 5 * 60 * 1000)
|
||||||
|
|
||||||
export function shutdown(): void {
|
|
||||||
clearInterval(cleanupIntervalId)
|
|
||||||
stopHttpServer()
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getServerPort(): number {
|
export function getServerPort(): number {
|
||||||
return serverPort
|
return serverPort
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ import {
|
|||||||
getState,
|
getState,
|
||||||
requestSync,
|
requestSync,
|
||||||
setState,
|
setState,
|
||||||
shutdown,
|
|
||||||
startHttpServer,
|
startHttpServer,
|
||||||
waitForSync,
|
waitForSync,
|
||||||
} from "./http-server.js"
|
} from "./http-server.js"
|
||||||
@@ -619,31 +618,6 @@ server.registerTool(
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
// Graceful shutdown handler
|
|
||||||
let isShuttingDown = false
|
|
||||||
function gracefulShutdown(reason: string) {
|
|
||||||
if (isShuttingDown) return
|
|
||||||
isShuttingDown = true
|
|
||||||
log.info(`Shutting down: ${reason}`)
|
|
||||||
shutdown()
|
|
||||||
process.exit(0)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle stdin close (primary method - works on all platforms including Windows)
|
|
||||||
process.stdin.on("close", () => gracefulShutdown("stdin closed"))
|
|
||||||
process.stdin.on("end", () => gracefulShutdown("stdin ended"))
|
|
||||||
|
|
||||||
// Handle signals (may not work reliably on Windows)
|
|
||||||
process.on("SIGINT", () => gracefulShutdown("SIGINT"))
|
|
||||||
process.on("SIGTERM", () => gracefulShutdown("SIGTERM"))
|
|
||||||
|
|
||||||
// Handle broken pipe (writing to closed stdout)
|
|
||||||
process.stdout.on("error", (err) => {
|
|
||||||
if (err.code === "EPIPE" || err.code === "ERR_STREAM_DESTROYED") {
|
|
||||||
gracefulShutdown("stdout error")
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
// Start the MCP server
|
// Start the MCP server
|
||||||
async function main() {
|
async function main() {
|
||||||
log.info("Starting MCP server for Next AI Draw.io (embedded mode)...")
|
log.info("Starting MCP server for Next AI Draw.io (embedded mode)...")
|
||||||
|
|||||||
Reference in New Issue
Block a user