- Home
- MCP servers
- glm-ocr
glm-ocr
- python
0
GitHub Stars
python
Language
4 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"cs-qyzhang-glm-ocr-mcp": {
"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"
}
}
}
}You can run the GLM OCR MCP Server to extract text from images and PDFs using ZhipuAI GLM-OCR. This MCP exposes a single local server that you control via the MCP client, enabling you to send files or URLs and receive extracted text and optional structured layout data.
How to use
To use this MCP server, add it to your MCP client as a local or service-based endpoint. You can operate it from code or through your MCP management tooling, sending image or PDF inputs to extract text. The server supports returning either Markdown text by default or structured JSON with page layout details when requested.
How to install
Prerequisites: you should have Python installed and optionally a virtual environment tool. You will also need access to the UVX runtime as shown in the configuration.
# Create a virtual environment
uv venv
source .venv/bin/activate
# Sync dependencies and install current project
uv sync
# Run the MCP server for testing
python -m glm_ocr_mcp.server
Additional sections
Configuration comes from the MCP setup you use in your client. The server requires two environment variables to connect to ZHIPU AI services. The following config demonstrates running the MCP with the required variables and the command to start the local server.
{
"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"
}
}
}
}
Notes and usage tips
- The server exposes a single tool named extract_text that accepts a local file path, a URL, or a base64 data payload. It can process PNG, JPG/JPEG, and PDF inputs. By default, it returns Markdown text; you can request structured JSON by setting return_json to true.
Available tools
extract_text
Extract text from a local file or URL. Supports png, jpg/jpeg, and pdf inputs. By default returns Markdown text; set return_json=true to obtain structured JSON with page layout details such as bbox_2d, content, label, and more.