diff --git a/README.md b/README.md index f5e8e23..e25a965 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,9 @@ Join our [Discord](https://developers.thoughtspot.com/join-discord) to get suppo - [Gemini](#gemini-api) - [Features](#features) - [Supported transports](#supported-transports) +- [Manual client registration](#manual-client-registration) + - [Associating with a ThoughtSpot instance](#associate-with-a-thoughtspot-instance) +- [Self hosted](#self-hosted) - [Stdio support (fallback)](#stdio-support-fallback) - [How to obtain a TS_AUTH_TOKEN](#how-to-obtain-a-ts_auth_token) - [Troubleshooting](#troubleshooting) @@ -43,6 +46,7 @@ MCP Server URL: ``` https://agent.thoughtspot.app/mcp ``` +Preferred Auth method: Oauth - For OpenAI ChatGPT Deep Research, add the URL as: ```js @@ -236,6 +240,14 @@ For API usage, you would the token endpoints with a `secret_key` to generate the - Streamed HTTP [https://agent.thoughtspot.app/mcp]() +## Manual client registration + +For MCP hosts which do not(yet) support Dynamic client registration, or they require statically adding Oauth Client Id etc. Go to [this](https://agent.thoughtspot.app/clients) page, to register a new client and copy the details over. + +### Associate with a ThoughtSpot instance + +Manual client registration also allows to associate with a specific ThoughtSpot instance, so that your users do not have to enter the Thoughtspot instance URL when doing the authorization flow. + ## Self hosted Use the published docker image to deploy the MCP server in your own environment. diff --git a/package-lock.json b/package-lock.json index 54a8da2..674d0fa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,7 +15,7 @@ "@modelcontextprotocol/sdk": "^1.20.1", "@thoughtspot/rest-api-sdk": "^2.13.1", "agents": "^0.2.14", - "hono": "^4.9.7", + "hono": "^4.10.3", "rxjs": "^7.8.2", "yaml": "^2.7.1", "zod": "^3.24.3", @@ -4305,9 +4305,9 @@ } }, "node_modules/hono": { - "version": "4.9.7", - "resolved": "https://registry.npmjs.org/hono/-/hono-4.9.7.tgz", - "integrity": "sha512-t4Te6ERzIaC48W3x4hJmBwgNlLhmiEdEE5ViYb02ffw4ignHNHa5IBtPjmbKstmtKa8X6C35iWwK4HaqvrzG9w==", + "version": "4.10.3", + "resolved": "https://registry.npmjs.org/hono/-/hono-4.10.3.tgz", + "integrity": "sha512-2LOYWUbnhdxdL8MNbNg9XZig6k+cZXm5IjHn2Aviv7honhBMOHb+jxrKIeJRZJRmn+htUCKhaicxwXuUDlchRA==", "license": "MIT", "engines": { "node": ">=16.9.0" diff --git a/package.json b/package.json index 4d03b61..1dbdeb3 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "@modelcontextprotocol/sdk": "^1.20.1", "@thoughtspot/rest-api-sdk": "^2.13.1", "agents": "^0.2.14", - "hono": "^4.9.7", + "hono": "^4.10.3", "rxjs": "^7.8.2", "yaml": "^2.7.1", "zod": "^3.24.3", diff --git a/src/oauth-manager/oauth-utils.ts b/src/oauth-manager/oauth-utils.ts index 6599a6f..ad1b484 100644 --- a/src/oauth-manager/oauth-utils.ts +++ b/src/oauth-manager/oauth-utils.ts @@ -61,11 +61,14 @@ export interface ApprovalDialogOptions { * @returns A Response containing the HTML approval dialog */ export function renderApprovalDialog(request: Request, options: ApprovalDialogOptions): Response { - const { server, state } = options; + const { server, state, client } = options; const encodedState = btoa(JSON.stringify(state)); const serverName = sanitizeHtml(server.name); const mcpLogoUrl = 'https://raw.githubusercontent.com/thoughtspot/mcp-server/refs/heads/main/static/MCP%20Server%20Logo.svg'; const thoughtspotLogoUrl = 'https://avatars.githubusercontent.com/u/8906680?s=200&v=4'; + const clientUrl = client?.clientUri; + const tsInstanceUrlMatch = clientUrl?.match(/x-ts-host:(.*)/); + const tsInstanceUrl = tsInstanceUrlMatch ? tsInstanceUrlMatch[1].trim() : ''; const htmlContent = ` @@ -296,7 +299,7 @@ export function renderApprovalDialog(request: Request, options: ApprovalDialogOp
- +
ThoughtSpot MCP Server will be able to:
diff --git a/static/clients.html b/static/clients.html new file mode 100644 index 0000000..8a62920 --- /dev/null +++ b/static/clients.html @@ -0,0 +1,1100 @@ + + + + + + ThoughtSpot MCP OAuth Client Registration + + + + + + + +
+ + + + +