Markitdown MCP Server Actor
An Apify Actor that provides a Model Context Protocol (MCP) server for Markitdown, Microsoft's lightweight Python utility for converting various file formats to Markdown.
Overview
This Actor wraps the Markitdown MCP server as an Apify Actor, making it easy to deploy and use as a pay-per-event service. Markitdown converts various file formats to Markdown, making them suitable for use with Large Language Models (LLMs) and text analysis pipelines.
Supported File Formats
Documents: PDF, PowerPoint, Word, Excel
Media: Images (with EXIF metadata and OCR), Audio (with transcription)
Web Content: HTML, YouTube URLs
Data Formats: CSV, JSON, XML
Archives: ZIP files, EPubs
Features
MCP Protocol: Implements the Model Context Protocol for seamless integration with MCP clients
Streamable HTTP Transport: Uses modern Streamable HTTP transport for efficient communication
Pay-per-Event: Charges only for actual tool usage via Apify's pay-per-event system
Session Management: Automatic session timeout and cleanup after inactivity
Standby Mode: Runs in Apify's standby mode for instant availability
How It Works
The Actor runs a proxy server that:
Connects to the Markitdown MCP server via STDIO transport
Exposes a Streamable HTTP endpoint at
/mcpForwards MCP requests/responses between clients and the Markitdown server
Charges for tool usage via Apify's pay-per-event system
Available Tools
convert_to_markdown
Converts various file formats to Markdown.
Parameters:
uri(string): The URI of the file to convert. Supports:http://andhttps://- Remote filesfile://- Local filesdata:- Data URIs
Example:
Usage
1. Deploy the Actor
Deploy this Actor to Apify or run it locally in standby mode.
2. Configure Your MCP Client
Add the following configuration to your MCP client (e.g., VS Code, Claude Desktop):
3. Use the Tool
Once configured, you can use the convert_to_markdown tool in your MCP client:
Environment Variables
SESSION_TIMEOUT_SECS(default: 300): Session timeout in seconds before terminating idle sessions
Pricing
The Actor uses Apify's pay-per-event system with the following rates (configurable in .actor/pay_per_event.json):
CONVERT_TO_MARKDOWN: $0.01 per conversion
TOOL_LIST: $0.0001 per listing
RESOURCE_LIST: $0.0001 per listing
RESOURCE_READ: $0.001 per read
PROMPT_LIST: $0.0001 per listing
PROMPT_GET: $0.001 per get
Local Development
Prerequisites
Python 3.10 or higher
Poetry for dependency management
Docker (optional, for containerized development)
Installation
Clone the repository:
Install dependencies:
Run the Actor locally:
Running in Standby Mode
To run the Actor in standby mode (required for MCP server operation):
The MCP endpoint will be available at: http://localhost:5001/mcp
Project Structure
Customization
Charging Strategy
You can customize the charging strategy by editing .actor/pay_per_event.json. The default configuration charges:
$0.01 per conversion (main operation)
Minimal charges for metadata operations (listing tools, resources, prompts)
Session Timeout
Adjust the SESSION_TIMEOUT_SECS environment variable to control how long sessions remain active during inactivity. The default is 300 seconds (5 minutes).
Tool Whitelist
The Actor uses a tool whitelist defined in src/const.py:
You can add more tools if the underlying Markitdown MCP server exposes them.
Architecture
The Actor implements a proxy architecture:
Key components:
ProxyServer: Manages HTTP server and session lifecycle
MCP Gateway: Proxies MCP requests and handles charging
Event Store: Maintains session history for resumability
Session Manager: Handles Streamable HTTP transport
Related Links
License
Apache-2.0
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Support
For issues and questions:
Open an issue on GitHub
Contact via Apify Console
Acknowledgments
Microsoft Markitdown - The underlying conversion tool
Apify - Actor platform and infrastructure
MCP Proxy - Inspiration for the proxy implementation