import EmailPassword from "supertokens-node/recipe/emailpassword"; import ThirdParty from "supertokens-node/recipe/thirdparty"; import Session from "supertokens-node/recipe/session"; import Dashboard from "supertokens-node/recipe/dashboard"; import UserRoles, { UserRoleClaim } from "supertokens-node/recipe/userroles"; import OAuth2Provider from "supertokens-node/recipe/oauth2provider"; import type { TypeInput } from "supertokens-node/types"; import SuperTokensMcpPlugin, { SuperTokensAdminMcpServer, } from "supertokens-mcp-plugin"; const adminMcpServer = new SuperTokensAdminMcpServer({ path: "/mcp/admin", validateTokenPayload: async (accessTokenPayload) => { return { status: "OK" }; }, claimValidators: [UserRoleClaim.validators.includes("admin")], }); export function getApiDomain() { const apiPort = 3001; const apiUrl = `http://localhost:${apiPort}`; return apiUrl; } export function getWebsiteDomain() { const websitePort = 3000; const websiteUrl = `http://localhost:${websitePort}`; return websiteUrl; } export const SuperTokensConfig: TypeInput = { supertokens: { connectionURI: "https://try.supertokens.com", }, appInfo: { appName: "SuperTokens Admin MCP Demo", apiDomain: getApiDomain(), websiteDomain: getWebsiteDomain(), apiBasePath: "/auth", websiteBasePath: "/auth", }, recipeList: [ EmailPassword.init(), ThirdParty.init({ signInAndUpFeature: { providers: [ { config: { thirdPartyId: "google", clients: [ { clientId: "1060725074195-kmeum4crr01uirfl2op9kd5acmi9jutn.apps.googleusercontent.com", clientSecret: "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", }, ], }, }, { config: { thirdPartyId: "github", clients: [ { clientId: "467101b197249757c71f", clientSecret: "e97051221f4b6426e8fe8d51486396703012f5bd", }, ], }, }, { config: { thirdPartyId: "apple", clients: [ { clientId: "4398792-io.supertokens.example.service", clientSecret: "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", additionalConfig: { keyId: "7M48Y4RYDL", privateKey: "-----BEGIN PRIVATE KEY-----\nMIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQgu8gXs+XYkqXD6Ala9Sf/iJXzhbwcoG5dMh1OonpdJUmgCgYIKoZIzj0DAQehRANCAASfrvlFbFCYqn3I2zeknYXLwtH30JuOKestDbSfZYxZNMqhF/OzdZFTV0zc5u5s3eN+oCWbnvl0hM+9IW0UlkdA\n-----END PRIVATE KEY-----", teamId: "YWQCXGJRJL", }, }, ], }, }, { config: { thirdPartyId: "twitter", clients: [ { clientId: "4398792-WXpqVXRiazdRMGNJdEZIa3RVQXc6MTpjaQ", clientSecret: "BivMbtwmcygbRLNQ0zk45yxvW246tnYnTFFq-LH39NwZMxFpdC", }, ], }, }, ], }, }), Dashboard.init(), UserRoles.init(), Session.init(), OAuth2Provider.init(), ], experimental: { plugins: [ SuperTokensMcpPlugin.init({ mcpServers: [adminMcpServer], }), ], }, };