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

thoughtspot / mcp-server / 15691145450

16 Jun 2025 08:23PM UTC coverage: 19.595% (-0.04%) from 19.63%
15691145450

Pull #31

github

web-flow
Merge f989fca49 into b46edf0d4
Pull Request #31: Add locale header for every request with ThoughtSpot Rest client

9 of 98 branches covered (9.18%)

Branch coverage included in aggregate %.

3 of 8 new or added lines in 1 file covered. (37.5%)

78 of 346 relevant lines covered (22.54%)

0.42 hits per line

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

6.67
/src/bearer.ts
1
import type { ThoughtSpotMCP } from '.';
2
import type honoApp from './handlers';
3
import { validateAndSanitizeUrl } from './oauth-manager/oauth-utils';
4

5
export function withBearerHandler(app: typeof honoApp, MCPServer: typeof ThoughtSpotMCP) {
6
    app.mount("/bearer", (req, env, ctx) => {
2✔
7
        const authHeader = req.headers.get("authorization");
×
8
        if (!authHeader) {
×
9
            return new Response("Bearer token is required", { status: 400 });
×
10
        }
11

12
        let accessToken = authHeader.split(" ")[1];
×
13
        let tsHost: string | null;
14

15
        if (accessToken.includes('@')) {
×
16
            [accessToken, tsHost] = accessToken.split("@");
×
17
        } else {
18
            tsHost = req.headers.get("x-ts-host");
×
19
        }
20

21
        if (!tsHost) {
×
22
            return new Response("TS Host is required, either in the authorization header as 'token@ts-host' or as a separate 'x-ts-host' header", { status: 400 });
×
23
        }
24

25
        const clientName = req.headers.get("x-ts-client-name") || "Bearer Token client";
×
26

27
        ctx.props = {
×
28
            accessToken: accessToken,
29
            instanceUrl: validateAndSanitizeUrl(tsHost),
30
            clientName,
31
        };
32

33
        if (req.url.endsWith("/mcp")) {
×
34
            return MCPServer.serve("/mcp").fetch(req, env, ctx);
×
35
        }
36

37
        if (req.url.endsWith("/sse")) {
×
38
            return MCPServer.serveSSE("/sse").fetch(req, env, ctx);
×
39
        }
40

41
        return new Response("Not found", { status: 404 });
×
42
    });
43

44
    return app;
2✔
45
}
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

© 2025 Coveralls, Inc