Skip to main content
Glama

Cargo Doc MCP Server

by spacemeowx2
url-utils.ts1.06 kB
import TurndownService from 'turndown'; import fs from 'fs/promises'; /** * Singleton Turndown service for markdown conversion */ const turndownService = new TurndownService({ headingStyle: 'atx', codeBlockStyle: 'fenced', emDelimiter: '*' }); /** * Utilities for handling rustdoc URLs and content */ export class RustdocUrl { /** * Create a rustdoc URL from components */ static create(docPath: string): string { return `rustdoc://${docPath}`; } /** * Parse a rustdoc URL into a file path */ static parse(url: string): string { if (!url.startsWith('rustdoc://')) { throw new Error(`Invalid rustdoc URI format: ${url}. Expected format: rustdoc://path/to/doc`); } return url.replace('rustdoc://', ''); } /** * Read and convert doc content to markdown */ static async readContent(filePath: string): Promise<string> { const content = await fs.readFile(filePath, 'utf-8'); return turndownService.turndown(content); } }

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/spacemeowx2/cargo-doc-mcp'

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