Dealing with paperwork is now not nearly opening information in your AI initiatives, it’s about remodeling chaos into readability. Docs akin to PDFs, PowerPoints, and Phrase flood our workflows in each form and dimension. Retrieving structured content material from these paperwork has change into an enormous activity immediately. Markitdown MCP (Markdown Conversion Protocol) from Microsoft simplifies this. It converts numerous information into structured Markdown format. This helps builders and technical writers enhance documentation workflows. This text explains Markitdown MCP and reveals its utilization. We’ll cowl organising the Markitdown MCP server and also will focus on MarkItDown within the context of this protocol. Utilizing the Markitdown mcp server for testing can also be coated beneath.
What’s MarkItDown MCP?
Markitdown MCP provides an ordinary methodology for doc conversion. It acts as a server-side protocol. It makes use of Microsoft’s MarkItdown library within the backend. The server hosts a RESTful API. Customers ship paperwork like PDFs or Phrase information to this server. The server then processes these information. It makes use of superior parsing and particular formatting guidelines. The output is Markdown textual content that retains the unique doc construction.
Key Options of Markitdown MCP
The Markitdown MCP server consists of a number of helpful options:
- Extensive Format Help: It converts widespread information like PDF, DOCX, and PPTX to Markdown.
- Construction Preservation: It makes use of strategies to grasp and keep doc layouts like headings and lists.
- Configurable Output: Customers can regulate settings to regulate the ultimate Markdown fashion.
- Server Operation: It runs as a server course of. This enables integration into automated methods and cloud setups.
The Position of Markdown in Workflows
Markdown is a well-liked format for documentation. Its easy syntax makes it straightforward to learn and write. Many platforms like GitHub help it properly. Static website turbines usually use it. Changing different codecs to Markdown manually takes time. Markitdown MCP automates this conversion. This offers clear advantages:
- Environment friendly Content material Dealing with: Rework supply paperwork into usable Markdown.
- Constant Collaboration: Customary format helps groups work collectively on paperwork.
- Course of Automation: Embrace doc conversion inside bigger automated workflows.
Setting Up the Markitdown MCP Server for Integration
We will arrange the Markitdown MCP server with totally different purchasers like Claude, Windsurf, Cursor utilizing Docker Picture as talked about within the Github Repo. However right here we might be creating a neighborhood MCP consumer utilizing LangChain’s MCP Adaptors. We want a operating the server to make use of it with LangChain. The server helps totally different operating modes.
Set up
First, set up the required Python packages.
pip set up markitdown-mcp langchain langchain_mcp_adapters langgraph langchain_groq
Server Configuration
Run the Markitdown MCP server utilizing STDIO mode. This mode connects customary enter and output streams. It really works properly for script-based integration. Instantly run the next within the terminal.
markitdown-mcp
The server will begin operating with some warnings.
We will additionally use SSE (Server-Despatched Occasions) mode. This mode fits net purposes or long-running connections. It is usually helpful when organising a Markitdown MCP server for testing particular situations.
markitdown-mcp --sse --host 127.0.0.1 --port 3001
Choose the mode that matches your integration plan. Utilizing the the server for testing domestically through STDIO is commonly a great begin. We advocate utilizing STDIO mode for this text.
Markdown Conversion with Markitdown MCP
We now have already coated construct an MCP server and consumer setup domestically utilizing LangChain in our earlier weblog MCP Consumer Server Utilizing LangChain.
Now, this part reveals use LangChain with the Markitdown MCP server. It automates the conversion of a PDF file to Markdown. The instance employs Groq’s LLaMA mannequin by way of ChatGroq. Ensure that to arrange the Groq API key as an atmosphere variable or cross it on to ChatGroq.
Step 1: Import the required libraries first.
from mcp import ClientSession, StdioServerParameters
from mcp.consumer.stdio import stdio_client
from langchain_mcp_adapters.instruments import load_mcp_tools
from langgraph.prebuilt import create_react_agent
import asyncio
from langchain_groq import ChatGroq
Step 2: Initialize the Groq LLM, it’s freed from value. You will discover the API key right here
Right here’s the Groq API Key: Groq API Key
# Initialize Groq mannequin
mannequin = ChatGroq(mannequin="meta-llama/llama-4-scout-17b-16e-instruct", api_key="YOUR_API_KEY")
Step 3: Configure the MCP server
We’re utilizing StdioServerParameters, and immediately utilizing the put in Markitdown MCP package deal right here
server_params = StdioServerParameters(
command="markitdown-mcp",
args=[] # No extra arguments wanted for STDIO mode
)
Step 4: Now, outline the Asynchronous perform
This may take the PDF path because the enter, ClientSession begins communication. load_mcp_tools offers features for LangChain interplay with Markitdown MCP. Then a ReAct agent is created, It makes use of the mannequin and the MCP instruments. The code creates a file_uri for the PDF and sends a immediate asking the agent to transform the file utilizing MCP.
async def run_conversion(pdf_path: str):
async with stdio_client(server_params) as (learn, write):
async with ClientSession(learn, write) as session:
await session.initialize()
print("MCP Session Initialized.")
# Load accessible instruments
instruments = await load_mcp_tools(session)
print(f"Loaded Instruments: {[tool.name for tool in tools]}")
# Create ReAct agent
agent = create_react_agent(mannequin, instruments)
print("ReAct Agent Created.")
# Put together file URI (convert native path to file:// URI)
file_uri = f"file://{pdf_path}"
# Invoke agent with conversion request
response = await agent.ainvoke({
"messages": [("user", f"Convert {file_uri} to markdown using Markitdown MCP just return the output from MCP server")]
})
# Return the final message content material
return response["messages"][-1].content material
Step 5: This code calls the run_conversion perform
We’re calling and extracting Markdown from the response. It saves the content material to pdf.md, and eventually prints the output within the terminal.
if __name__ == "__main__":
pdf_path = "/dwelling/harsh/Downloads/LLM Analysis.pptx.pdf" # Use absolute path
outcome = asyncio.run(run_conversion(pdf_path))
with open("pdf.md", 'w') as f:
f.write(outcome)
print("nMarkdown Conversion Consequence:")
print(outcome)
Output

Full Code
from mcp import ClientSession, StdioServerParameters
from mcp.consumer.stdio import stdio_client
from langchain_mcp_adapters.instruments import load_mcp_tools
from langgraph.prebuilt import create_react_agent
import asyncio
from langchain_groq import ChatGroq
# Initialize Groq mannequin
mannequin = ChatGroq(mannequin="meta-llama/llama-4-scout-17b-16e-instruct", api_key="")
# Configure MCP server
server_params = StdioServerParameters(
command="markitdown-mcp",
args=[] # No extra arguments wanted for STDIO mode
)
async def run_conversion(pdf_path: str):
async with stdio_client(server_params) as (learn, write):
async with ClientSession(learn, write) as session:
await session.initialize()
print("MCP Session Initialized.")
# Load accessible instruments
instruments = await load_mcp_tools(session)
print(f"Loaded Instruments: {[tool.name for tool in tools]}")
# Create ReAct agent
agent = create_react_agent(mannequin, instruments)
print("ReAct Agent Created.")
# Put together file URI (convert native path to file:// URI)
file_uri = f"file://{pdf_path}"
# Invoke agent with conversion request
response = await agent.ainvoke({
"messages": [("user", f"Convert {file_uri} to markdown using Markitdown MCP just retrun the output from MCP server")]
})
# Return the final message content material
return response["messages"][-1].content material
if __name__ == "__main__":
pdf_path = "/dwelling/harsh/Downloads/LLM Analysis.pdf" # Use absolute path
outcome = asyncio.run(run_conversion(pdf_path))
with open("pdf.md", 'w') as f:
f.write(outcome)
print("nMarkdown Conversion Consequence:")
print(outcome)
Analyzing the Output
The script generates a pdf.md file. This file holds the Markdown model of the enter PDF. The conversion high quality is dependent upon the unique doc’s construction. Markitdown MCP often preserves components like:
- Headings (numerous ranges)
- Paragraph textual content
- Lists (bulleted and numbered)
- Tables (transformed to Markdown syntax)
- Code blocks
Output

Right here within the output, we are able to see that it efficiently retrieved the headings, contents, in addition to regular textual content in markdown format.
Therefore, operating a neighborhood server for testing helps consider totally different doc sorts.
Additionally watch:
Sensible Use Instances in LLM Pipelines
Integrating Markitdown MCP can enhance a number of AI workflows:
- Information Base Constructing: Convert paperwork into Markdown. Ingest this content material into information bases or RAG methods.
- LLM Content material Preparation: Rework supply information into Markdown. Put together constant enter for LLM summarization or evaluation duties.
- Doc Information Extraction: Convert paperwork with tables into Markdown. This simplifies parsing structured information.
- Documentation Automation: Generate technical manuals. Convert supply information like Phrase paperwork into Markdown for static website turbines.
Conclusion
Markitdown MCP offers a succesful, server-based methodology for doc conversion. It handles a number of codecs. It produces structured Markdown output. Integrating it with LLMs permits automation of doc processing duties. This method helps scalable documentation practices. Utilizing the the server for testing makes analysis simple. MarkItDown’s MCP is greatest understood by way of its sensible software in these workflows.
Discover the Markitdown MCP GitHub repository for extra info.
Steadily Requested Questions
Ans. Markitdown MCP converts paperwork like PDFs and Phrase information into structured Markdown. It makes use of a server-based protocol for this activity.
Ans. The server handles PDF, DOCX, PPTX, and HTML information. Different codecs could also be supported relying on the core library.
Ans. LangChain makes use of particular instruments to speak with the server. Brokers can then request doc conversions by way of this server.
Ans. Sure, it’s open-source software program from Microsoft. Customers are chargeable for any server internet hosting prices.
Ans. Sure, the server for testing can run domestically. Use both STDIO or SSE mode for growth and analysis.
Login to proceed studying and luxuriate in expert-curated content material.
