MarkItDown MCP Server
A Model Context Protocol (MCP) server for converting various content formats to Markdown using Microsoft's MarkItDown library.
Features
- Convert HTML, PDF, DOCX, PPTX, XLSX, CSV, and plain text to Markdown
- Extract plain text from various formats
- HTTP/SSE endpoints for integration with n8n and other tools
- Docker support for easy deployment
- Coolify-ready configuration
Quick Start
Using Docker
- Clone this repository:```bash
git clone <your-repo-url>
cd markitdown-mcp
2. Build and run with Docker:```bash
docker build -t markitdown-mcp .
docker run -p 3001:3001 markitdown-mcp
Using Docker Compose```bash
docker-compose up -d
## Coolify Deployment
1. In Coolify, create a new project
2. Choose "Docker Compose" as the source
3. Use this repository as the source
4. Update the domain in `coolify.yml` to match your domain
5. Deploy the service
**Important**: Make sure to disable gzip compression for the `/mcp` path in Coolify settings to ensure SSE connections work properly.
## API Endpoints
### Health Check```
GET /health
Convert to Markdown```
POST /api/convert
Content-Type: application/json
{
"content": "<h1>Hello World</h1>",
"format": "html"
}
### Extract Text```
POST /api/extract
Content-Type: application/json
{
"content": "<h1>Hello World</h1>",
"format": "html"
}
MCP SSE Endpoint```
GET /mcp/{clientId}/sse
## n8n Integration
1. In n8n, add an "MCP Client" node
2. Set the SSE Endpoint to: `http://your-domain.com/mcp/n8n-client/sse`
3. The server will provide two tools:
- `convert_to_markdown`: Convert content to Markdown
- `extract_text`: Extract plain text from content
## Supported Formats
- HTML
- PDF
- DOCX (Microsoft Word)
- PPTX (Microsoft PowerPoint)
- XLSX (Microsoft Excel)
- CSV
- Plain Text
## Environment Variables
- `NODE_ENV`: Environment (default: production)
- `PORT`: Server port (default: 3001)
- `MCP_SERVER_NAME`: MCP server name (default: markitdown-mcp)
- `DEBUG`: Enable debug logging (default: false)
## Development
1. Install dependencies:```bash
npm install
- Run in development mode:```bash
npm run dev
3. Build for production:```bash
npm run build
npm start
License
MIT License - see LICENSE file for details.
