Fix test suite to properly clean up MCP servers
- Add Accept header to mock requests per MCP spec requirement - Fix TypeScript build errors in integration tests - Add shutdownSession calls to properly clean up MCP server intervals - Update afterEach to ensure proper test cleanup - Add debug configurations for Jest in VS Code launch.json All tests now pass without hanging processes. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
88f683ef12
commit
29f5bde8b2
2 changed files with 100 additions and 20 deletions
|
|
@ -674,7 +674,6 @@ export const createMcpServer = (): McpServerWrapper => {
|
|||
});
|
||||
|
||||
const cleanup = async () => {
|
||||
console.log("Cleaning up MCP server");
|
||||
if (subsUpdateInterval) clearInterval(subsUpdateInterval);
|
||||
if (logsUpdateInterval) clearInterval(logsUpdateInterval);
|
||||
if (stdErrUpdateInterval) clearInterval(stdErrUpdateInterval);
|
||||
|
|
|
|||
|
|
@ -202,11 +202,12 @@ export class ServerRedisTransport implements Transport {
|
|||
}
|
||||
}
|
||||
|
||||
export async function getShttpTransport(sessionId: string): Promise<StreamableHTTPServerTransport> {
|
||||
export async function getShttpTransport(sessionId: string, onsessionclosed: (sessionId: string) => void | Promise<void>): Promise<StreamableHTTPServerTransport> {
|
||||
// Giving undefined here and setting the sessionId means the
|
||||
// transport wont try to create a new session.
|
||||
const shttpTransport = new StreamableHTTPServerTransport({
|
||||
sessionIdGenerator: undefined,
|
||||
onsessionclosed,
|
||||
})
|
||||
shttpTransport.sessionId = sessionId;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue