andrewtdiz/mdmcp
If you are the rightful owner of mdmcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The Model Context Protocol (MCP) server is a robust framework designed to efficiently serve markdown content with dynamic template support, providing a seamless integration with modern web interfaces.
MDMCP - Markdown MCP
Markdown MCP is a more accurate, token efficient framework for building an MCP server
A unified monorepo containing both a Next.js frontend application and an MCP (Model Context Protocol) server for serving markdown text. This project provides a complete solution for rendering and serving markdown content with dynamic template support and a modern web interface.
š Quick Start
Prerequisites
- Node.js >= 18.0.0
- npm (comes with Node.js)
- Git
Installation
-
Clone the repository:
git clone <repository-url> cd modelmarkdownprotocol
-
Install frontend dependencies:
cd frontend && npm install
-
Install MCP server dependencies:
cd mcp && npm install
-
Install at the project root and start development servers:
npm install && npm run dev
This will start both the frontend (Next.js) and MCP server concurrently. The frontend will be available at http://localhost:3000
and the MCP server will run on its configured port.
š¦ Installation as Package
npm install mdmcp
CLI Usage
After installing globally or using npx:
# Start MCP server
mdmcp-server
# Start Next.js frontend server
mdmcp-frontend
šļø Project Structure
mdmcp/
āāā frontend/ # Next.js frontend application
ā āāā app/ # Next.js App Router pages
ā ā āāā layout.tsx # Root layout component
ā ā āāā page.tsx # Home page
ā ā āāā ClientRouter.tsx # Client-side routing
ā ā āāā [...slug]/ # Dynamic routing
ā āāā src/ # Source code
ā ā āāā components/ # Reusable UI components
ā ā ā āāā ui/ # Radix UI components
ā ā āāā utils/ # Utility functions
ā āāā styles/ # Global styles
ā āāā package.json # Frontend dependencies
ā āāā next.config.js # Next.js configuration
ā āāā tailwind.config.js # Tailwind CSS configuration
ā āāā tsconfig.json # TypeScript configuration
āāā mcp/ # MCP server implementation
ā āāā index.ts # Main server entry point
ā āāā sessions.ts # Session management
ā āāā tools/ # MCP tools
ā ā āāā navigate.ts # Navigation tool
ā ā āāā startHere.ts # Start here tool
ā ā āāā sendRequest.ts # Request sending tool
ā āāā utils/ # Server utilities
ā āāā package.json # MCP server dependencies
ā āāā tsconfig.json # TypeScript configuration
āāā md/ # Markdown content and conversion
ā āāā _generated/ # Auto-generated markdown files
ā āāā converter.ts # Markdown ā TypeScript converter
ā āāā convert-all.ts # Batch conversion script
ā āāā convert-single.ts # Single file conversion
ā āāā *.md # Source markdown files
āāā dist/ # Built output (generated)
āāā package.json # Root package configuration
āāā tsconfig.json # Root TypeScript configuration
āāā README.md
š ļø Development
Available Scripts
Script | Description |
---|---|
npm run dev | Start both frontend and MCP server in development mode |
npm run dev:frontend | Start only the Next.js frontend |
npm run dev:mcp | Start only the MCP server |
npm run build | Build both services for production |
npm run build:frontend | Build only the frontend |
npm run build:mcp | Build only the MCP server |
npm run start | Start the frontend in production mode |
npm run start:frontend | Start the Next.js frontend |
npm run start:mcp | Start the MCP server |
npm run clean | Clean all build outputs and dependencies |
npm run install:all | Install dependencies for all packages |
npm run generate | Convert all TypeScript files to markdown |
npm run generate:single | Convert a single file |
npm run watch:md | Watch markdown files for changes |
Development Workflow
-
Frontend Development:
cd frontend npm run dev
- Runs on
http://localhost:3000
- Hot reload enabled
- TypeScript type checking
- Runs on
-
MCP Server Development:
cd mcp npm run dev
- Uses
tsx
for TypeScript execution - Auto-restart on file changes
- Uses
-
Markdown Content Development:
# Watch for markdown changes npm run watch:md # Generate all markdown files npm run generate
š Markdown Support & Formatting
MDMCP supports rich markdown formatting with advanced features:
Standard Markdown
- Headers:
# H1
,## H2
,### H3
, etc. - Emphasis:
*italic*
,**bold**
,***bold italic***
- Lists: Ordered (
1.
) and unordered (-
,*
) - Links:
[text](route_id)
- Images:

