mcp_poc

mcp_poc

A PDF-to-Markdown converter built with the Model-View-Controller (MVC) pattern using the Model Context Protocol (MCP).

Category
Visit Server

README

mcp_poc

A PDF-to-Markdown converter built with the Model-View-Controller (MVC) pattern using the Model Context Protocol (MCP).

Architecture

The project follows a clean separation of concerns across three layers, connected via MCP's stdio transport.

flowchart TB
    subgraph Client["Client Layer"]
        C[mcp_client.py<br/>Stdio Client Connector]
    end

    subgraph Server["Server Layer (Controller)"]
        S[mcp_server.py<br/>FastMCP Server]
        T[convert_pdf Tool]
        P[summarize_markdown Prompt]
    end

    subgraph Model["Model Layer"]
        M[PyMuPDF / fitz<br/>PDF Text Extraction]
    end

    subgraph View["View Layer"]
        V[Markdown Formatter<br/>## Page N]
    end

    C -->|stdio JSON-RPC| S
    S --> T
    T --> M
    M --> V
    V --> T
    T --> S
    S -->|Tool Result| C

File Responsibilities

File Role Description
mcp_server.py Controller Exposes convert_pdf as an MCP tool and summarize_markdown as a prompt. Orchestrates Model and View logic.
mcp_client.py Connector Manages the stdio client session used to call the server's tools from external processes or LLMs.
main.py Entry Point Can run the server in stdio mode (--server) or execute direct local conversions for testing.
test_integration.py Test End-to-end integration test that launches the server via stdio and verifies tool execution.

Quick Start

1. Install Dependencies

python -m venv venv
# Windows
.\venv\Scripts\pip install -r requirements.txt
# macOS / Linux
source venv/bin/activate && pip install -r requirements.txt

2. Run a Direct Conversion (Local Test)

.\venv\Scripts\python main.py data/sample.pdf

3. Run the MCP Server (for Claude / IDE integration)

.\venv\Scripts\python main.py --server

4. Run Integration Test (Client → Server)

.\venv\Scripts\python test_integration.py

Project Structure

mcp_poc/
├── .env                      # Environment configuration
├── .gitignore                # Git ignore rules
├── README.md                 # This file
├── main.py                   # Application entry point
├── mcp_client.py             # MCP stdio client connector
├── mcp_server.py             # MCP server with tools & prompts
├── requirements.txt          # Python dependencies
├── test_integration.py       # Integration test
└── data/
    └── sample.pdf            # Test PDF

How It Works

  1. Client (mcp_client.py) spawns the server as a subprocess and communicates over stdio.
  2. Server (mcp_server.py) receives a convert_pdf tool call.
  3. Model (fitz / PyMuPDF) opens the PDF and extracts raw text page by page.
  4. View formats the extracted text as Markdown with ## Page N headers.
  5. The formatted Markdown is returned to the client via the MCP protocol.

Extending

  • OCR Support: Swap the Model layer to use marker-pdf or an external OCR API for scanned documents.
  • Additional Tools: Add more @mcp.tool() definitions in mcp_server.py for image extraction, metadata parsing, etc.
  • Alternative Transports: Replace stdio with sse or http in mcp.run(...) for remote deployments.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured