SwissDocAI MCP server
Use SwissDocAI from Claude, Cursor, Codex or any other MCP client.
It runs on your computer as a local MCP server (stdio). You give the AI a file path. The
server reads the file itself and sends it to the SwissDocAI API (https://ocr.swissdocai.ch).
The AI never has to copy the document into the conversation.
| Tool | What it does | API |
|---|---|---|
process_document |
OCR, classification into your workspace's labels and extraction of the label's fields. Optionally splits a PDF of several documents and writes each one as its own PDF. | POST /v1/upload with async=true, GET /v1/jobs/{job_id} |
ocr_document |
The text of a document as Markdown, with page markers and tables. | POST /v1/ocr |
analyze_layout |
Words, lines, paragraphs, tables and checkboxes with their boxes, in the shape of Azure AI Document Intelligence's prebuilt-layout. It writes the result to <name>.layout.json (beta). |
POST /v1/layout; from 11 pages, or while many requests are waiting, POST /v1/layout/jobs |
redact_document |
Finds personal data and writes a redacted PDF, <name>.redacted.pdf, next to the source (beta). |
POST /v1/redact with render=true, GET /v1/redact/{job_id} |
Every tool takes PDF, PNG and JPEG files. Each page processed costs one page of your quota, the same as a direct API call.
Where your data goes
SwissDocAI processes your documents in Switzerland. But this server hands the results (text, extracted fields, labels) back to your AI client. From there they go to the client's provider, for example Anthropic, Cursor or OpenAI, which may process them outside Switzerland. You decide whether that is allowed for your documents.
To keep a document's content on your computer, pass output_path. The server then writes
the full result to that local file and sends only a short summary back to the AI: label,
confidence and page count, no text or fields. analyze_layout and redact_document always
write their results to a file. By default redact_document also leaves out the values it
found (include_values=false), because those values are the personal data being removed.
The file name is only sent along with rename=true, which needs it for the suggested file
name. Otherwise the document goes out as document.pdf. The server logs nothing: no
contents, texts, values or file names.
Setup
You need:
- An API token from the console (API-Tokens). Processing also needs labels; you create them in the console.
- uv, which provides
uvx.
uvx swissdocai-mcp downloads the server and starts it. You never start it yourself: the
AI client does that. Replace sd_... with your token in the examples below.
Claude Code
claude mcp add --env SWISSDOCAI_API_TOKEN=sd_... --transport stdio swissdocai -- uvx swissdocai-mcp
Add --scope project to share the server with your team through .mcp.json. Then use
${SWISSDOCAI_API_TOKEN} instead of the token itself, so the token stays out of the
repository:
{
"mcpServers": {
"swissdocai": {
"command": "uvx",
"args": ["swissdocai-mcp"],
"env": { "SWISSDOCAI_API_TOKEN": "${SWISSDOCAI_API_TOKEN}" }
}
}
}
Claude Desktop
Quit Claude Desktop completely. Then edit claude_desktop_config.json:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"swissdocai": {
"command": "uvx",
"args": ["swissdocai-mcp"],
"env": { "SWISSDOCAI_API_TOKEN": "sd_..." }
}
}
}
Cursor
In ~/.cursor/mcp.json (all projects) or .cursor/mcp.json (one project):
{
"mcpServers": {
"swissdocai": {
"command": "uvx",
"args": ["swissdocai-mcp"],
"env": { "SWISSDOCAI_API_TOKEN": "sd_..." }
}
}
}
Codex
codex mcp add swissdocai --env SWISSDOCAI_API_TOKEN=sd_... -- uvx swissdocai-mcp
Or in ~/.codex/config.toml. Codex stops a tool after 60 seconds by default, which is too
short for redaction and for long documents, so raise tool_timeout_sec. The first start
downloads the server, so give it more time as well:
[mcp_servers.swissdocai]
command = "uvx"
args = ["swissdocai-mcp"]
startup_timeout_sec = 60
tool_timeout_sec = 1800
[mcp_servers.swissdocai.env]
SWISSDOCAI_API_TOKEN = "sd_..."
Examples
- "Process
~/Scans/invoice-0425.pdfwith SwissDocAI and give me the total and the IBAN." - "Split
C:\Inbox\batch.pdfinto its documents and save each one as its own PDF." - "Redact
report.pdfand keep the clinic's name and address readable." - "Run OCR on
contract.pdfand save the text tocontract.md; don't show me the text."
Settings
| Environment variable | Default | Meaning |
|---|---|---|
SWISSDOCAI_API_TOKEN |
(required) | API token from the console |
SWISSDOCAI_BASE_URL |
https://ocr.swissdocai.ch |
Another endpoint, e.g. an on-premises installation |
SWISSDOCAI_JOB_TIMEOUT_SECONDS |
1800 |
How long a tool waits for a job (processing, layout, redaction) |
SWISSDOCAI_POLL_INTERVAL_SECONDS |
2 |
How often a running job is checked |
Relative paths are resolved against the server's working directory, which depends on the client. Absolute paths always work.
Files the server writes
- Never the source file, and never over an existing file it chose itself: if the name is
taken, it writes
name (2).ext. Only a file you name inoutput_pathis overwritten. analyze_layout:<name>.layout.jsonnext to the source.redact_document:<name>.redacted.pdf, or withrender=falsethe findings with their boxes as<name>.redaction.json.process_documentwithsave_split_pdfs=true:<name>_01_p1-2.pdf,<name>_02_p3-3.pdfand so on.
Redaction is automatic: check the redacted PDF before you pass it on. The summary tells you
how many values could not be located on the page (values_not_located), and whether the
redacted pages, when read again, still show a value (verification).
Errors
API errors come back as tool errors that say what to do: an invalid token (401), no active plan (402), a read-only team (403), a document too large (413), quota or rate limit reached (429, with the time to retry), or a busy service (503, nothing charged, try again shortly).
Development
uv sync
uv run pytest
uv run ruff check .
uv run swissdocai-mcp # waits for an MCP client on stdin
The tests replace the network with a mock (httpx.MockTransport) and never call the API.
To run your local checkout in a client, use uv run --directory /path/to/mcp-server swissdocai-mcp
as the command instead of uvx swissdocai-mcp.
License
Apache License 2.0, full text in the LICENSE file
that ships with the package. Copyright 2026 SwissDocAI.
The license covers this client only. The SwissDocAI service it calls is not part of the package and is used under the SwissDocAI terms of service (https://swissdocai.ch/agb).
Metadata
Release files for swissdocai-mcp 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| swissdocai_mcp-0.1.0.tar.gz | 23.7 kB | Without provenance | Details for swissdocai_mcp-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| swissdocai_mcp-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for swissdocai_mcp-0.1.0-py3-none-any.whl |
Total release size: 43.5 kB
Release files / swissdocai_mcp-0.1.0.tar.gz
| Download URL | swissdocai_mcp-0.1.0.tar.gz |
|---|---|
| Size | 23.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
88daccad9768b32e021362dead71acf9b8f79ae6b7e47f3e29e7d075d15cc9e5
|
|
BLAKE2b-256 checksum How to use checksums |
5aef5f6f8b0dc1a068e1eef2308eafe270dc952fab20212fc28ee4101251b9af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / swissdocai_mcp-0.1.0-py3-none-any.whl
| Download URL | swissdocai_mcp-0.1.0-py3-none-any.whl |
|---|---|
| Size | 19.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
92cf691d41254958004ec0b803b06924f1ff96eabc581c2f87b6980d91d4df7b
|
|
BLAKE2b-256 checksum How to use checksums |
60d276c96349821810f7fba4cb04506cb7ea13b9557ae6a85cd0ae67ebf38295
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for swissdocai-mcp 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.