Skip to main content
Glama
docs-mcp.ts1.39 kB
#!/usr/bin/env node import { runIngest } from "../commands/ingest.js"; import { runMcpServer } from "../commands/mcp-server.js"; import { runQuery } from "../commands/query.js"; async function main() { const [, , subcommand, ...rest] = process.argv; if (!subcommand || ["-h", "--help"].includes(subcommand)) { printHelp(); process.exit(subcommand ? 0 : 1); } const dispatcher: Record<string, (argv: string[]) => Promise<void>> = { ingest: runIngest, "ingest-docs": runIngest, query: runQuery, "query-docs": runQuery, mcp: runMcpServer, "mcp-docs-server": runMcpServer, }; const handler = dispatcher[subcommand]; if (!handler) { console.error(`Unknown subcommand '${subcommand}'.`); printHelp(); process.exit(1); return; } await handler([process.argv[0], process.argv[1], ...rest]); } function printHelp() { console.log( `Usage: docs-mcp <command> [options]\n\nCommands:\n ingest Build the local docs index\n query Query the persisted index\n mcp Run the MCP docs server\n\nExamples:\n docs-mcp ingest --docs-root ../docs/en:en --persist-dir storage/llamaindex\n docs-mcp query "How do I customize navigation?" --model raw\n docs-mcp mcp --persist-dir storage/llamaindex --default-k 6`, ); } main().catch((error) => { console.error(error instanceof Error ? error.message : error); process.exit(1); });

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

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