- Code:
`inline`
andcode blocks
- Blockquotes:
> quote
- Tables: GitHub Flavored Markdown tables
- Horizontal Rules:
---
Extended Features
GitHub Flavored Markdown (GFM)
- Strikethrough:
~~deleted text~~
- Task Lists:
- [x] completed
/- [ ] todo
- Tables with alignment
- Automatic route_id linking
- Line breaks: Respected without requiring double spaces
MDX Support
- React Components: Embed React components in markdown
- JSX: Use JSX syntax within markdown
- Imports: Import and use components
Code Syntax Highlighting
Supports syntax highlighting for:
- JavaScript/TypeScript
- HTML/CSS
- JSON
- Bash/Shell
- Python
- And many more languages
Template Variables
Dynamic content with template variables:
Hello {{name}}, welcome to {{project}}!
Converted to TypeScript functions:
export function template({name, project}: {name: string, project: string}): string {
return `Hello ${name}, welcome to ${project}!`;
}
Markdown Conversion System
The project includes a sophisticated markdown ā TypeScript conversion system:
TypeScript to Markdown
- Extracts template literals from TypeScript exports
- Handles escaped backticks properly
- Maintains formatting and structure
Markdown to TypeScript
- Converts markdown to TypeScript template functions
- Automatically detects template variables (
{{variable}}
) - Generates type-safe functions for templated content
- Creates constant exports for static content
Usage Examples
Convert markdown to TypeScript:
npm run generate:single -- path/to/file.md
Convert TypeScript to markdown:
npm run generate:single -- path/to/file.ts
Batch conversion:
npm run generate
š Production
Building for Production
# Build everything
npm run build
# Or build individually
npm run build:frontend
npm run build:mcp
Production Deployment
-
Frontend (Next.js):
npm run start:frontend
-
MCP Server:
npm run start:mcp
-
Using built binaries:
# After npm pack and install mdmcp-frontend mdmcp-server
š§© Technology Stack
Frontend Technologies
- Next.js 15 - React framework with App Router
- React 18 - UI library with latest features
- TypeScript 5+ - Type safety and developer experience
- Tailwind CSS - Utility-first CSS framework
- Radix UI - Unstyled, accessible UI components
- MDX - Markdown with JSX support
- React Markdown - Markdown rendering with custom components
- Remark GFM - GitHub Flavored Markdown support
- Lucide React - Icon library
Backend Technologies
- Model Context Protocol SDK - MCP server implementation
- Express.js 5 - Web application framework
- TypeScript - Type-safe server development
- Zod - Runtime type validation
- Node.js 18+ - JavaScript runtime
Development Tools
- tsx - TypeScript execution for Node.js
- Concurrently - Run multiple commands simultaneously
- Chokidar - File watching for development
- ESLint - Code linting
- Autoprefixer - CSS vendor prefixing
š§ Configuration
Environment Variables
Create .env.local
in the frontend directory:
# Add your environment variables here
NEXT_PUBLIC_API_URL=http://localhost:8080
TypeScript Configuration
The project uses a monorepo TypeScript setup with:
- Root
tsconfig.json
for shared configuration - Frontend-specific TypeScript configuration
- MCP server-specific TypeScript configuration
Tailwind CSS
Fully configured with:
- Custom color scheme
- Responsive design utilities
- Component variants
- Animation support
š¤ Contributing
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature
- Make your changes
- Run tests:
npm test
- Commit your changes:
git commit -m 'Add amazing feature'
- Push to the branch:
git push origin feature/amazing-feature
- Open a Pull Request
š License
MIT License - see LICENSE file for details
š Support
- Issues: Report bugs and request features on GitHub Issues
- Documentation: Comprehensive docs available in the codebase
- Community: Join discussions in GitHub Discussions
Built with ā¤ļø using Next.js, TypeScript, and the Model Context Protocol