Skip to main content
Glama

Dodo Payments

Official
by dodopayments
index.ts2.73 kB
import { makeOAuthConsent } from './app'; import { McpAgent } from 'agents/mcp'; import OAuthProvider from '@cloudflare/workers-oauth-provider'; import { McpOptions, initMcpServer, server, ClientOptions } from 'dodopayments-mcp/server'; type MCPProps = { clientProps: ClientOptions; clientConfig: McpOptions; }; /** * The information displayed on the OAuth consent screen */ const serverConfig: ServerConfig = { orgName: 'DodoPayments', instructionsUrl: undefined, // Set a url for where you show users how to get an API key logoUrl: undefined, // Set a custom logo url to appear during the OAuth flow clientProperties: [ { key: 'bearerToken', label: 'Bearer Token', description: 'Bearer Token for API authentication', required: true, default: undefined, placeholder: 'My Bearer Token', type: 'password', }, { key: 'webhookKey', label: 'Webhook Key', description: '', required: false, default: null, placeholder: 'My Webhook Key', type: 'string', }, { key: 'environment', label: 'Environment', description: 'The environment to use for the client', required: false, default: 'live_mode', placeholder: 'live_mode', type: 'select', options: [ { label: 'live_mode', value: 'live_mode' }, { label: 'test_mode', value: 'test_mode' }, ], }, ], }; export class MyMCP extends McpAgent<Env, unknown, MCPProps> { server = server; async init() { initMcpServer({ server: this.server, clientOptions: this.props.clientProps, mcpOptions: this.props.clientConfig, }); } } export type ServerConfig = { /** * The name of the company/project */ orgName: string; /** * An optional company logo image */ logoUrl?: string; /** * An optional URL with instructions for users to get an API key */ instructionsUrl?: string; /** * Properties collected to initialize the client */ clientProperties: ClientProperty[]; }; export type ClientProperty = { key: string; label: string; description?: string; required: boolean; default?: unknown; placeholder?: string; type: 'string' | 'number' | 'password' | 'select'; options?: { label: string; value: string }[]; }; // Export the OAuth handler as the default export default new OAuthProvider({ apiHandlers: { // @ts-expect-error '/sse': MyMCP.serveSSE('/sse'), // legacy SSE // @ts-expect-error '/mcp': MyMCP.serve('/mcp'), // Streaming HTTP }, defaultHandler: makeOAuthConsent(serverConfig), authorizeEndpoint: '/authorize', tokenEndpoint: '/token', clientRegistrationEndpoint: '/register', });

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/dodopayments/dodopayments-node'

If you have feedback or need assistance with the MCP directory API, please join our Discord server