Skip to main content
Glama

docs-mcp-server

findVersion.ts1.85 kB
/** * Find version command - Finds the best matching version for a library. */ import type { Command } from "commander"; import { createDocumentManagement } from "../../store"; import { analytics, TelemetryEvent } from "../../telemetry"; import { FindVersionTool } from "../../tools"; import { getGlobalOptions } from "../utils"; export async function findVersionAction( library: string, options: { version?: string; serverUrl?: string }, command?: Command, ) { await analytics.track(TelemetryEvent.CLI_COMMAND, { command: "find-version", library, version: options.version, useServerUrl: !!options.serverUrl, }); const serverUrl = options.serverUrl; const globalOptions = getGlobalOptions(command); // Find version command doesn't need embeddings - explicitly disable for local execution const docService = await createDocumentManagement({ serverUrl, embeddingConfig: serverUrl ? undefined : null, storePath: globalOptions.storePath, }); try { const findVersionTool = new FindVersionTool(docService); // Call the tool directly - tracking is now handled inside the tool const versionInfo = await findVersionTool.execute({ library, targetVersion: options.version, }); if (!versionInfo) throw new Error("Failed to get version information"); console.log(versionInfo); } finally { await docService.shutdown(); } } export function createFindVersionCommand(program: Command): Command { return program .command("find-version <library>") .description("Find the best matching version for a library") .option("-v, --version <string>", "Pattern to match (optional, supports ranges)") .option( "--server-url <url>", "URL of external pipeline worker RPC (e.g., http://localhost:6280/api)", ) .action(findVersionAction); }

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/arabold/docs-mcp-server'

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