Skip to main content
Glama
scmdr

SourceSync.ai MCP Server

by scmdr

validateApiKey

Verify API key validity by listing namespaces with SourceSync.ai MCP Server. Ensures secure access to knowledge management and semantic search functions.

Instructions

Validates the API key by attempting to list namespaces. Returns the list of namespaces if successful.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Registration and inline handler implementation for the 'validateApiKey' tool. The handler validates the API key (sourced from SOURCESYNC_API_KEY environment variable) by calling listNamespaces on the SourceSync client, wrapped in safeApiCall for MCP-compatible response formatting.
    server.tool( 'validateApiKey', 'Validates the API key by attempting to list namespaces. Returns the list of namespaces if successful.', validateApiKeySchema.shape, async (params: ValidateApiKeyParams) => { return safeApiCall(async () => { // Create a client with the provided API key const client = createClient({}) // Validate the API key by listing namespaces // @ts-ignore - Ignoring type error for now to focus on error handling return await client.listNamespaces() }) }, )
  • Zod schema for validateApiKey tool parameters. Defined as an empty object since no input parameters are required.
    export const validateApiKeySchema = z.object({})
  • TypeScript type definition for ValidateApiKeyParams, inferred from the Zod schema (results in empty object type).
    export type ValidateApiKeyParams = z.infer<typeof validateApiKeySchema>
  • Helper function used by validateApiKey handler (and others) to wrap API calls, format successful responses as MCP text content, and handle errors appropriately.
    async function safeApiCall<T>(apiCall: () => Promise<T>) { try { const result = await apiCall() return { content: [ { type: 'text' as const, text: JSON.stringify(result), }, ], } } catch (error: any) { // Preserve the original error structure from SourceSync return { content: [ { type: 'text' as const, text: JSON.stringify(error), }, ], isError: true, } }
  • Helper function to create SourceSync client instance. For validateApiKey, called with empty params, so uses SOURCESYNC_API_KEY from environment.
    function createClient({ apiKey, namespaceId, tenantId, }: { apiKey?: string namespaceId?: string tenantId?: string }) { return sourcesync({ apiKey: apiKey || process.env.SOURCESYNC_API_KEY || '', namespaceId: namespaceId || process.env.SOURCESYNC_NAMESPACE_ID || '', tenantId: tenantId || process.env.SOURCESYNC_TENANT_ID || '', }) }

Latest Blog Posts

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/scmdr/sourcesyncai-mcp'

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