Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 94 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"type": "module",
"scripts": {
"cf-typegen": "wrangler types",
"start": "wrangler dev",
"start": "wrangler dev --local-protocol https",
"dev": "wrangler dev",
"deploy": "wrangler deploy",
"format": "biome format --write",
Expand Down Expand Up @@ -44,9 +44,9 @@
"dependencies": {
"@cloudflare/workers-oauth-provider": "^0.0.5",
"@microlabs/otel-cf-workers": "^1.0.0-rc.52",
"@modelcontextprotocol/sdk": "^1.12.1",
"@modelcontextprotocol/sdk": "^1.15.1",
"@thoughtspot/rest-api-sdk": "^2.13.1",
"agents": "^0.0.95",
"agents": "^0.0.105",
"hono": "^4.7.8",
"rxjs": "^7.8.2",
"yaml": "^2.7.1",
Expand Down
30 changes: 11 additions & 19 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ import { instrument, type ResolveConfigFn, instrumentDO } from '@microlabs/otel-
import OAuthProvider from "@cloudflare/workers-oauth-provider";
import { McpAgent } from "agents/mcp";
import handler from "./handlers";
import type { Props } from "./utils";
import { type Props, instrumentedMCPServer } from "./utils";
import { MCPServer } from "./servers/mcp-server";
import { apiServer } from "./servers/api-server";
import { withBearerHandler } from "./bearer";
import { OpenAIDeepResearchMCPServer } from './servers/openai-mcp-server';

// OTEL configuration function
const config: ResolveConfigFn = (env: Env, _trigger) => {
Expand All @@ -19,31 +20,22 @@ const config: ResolveConfigFn = (env: Env, _trigger) => {
};
};

class ThoughtSpotMCPCore extends McpAgent<Env, any, Props> {
server = new MCPServer(this);


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

async init() {
await this.server.init();
}
}

// Create the instrumented ThoughtSpotMCP for the main export
export const ThoughtSpotMCP = instrumentDO(ThoughtSpotMCPCore, config);
export const ThoughtSpotMCP = instrumentedMCPServer(MCPServer, config);

export const ThoughtSpotOpenAIDeepResearchMCP = instrumentedMCPServer(OpenAIDeepResearchMCPServer, config);

// Create the OAuth provider instance
const oauthProvider = new OAuthProvider({
apiHandlers: {
"/mcp": ThoughtSpotMCP.serve("/mcp") as any, // TODO: Remove 'any'
"/sse": ThoughtSpotMCP.serveSSE("/sse") as any, // TODO: Remove 'any'
'/openai/mcp': ThoughtSpotOpenAIDeepResearchMCP.serve("/openai/mcp", {
binding: "OPENAI_DEEP_RESEARCH_MCP_OBJECT"
}) as any, // TODO: Remove 'any'
'/openai/sse': ThoughtSpotOpenAIDeepResearchMCP.serveSSE("/openai/sse", {
binding: "OPENAI_DEEP_RESEARCH_MCP_OBJECT"
}) as any, // TODO: Remove 'any'
"/api": apiServer as any, // TODO: Remove 'any'
},
defaultHandler: withBearerHandler(handler, ThoughtSpotMCP) as any, // TODO: Remove 'any'
Expand Down
2 changes: 1 addition & 1 deletion src/metrics/mixpanel/mixpanel.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { MixpanelClient } from "./mixpanel-client";
import type { SessionInfo } from "../../thoughtspot/thoughtspot-service";
import type { SessionInfo } from "../../thoughtspot/types";
import type { Tracker } from "../index";


Expand Down
Loading