Skip to content

Stdio Mcp servers does not close and piles up #4369

Closed
@stannumm

Description

@stannumm

Description:
Every flowise session and every request which uses mcp creates a new server process. These processes do not close and piles up for every request that uses mcp even just refreshing flowise. This also happens with api requests. I've tried with node sdk and python sdk.

Image

async function main() {
    const transport = new StdioServerTransport();
    await server.connect(transport);
    console.error("AppInfo MCP Server running on stdio");
    console.error("MCP env", process.env);
}

main().catch((error) => {
    console.error("Fatal error in main():", error);
    process.exit(1);
});

process.on('SIGINT', async () => {
    process.exit(0);
});

process.on('SIGTERM', async () => {
    process.exit(0);
});

process.stdin.on("close", () => {
    console.error("MCP Server closed");
   server.close();
});

Root Cause:
Flowise does not notifies server that client has gone. I tried to create this flow using sequential agents and added a custom JS function node to send a close message to MCP, but I wasn't able to get it to work.

Expected Behavior:
Each time a request ends, Flowise should close the mcp or sends a signal to close itself.

Image
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions