Open-source Grok Bot alternative with a virtual machine that bots can use
TypeScript ai-agentsclaude-codecodexcomputer-usedockerelectrongrokgrok-botgrok-bot-alternativeself-hostedtypescript
MCP sign-in: say a CIMD-only server needs a feature OpenMausBot lacks
AdityaUmale4cc5abe9c726
diff --git a/server/mcp-oauth-discovery.ts b/server/mcp-oauth-discovery.tsindex 77679985c4..193d242a5a 100644--- a/server/mcp-oauth-discovery.ts+++ b/server/mcp-oauth-discovery.ts@@ -10,6 +10,8 @@ export interface McpAuthMetadata {registrationEndpoint?: string;revocationEndpoint?: string;scopes?: string[];+ /** The server takes a client ID metadata document (an https URL naming the app) instead of registering apps. */+ clientIdMetadataDocument?: true;/** RFC 8414 `token_endpoint_auth_methods_supported`; absent means client_secret_basic. */tokenEndpointAuthMethods?: string[];/** The MCP URL, sent as the RFC 8707 `resource` so tokens are audience-bound. */@@ -212,6 +214,7 @@ export async function discoverMcpAuth(authorizationEndpoint,tokenEndpoint,...(registrationEndpoint ? { registrationEndpoint } : {}),+ ...(metadata.client_id_metadata_document_supported === true ? { clientIdMetadataDocument: true as const } : {}),...(revocationEndpoint ? { revocationEndpoint } : {}),...(scopes?.length ? { scopes } : {}),...(tokenEndpointAuthMethods?.length ? { tokenEndpointAuthMethods } : {}),diff --git a/server/mcp-oauth.ts b/server/mcp-oauth.tsindex e397478a41..e27cd6e705 100644--- a/server/mcp-oauth.ts+++ b/server/mcp-oauth.ts@@ -535,7 +535,9 @@ export class McpOAuthManager {* public; a server that issues a secret anyway (Supabase) gets it back on every token request. */private async register(meta: McpAuthMetadata, redirectUri: string): Promise<ClientAuth> {if (!meta.registrationEndpoint) {- throw new McpOAuthError("no-registration", "This server only signs in apps registered with it in advance. Edit the server and add that app's client ID under Sign-in app.");+ throw new McpOAuthError("no-registration", meta.clientIdMetadataDocument+ ? "This server signs in apps by a published app ID (a client ID metadata document), which OpenMausBot doesn't support yet."+ : "This server only signs in apps registered with it in advance. Edit the server and add that app's client ID under Sign-in app.");}const response = await fetch(meta.registrationEndpoint, {method: "POST",diff --git a/server/mcp-sign-in-card.test.ts b/server/mcp-sign-in-card.test.tsindex 53e9c4b904..8b884c5300 100644--- a/server/mcp-sign-in-card.test.ts+++ b/server/mcp-sign-in-card.test.ts@@ -399,6 +399,19 @@ describe("the Sign in card", () => {expect(f.answers).toHaveLength(1);});+ it("a server that signs in apps only by a client ID metadata document says OpenMausBot can't do that yet", async () => {+ const f = await setup();+ const oauth = await startFakeOAuth({ noRegistration: true, clientIdMetadataDocument: true });+ const mcp = await startFakeHttpMcp({ acceptBearer: oauth.isValid, wwwAuthenticate: oauth.challenge });+ fixtures.push(oauth, mcp);+ f.cfg.mcpServers!.linear = { type: "http", url: mcp.url, headers: {}, enabled: true } as never;+ const { card } = await f.signIn();+ const refused = await f.authorize(card);+ expect(refused).toMatchObject({ status: 400, body: { code: "no-registration", error: "This server signs in apps by a published app ID (a client ID metadata document), which OpenMausBot doesn't support yet." } });+ expect(f.current(card).connector).toMatchObject({ status: "failed", error: refused.body.error, resumed: true });+ expect(f.answers).toEqual([{ messageId: card.id, text: `OpenMausBot MCP sign-in for linear: ${refused.body.error as string} Nothing was signed in.` }]);+ });+it("a server that registers no apps, refused before the turn parks, still reaches the bot once it parks", async () => {const f = await setup();const oauth = await startFakeOAuth({ noRegistration: true });diff --git a/server/testing/fake-oauth-server.ts b/server/testing/fake-oauth-server.tsindex da1d82a0a5..07a6db9801 100644--- a/server/testing/fake-oauth-server.ts+++ b/server/testing/fake-oauth-server.ts@@ -12,6 +12,8 @@ export interface FakeOAuthOptions {beforeToken?: () => Promise<void>;/** omit registration_endpoint from the metadata */noRegistration?: boolean;+ /** advertise client_id_metadata_document_supported: true in the metadata */+ clientIdMetadataDocument?: boolean;/** refuse to register a client for a redirect URI this matches */refuseRedirect?: (redirectUri: string) => boolean;/** answer every registration with this status, JSON body and headers */@@ -128,6 +130,7 @@ export async function startFakeOAuth(options: FakeOAuthOptions = {}): Promise<Faauthorization_endpoint: `${issuer}/authorize`,token_endpoint: `${issuer}/token`,...(options.noRegistration ? {} : { registration_endpoint: `${issuer}/register` }),+ ...(options.clientIdMetadataDocument ? { client_id_metadata_document_supported: true } : {}),revocation_endpoint: `${issuer}/revoke`,code_challenge_methods_supported: ["S256"],...(options.offlineAccess ? { scopes_supported: ["mcp", "offline_access"] } : {}),