GLM OCR MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@GLM OCR MCP Serverextract the text from document.pdf"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
GLM OCR MCP Server
MCP server for extracting text from images and PDFs using ZhipuAI GLM-OCR.
Usage
{
"mcpServers": {
"glm-ocr": {
"command": "uvx",
"args": ["glm-ocr-mcp"],
"env": {
"ZHIPU_API_KEY": "your_api_key_here",
"ZHIPU_OCR_API_URL": "https://open.bigmodel.cn/api/paas/v4/layout_parsing"
}
}
}
}Using with Claude Code
claude mcp add --scope user glm-ocr \
--env ZHIPU_API_KEY=your_api_key_here \
--env ZHIPU_OCR_API_URL=https://open.bigmodel.cn/api/paas/v4/layout_parsing \
-- uvx glm-ocr-mcpUsing with Codex
Add MCP server with command:
codex mcp add glm-ocr \
--env ZHIPU_API_KEY=your_api_key_here \
--env ZHIPU_OCR_API_URL=https://open.bigmodel.cn/api/paas/v4/layout_parsing \
-- uvx glm-ocr-mcpTools
The server provides one tool:
extract_text: Extract from local file or URL (
png,jpg/jpeg,pdf)default returns Markdown text
set
return_json=trueto return structured JSON withoutmd_results(contains page parsing details likebbox_2d,content,label, etc.)
Parameters:
file_path: Local file path or URL for
png,jpg/jpeg, orpdfbase64_data: Optional data URL/base64 payload (use when
file_pathis unavailable)start_page_id: Optional PDF start page (1-based, only effective for PDF)
end_page_id: Optional PDF end page (1-based, only effective for PDF)
return_json: Optional boolean, default
false.truereturns JSON;falsereturns Markdown.
Examples
# Extract text from local image
extract_text(file_path="./screenshot.png")
# Extract text from local PDF
extract_text(file_path="./document.pdf")
# Extract text from URL image
extract_text(file_path="https://example.com/test.jpg")
# Use base64/data URL
extract_text(base64_data="data:image/png;base64,iVBORw0KGgo...")
# Extract structured layout JSON
extract_text(file_path="https://example.com/test.png", return_json=True)Related MCP server: OCR MCP Service
Development
# Create virtual environment
uv venv
source .venv/bin/activate
# Sync dependencies and install current project
uv sync
# Run server for testing
python -m glm_ocr_mcp.serverWindows PowerShell activation:
.venv\Scripts\Activate.ps1Project Structure
glm-ocr-mcp/
├── pyproject.toml # Project configuration
├── README.md # Documentation
├── .env.example # Environment variable template
├── src/
│ └── glm_ocr_mcp/
│ ├── __init__.py
│ ├── __main__.py # Entry point
│ ├── ocr.py # OCR client
│ └── server.py # MCP serverAvailable Tools
1 toolextract_textB
Extract text from local files or URLs. Supported formats: PNG, JPG/JPEG, PDF.
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | No | Local file path or URL for PNG, JPG/JPEG, or PDF. Examples: ./test.png, C:/docs/a.pdf, https://example.com/a.jpg | |
| base64_data | No | Optional data URL or base64 payload. Use when file_path is unavailable. | |
| start_page_id | No | Optional PDF start page (1-based). Ignored for PNG/JPG inputs. | |
| end_page_id | No | Optional PDF end page (1-based). Ignored for PNG/JPG inputs. | |
| return_json | No | Optional, default false. Use only when structured layout details are needed (bbox_2d/content/label etc.), because JSON output is much longer. |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries full burden. It indicates a read-only operation (extracting text) with no destructive side effects. However, it does not disclose behaviors like whether it downloads the entire file, memory usage, or error handling. The description is adequate but minimal.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is extremely concise: two short sentences. It is front-loaded with the main action and immediately provides supported formats. No unnecessary words.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Lacks information about return format (plain text vs structured), error conditions, or performance considerations. The 'return_json' parameter hints at structured output, but the description does not explain what the tool returns, leaving the agent uncertain. Given 5 parameters and no output schema, more context is needed.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so the schema already documents all parameters with descriptions. The tool description does not add extra meaning beyond listing formats. Baseline of 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Description clearly states the tool extracts text from files or URLs, specifying supported formats (PNG, JPG/JPEG, PDF). The action verb 'extract' and resource 'text' are unambiguous. No sibling tools exist, so differentiation is not needed.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No guidance on when to use this tool versus alternatives or when not to use it. The description does not mention context like file size limits, network requirements for URLs, or that it uses OCR. The agent is left to infer usage scope.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
1 tool update
v0.1.1- First observed
extract_text
TDQS
Scored across 1 tool
Only one tool exists, so there is no possibility of confusing it with another. Its purpose is clearly described as extracting text from files or URLs.
The single tool name 'extract_text' follows a clear verb_noun pattern. With only one tool, there are no inconsistencies to assess.
A single tool serves a narrow OCR purpose, but by the rubric 1-2 tools feels thin. It is functional but borderline for a full MCP server.
The tool covers the core OCR workflow for common formats (PNG, JPG, PDF) from both local files and URLs. It lacks advanced features like batch processing or layout detection, but these are not essential for basic text extraction.
Maintenance
Related MCP Connectors
OCR and document understanding: extract text from images, then summarize or translate it.
Arabic-first OCR, translation and document extraction. First call mints a free trial key.
High-fidelity PDF to structured Markdown conversion and document field extraction.
Read PDFs and images as markdown or text, with exact costs and hard spend caps. $0.75/1k pages.
Related MCP Servers
- AlicenseCqualityDmaintenanceEnables multimodal AI capabilities through GLM-4.5V API for image processing, visual querying with OCR/QA/detection modes, and file content extraction from various formats including PDFs, documents, and images.3Apache 2.0
- AlicenseAqualityDmaintenanceEnables AI agents to recognize and extract text from images using PaddleOCR, supporting both file paths and base64 input with structured results including confidence scores and text positions.21MIT
- FlicenseNot gradedqualityDmaintenanceProvides OCR services powered by Google's Gemini API to extract text from images via file paths or base64 strings. It enables high-accuracy text recognition and CAPTCHA processing through simple MCP tools.8-
- AlicenseNot gradedqualityBmaintenanceProvides image understanding and OCR via GLM-4.6V-Flash, supporting URL, base64, and local file inputs. Enables AI assistants to analyze images and extract text from screenshots, documents, and more.18 npmMIT