• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

thoughtspot / mcp-server / 18606013481

17 Oct 2025 10:10PM UTC coverage: 87.4% (-1.0%) from 88.372%
18606013481

Pull #71

github

web-flow
Merge e975e0826 into 771ddb6f2
Pull Request #71: Handle OpenAI API MCP bug

190 of 231 branches covered (82.25%)

Branch coverage included in aggregate %.

0 of 7 new or added lines in 1 file covered. (0.0%)

684 of 769 relevant lines covered (88.95%)

157.95 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

31.25
/src/cloudflare-utils.ts
1
import { McpAgent } from "agents/mcp";
2
import { instrumentDO, type ResolveConfigFn } from '@microlabs/otel-cf-workers';
3
import type { BaseMCPServer, Context } from "./servers/mcp-server-base";
4
import type { Props } from "./utils";
5

6
export function instrumentedMCPServer<T extends BaseMCPServer>(MCPServer: new (ctx: Context) => T, config: ResolveConfigFn) {
7
    const Agent = class extends McpAgent<Env, any, Props> {
102✔
8
        server = new MCPServer(this as Context);
56✔
9

10
        // Argument of type 'typeof ThoughtSpotMCPWrapper' is not assignable to parameter of type 'DOClass'.
11
        // Cannot assign a 'protected' constructor type to a 'public' constructor type.
12
        // Created to satisfy the DOClass type.
13
        // biome-ignore lint/complexity/noUselessConstructor: required for DOClass
14
        public constructor(state: DurableObjectState, env: Env) {
15
            super(state, env);
56✔
16
        }
17

18
        async init() {
19
            await this.server.init();
10✔
20
        }
21

22
        public static serve(path: string) {
NEW
23
            const server = McpAgent.serve(path, {
×
24
                corsOptions: {
25
                    headers: "Content-Type, Accept, mcp-session-id, mcp-protocol-version, Authorization, x-ts-host"
26
                }
27
            });
NEW
28
            const serverFetch = server.fetch;
×
NEW
29
            server.fetch = async (request: Request, env: any, ctx: ExecutionContext) => {
×
30
                // Due to https://community.openai.com/t/the-responses-api-terminates-a-session-too-early/1312539/16
31
                // We need to ignore DELETE requests from OpenAI MCP clients. As the DELETE makes the session terminate too early.
NEW
32
                if (request.method === "DELETE" && request.headers.get("user-agent")?.includes("openai-mcp")) {
×
NEW
33
                    return new Response(null, { status: 403 });
×
34
                }
NEW
35
                return serverFetch(request, env, ctx);
×
36
            }
NEW
37
            return server;
×
38
        }
39
    }
40

41
    return instrumentDO(Agent, config) as unknown as typeof Agent;
102✔
42
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc