MCP server for high-accuracy scientific PDF OCR using Meta's Nougat
Project description
Nougat-MCP
nougat-mcp is a Model Context Protocol (MCP) server for high-fidelity OCR of scientific PDFs using Meta's Nougat.
It is designed for agent workflows where you need equations, tables, and structure preserved better than traditional OCR.
Why This Server
- Scientific OCR quality tailored for papers, formulas, and dense layouts.
- MCP-native interface for Codex, Claude, Cursor, Antigravity, and other clients.
- Output-format control:
mmd: raw Nougat/Mathpix-style output.md: renderer-friendly conversion (math delimiter and KaTeX compatibility fixes).
- Settings file support so agents can read a shared default format policy.
Installation
Install from PyPI:
uv pip install nougat-mcp
This package installs nougat-ocr and pins known-sensitive dependencies for stability.
Tools
parse_research_paper
Arguments:
file_path(string): Absolute path to a local PDF.output_format(string, optional):default(default): uses server settings.mmd: raw Nougat output.md: converted markdown-friendly output.
Returns:
- OCR result as a single text string in the requested format.
get_output_settings
Returns resolved server output settings, including where settings were loaded from.
Output Conversion (mmd -> md)
When output_format="md", the server applies compatibility conversions:
\[ ... \]->$$ ... $$\( ... \)->$ ... $\tag{...}-> visible equation label\qquad\text{(...)}- KaTeX delimiter normalization, for example:
\bigl{\|} ... \bigr{\|}->\bigl\| ... \bigr\|
This avoids common renderer parse errors in markdown environments that are not fully MathJax-compatible.
Server Settings
Settings are read in this order:
NOUGAT_MCP_SETTINGS(if set)./settings.json(current working directory)
Example settings.json:
{
"nougat_mcp": {
"default_output_format": "md",
"md_rewrite_tags": true,
"md_fix_sized_delimiters": true
}
}
Agent Configuration
Codex CLI
Add to ~/.codex/config.toml:
[mcp_servers.nougat]
command = "uvx"
args = ["nougat-mcp"]
enabled = true
[mcp_servers.nougat.env]
NOUGAT_MCP_SETTINGS = "/absolute/path/to/settings.json"
Claude Desktop
Add to claude_desktop_config.json:
{
"mcpServers": {
"nougat": {
"command": "uvx",
"args": ["nougat-mcp"],
"env": {
"NOUGAT_MCP_SETTINGS": "/absolute/path/to/settings.json"
}
}
}
}
Antigravity / Gemini Desktop
Add to ~/.gemini/settings.json:
{
"mcpServers": {
"nougat": {
"type": "stdio",
"command": "uvx",
"args": ["nougat-mcp"],
"env": {
"NOUGAT_MCP_SETTINGS": "/absolute/path/to/settings.json"
}
}
}
}
Cursor
In Cursor MCP settings, add:
{
"mcpServers": {
"nougat": {
"command": "uvx",
"args": ["nougat-mcp"],
"env": {
"NOUGAT_MCP_SETTINGS": "/absolute/path/to/settings.json"
}
}
}
}
Note: Cursor MCP config location can vary by version/platform; use the MCP settings UI or your current JSON settings file.
Showcase (Real Page Example)
A real extraction from page 5 of src/2405.08770v1.pdf is included:
- Input PDF page: showcase/2405.08770v1_page5.pdf
- Raw
mmdoutput: showcase/2405.08770v1_page5.mmd - Converted
mdoutput: showcase/2405.08770v1_page5.md
Quick comparison:
# mmd
\[DV=V_{x}. \tag{3.2}\]
# md
$$
DV=V_{x}. \qquad\text{(3.2)}
$$
Performance Notes
- First run may download model weights (~1.4 GB).
- CPU inference is significantly slower than GPU inference.
- Use page subsets whenever possible to reduce runtime.
Release to PyPI
This repository includes automated publishing via GitHub Actions: .github/workflows/publish-pypi.yml.
One-time setup (recommended)
- Create the
nougat-mcpproject on PyPI. - In PyPI project settings, configure a Trusted Publisher:
- Owner:
svretina - Repository:
nougat-mcp - Workflow:
publish-pypi.yml - Environment:
pypi
- Owner:
- In GitHub, ensure Actions are enabled for the repo.
Release flow
- Bump
versioninpyproject.toml. - Commit and push to
master. - Create and push a version tag:
git tag v0.1.0
git push origin v0.1.0
- The workflow builds, validates (
twine check), and publishes to PyPI.
Compatibility Pins
To keep Nougat stable across environments, the package pins sensitive dependency ranges:
transformers>=4.35,<4.38albumentations>=1.3,<1.4pypdfium2<5.0huggingface-hub<1.0fsspec<=2025.10.0
Credits
- Nougat OCR: https://github.com/facebookresearch/nougat
- Paper: https://arxiv.org/abs/2308.13418
License
GNU General Public License v3.0 (LICENSE).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nougat_mcp-0.1.0.tar.gz.
File metadata
- Download URL: nougat_mcp-0.1.0.tar.gz
- Upload date:
- Size: 1.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
46ead874878aa3d95e3fc391363434324ff399d80bfb0e5e3999f64902ee80d5
|
|
| MD5 |
20e55f37347322d9fd499e91bb4062cb
|
|
| BLAKE2b-256 |
31b3c228cfd19fdc68c549b861d076735d31d8a5fbd9f1e776a6005f87794c6d
|
Provenance
The following attestation bundles were made for nougat_mcp-0.1.0.tar.gz:
Publisher:
publish-pypi.yml on svretina/nougat-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nougat_mcp-0.1.0.tar.gz -
Subject digest:
46ead874878aa3d95e3fc391363434324ff399d80bfb0e5e3999f64902ee80d5 - Sigstore transparency entry: 970582192
- Sigstore integration time:
-
Permalink:
svretina/nougat-mcp@e439fb4aa086821538290bfd7d5ded100065828a -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/svretina
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@e439fb4aa086821538290bfd7d5ded100065828a -
Trigger Event:
push
-
Statement type:
File details
Details for the file nougat_mcp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: nougat_mcp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 33.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
55719ed64be1c4323116efb9736dd18376a14cd6fa94c8f8611409c32172b0e2
|
|
| MD5 |
4462ae0af11e6e8eb00f9c8d1743a92e
|
|
| BLAKE2b-256 |
79be254f9c6ccf3c712f5986904952563438ea8bb40f4b675d62d38b9470091e
|
Provenance
The following attestation bundles were made for nougat_mcp-0.1.0-py3-none-any.whl:
Publisher:
publish-pypi.yml on svretina/nougat-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nougat_mcp-0.1.0-py3-none-any.whl -
Subject digest:
55719ed64be1c4323116efb9736dd18376a14cd6fa94c8f8611409c32172b0e2 - Sigstore transparency entry: 970582230
- Sigstore integration time:
-
Permalink:
svretina/nougat-mcp@e439fb4aa086821538290bfd7d5ded100065828a -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/svretina
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@e439fb4aa086821538290bfd7d5ded100065828a -
Trigger Event:
push
-
Statement type: