mdx-mcp-server

LLMTooling/mdx-mcp-server

3.2

If you are the rightful owner of mdx-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

MDX MCP Server is a universal server designed for intelligent processing and analysis of MDX files.

Tools
4
Resources
0
Prompts
0

MDX MCP Server

Universal MCP server for intelligent MDX file processing and analysis

Overview

MDX MCP Server is a powerful Model Context Protocol server that enables LLMs to seamlessly interact with, search, and process MDX files. It provides robust tools for reading MDX content as clean Markdown, performing contextual searches, converting files, and extracting metadata, all with built-in cross-platform compatibility and security.

Core Features

FeatureDescription
MDX ReadingConvert MDX to clean Markdown format on the fly
Contextual SearchFind content within MDX files with surrounding context
Format ConversionConvert and save MDX files to standard Markdown
Metadata ExtractionParse and retrieve YAML frontmatter
Cross-PlatformNative support for Windows, Linux, and macOS
Path SafetySecure path resolution preventing directory traversal

MCP Tools

The server exposes the following tools through the Model Context Protocol interface.

ToolDescriptionKey Parameters
read_mdxRead an MDX file and return its contents as Markdownpath
search_mdxSearch for content within an MDX filepath, query, contextLines
convert_mdx_to_mdConvert an MDX file to a Markdown file on disksourcePath, outputPath
get_mdx_frontmatterExtract YAML frontmatter from an MDX filepath

Tool Usage Examples

See how the tools can be leveraged to interact with MDX files.

// Read an MDX file
{
  "name": "read_mdx",
  "arguments": {
    "path": "docs/introduction.mdx"
  }
}

// Search with context
{
  "name": "search_mdx",
  "arguments": {
    "path": "docs/guide.mdx",
    "query": "installation",
    "contextLines": 2
  }
}

// Convert MDX to Markdown
{
  "name": "convert_mdx_to_md",
  "arguments": {
    "sourcePath": "docs/guide.mdx",
    "outputPath": "output/guide.md"
  }
}

// Extract metadata
{
  "name": "get_mdx_frontmatter",
  "arguments": {
    "path": "docs/article.mdx"
  }
}

Installation

Prerequisites

Ensure you have Node.js installed:

# Node.js >= 20.19.0 is required
node --version

Install the MCP Server

npm install
npm run build

Configuration

Add to your MCP settings file (e.g., claude_desktop_config.json):

{
  "mcpServers": {
    "mdx": {
      "command": "node",
      "args": ["/absolute/path/to/mdx-mcp-server/dist/index.js"],
      "env": {
        "WORKSPACE_ROOT": "/path/to/your/workspace"
      }
    }
  }
}

Development

# Clone the repository
git clone https://github.com/LLMTooling/mdx-mcp-server.git
cd mdx-mcp-server

# Install dependencies
npm install

# Build the project
npm run build

# Run tests
npm test

# Run tests in watch mode
npm run test:watch

Architecture

The server follows a modular architecture ensuring clean separation of concerns.

ComponentResponsibility
Server EntryMain MCP server setup and configuration (src/index.ts)
Tools ModuleImplementation of individual MCP tools (src/tools/)
Path ResolverCross-platform path handling and security (src/utils/path-resolver.ts)
MDX ProcessorCore MDX processing logic (src/utils/mdx-processor.ts)

Contributing

Contributions are welcome! Please feel free to submit issues or pull requests.

License

MIT License