Skip to main content
Glama

My Credentials MCP Server

by preangelleo
types.ts•3.06 kB
import { z } from "zod"; import type { AuthRequest, OAuthHelpers, ClientInfo } from "@cloudflare/workers-oauth-provider"; // User context passed through OAuth export type Props = { login: string; name: string; email: string; accessToken: string; }; // Extended environment with OAuth provider export type ExtendedEnv = Env & { OAUTH_PROVIDER: OAuthHelpers }; // OAuth URL construction parameters export interface UpstreamAuthorizeParams { upstream_url: string; client_id: string; scope: string; redirect_uri: string; state?: string; } // OAuth token exchange parameters export interface UpstreamTokenParams { code: string | undefined; upstream_url: string; client_secret: string; redirect_uri: string; client_id: string; } // Approval dialog configuration export interface ApprovalDialogOptions { client: ClientInfo | null; server: { name: string; logo?: string; description?: string; }; state: Record<string, any>; cookieName?: string; cookieSecret?: string | Uint8Array; cookieDomain?: string; cookiePath?: string; cookieMaxAge?: number; } // Result of parsing approval form export interface ParsedApprovalResult { state: any; headers: Record<string, string>; } // MCP tool schemas using Zod export const ListTablesSchema = {}; export const QueryDatabaseSchema = { sql: z .string() .min(1, "SQL query cannot be empty") .describe("SQL query to execute (SELECT queries only)"), }; export const ExecuteDatabaseSchema = { sql: z .string() .min(1, "SQL command cannot be empty") .describe("SQL command to execute (INSERT, UPDATE, DELETE, CREATE, etc.)"), }; // MCP response types - Updated for current MCP SDK export interface McpTextContent { [x: string]: unknown; type: "text"; text: string; _meta?: { [x: string]: unknown } | undefined; } export interface McpResponse { [x: string]: unknown; content: McpTextContent[]; _meta?: { [x: string]: unknown } | undefined; isError?: boolean; } // Standard response creators export function createSuccessResponse(message: string, data?: any): McpResponse { let text = `**Success**\n\n${message}`; if (data !== undefined) { text += `\n\n**Result:**\n\`\`\`json\n${JSON.stringify(data, null, 2)}\n\`\`\``; } return { content: [{ type: "text", text, }], }; } export function createErrorResponse(message: string, details?: any): McpResponse { let text = `**Error**\n\n${message}`; if (details !== undefined) { text += `\n\n**Details:**\n\`\`\`json\n${JSON.stringify(details, null, 2)}\n\`\`\``; } return { content: [{ type: "text", text, isError: true, }], }; } // Database operation result type export interface DatabaseOperationResult<T = any> { success: boolean; data?: T; error?: string; duration?: number; } // SQL validation result export interface SqlValidationResult { isValid: boolean; error?: string; } // Re-export external types that are used throughout export type { AuthRequest, OAuthHelpers, ClientInfo };

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/preangelleo/my-credentials-mcp'

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