Markitdown MCP Server

Markitdown MCP Server

Converts various file formats (PDF, Word, PowerPoint, Excel, images, audio, HTML, CSV, JSON, XML, ZIP, EPubs) to Markdown for use with Large Language Models. Deployed as a pay-per-event Apify Actor with Streamable HTTP transport.

Category
访问服务器

README

Markitdown MCP Server Actor

Apify MCP

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:

  1. Connects to the Markitdown MCP server via STDIO transport
  2. Exposes a Streamable HTTP endpoint at /mcp
  3. Forwards MCP requests/responses between clients and the Markitdown server
  4. 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:// and https:// - Remote files
    • file:// - Local files
    • data: - Data URIs

Example:

{
  "uri": "https://example.com/document.pdf"
}

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):

{
  "mcpServers": {
    "markitdown-mcp-server": {
      "type": "http",
      "url": "https://YOUR_ACTOR_URL/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_APIFY_TOKEN"
      }
    }
  }
}

3. Use the Tool

Once configured, you can use the convert_to_markdown tool in your MCP client:

Convert this PDF to markdown: https://example.com/document.pdf

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

  1. Clone the repository:
git clone https://github.com/Yash-Kavaiya/Markitdown-MCP-actor.git
cd Markitdown-MCP-actor
  1. Install dependencies:
poetry install
  1. Run the Actor locally:
poetry run python -m src

Running in Standby Mode

To run the Actor in standby mode (required for MCP server operation):

export APIFY_META_ORIGIN=STANDBY
export ACTOR_STANDBY_URL=http://localhost:5001
poetry run python -m src

The MCP endpoint will be available at: http://localhost:5001/mcp

Project Structure

Markitdown-MCP-actor/
├── .actor/                 # Apify Actor configuration
│   ├── actor.json          # Actor metadata and settings
│   ├── pay_per_event.json  # Pricing configuration
│   ├── Dockerfile          # Docker image definition
│   └── .actorignore        # Files to exclude from build
├── src/                    # Source code
│   ├── __init__.py         # Package initialization
│   ├── __main__.py         # Main entry point
│   ├── const.py            # Constants and configuration
│   ├── models.py           # Data models
│   ├── server.py           # ProxyServer implementation
│   ├── mcp_gateway.py      # MCP gateway logic
│   └── event_store.py      # Event store for session management
├── pyproject.toml          # Python dependencies and settings
├── .gitignore              # Git ignore rules
└── README.md               # This file

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:

TOOL_WHITELIST = {
    'convert_to_markdown': ('CONVERT_TO_MARKDOWN', 1),
}

You can add more tools if the underlying Markitdown MCP server exposes them.

Architecture

The Actor implements a proxy architecture:

MCP Client (VS Code, Claude, etc.)
    ↓ (Streamable HTTP)
Proxy Server (This Actor)
    ↓ (STDIO)
Markitdown MCP Server
    ↓
Markitdown Library

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:

Acknowledgments

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选