MCP Integration Guide
Create a DocPurify MCP Key, copy the standard configuration, and start the MCP Server with a single `npx` command.
Status & Scope
Current status: Live. This guide focuses on setup, what is available now, and the current limits.
The DocPurify MCP Server lets MCP Hosts such as Claude Desktop, Cursor, and Codex call DocPurify document processing capabilities directly. You only need to create one MCP Key and paste the configuration below into your client.
Note
MCP can now upload local files directly withupload_document_file. Usesubmit_document_for_processingonly when you already have a DocPurifyfile_id.
MCP Host
-> DocPurify MCP stdio server
-> DocPurify service
-> Document processing jobs and results1. 5-minute quick setup
You only need two things:
| Setting | Notes |
|---|---|
npx | Installed with Node.js. It starts @docpurify/mcp-server. |
DOCPURIFY_MCP_KEY | The MCP token created on the MCP page. |
Add the Server configuration below to your MCP Host. In most cases, the only value you need to replace is DOCPURIFY_MCP_KEY.
{
"mcpServers": {
"docpurify": {
"command": "npx",
"args": ["-y", "@docpurify/mcp-server"],
"env": {
"DOCPURIFY_MCP_KEY": "dp_your_mcp_key"
}
}
}
}Save the configuration and restart the MCP Host. After initialize, the client will discover DocPurify tools through tools/list.
2. Currently supported capabilities
DocPurify currently exposes Tools only. Resources and Prompts are not available yet.
| Primitive | Status | Notes |
|---|---|---|
| Tools | Available | Query workspace state, upload local files, submit processing, poll progress, fetch results, cancel jobs, and delete terminal jobs. |
| Resources | Not available | No resources/list or URI templates are exposed. Results are returned through get_document_result. |
| Prompts | Not available | No prompts/list or built-in prompt templates are exposed. |
Typical use cases:
- Let an AI assistant inspect workspace state, credits, and recent jobs.
- Upload a local file from the MCP host and start processing in one step.
- Start processing for an already uploaded file by using its
file_id. - Poll a document job until
result_ready = true. - Fetch Markdown output and download links after processing completes.
- Cancel a job that is still queued or processing.
3. Protocol and transport
The DocPurify MCP Server uses standard MCP stdio transport. The MCP Host starts a local process and exchanges JSON-RPC messages through stdin/stdout.
| Item | Notes |
|---|---|
| Protocol version | 2025-03-26 |
| Transport | stdio |
| Capability negotiation | initialize returns the tools capability |
| Tool discovery | tools/list |
| Tool calls | tools/call |
| Credential injection | Environment variable DOCPURIFY_MCP_KEY |
| Default API base | https://api.docpurify.com |
| Distribution | npm package @docpurify/mcp-server |
| Registry name | com.docpurify/mcp-server |
| Resources / Prompts | Not available yet |
Security reminder
In stdio mode, never put the Key into prompts or tool descriptions. Pass it only through the MCP Hostenvconfiguration.
4. Create and store an API Key
MCP API Keys are managed on the MCP page in the DocPurify web console:
- Sign in to DocPurify.
- Open the
MCPpage from the main navigation. - Create an API Key.
- Save the generated Key immediately. The full Key is not shown again after you leave the page.
- Put the Key in
DOCPURIFY_MCP_KEYinside your MCP Host configuration.
Current rules:
- One account can keep only one active MCP API Key at a time.
- Rotating the Key issues a new Key immediately and revokes the old one.
- Revoking the Key causes every MCP call using that Key to fail.
- Web login is only used to manage Keys and cannot replace MCP request authentication.
5. Client configuration examples
Claude Desktop, Cursor, Codex, and other clients store MCP configuration in different files, but the core fields are always command, args, and env.
{
"mcpServers": {
"docpurify": {
"command": "npx",
"args": ["-y", "@docpurify/mcp-server"],
"env": {
"DOCPURIFY_MCP_KEY": "dp_your_mcp_key",
"DOCPURIFY_MCP_TIMEOUT_SECONDS": "30"
}
}
}
}Configuration notes:
DOCPURIFY_MCP_TIMEOUT_SECONDSis optional and defaults to 30 seconds.- If the client machine does not have Node.js, install Node.js 18 or newer first.
- Fully restart the client after saving the configuration so the MCP Server reloads environment variables.
- If your client supports “Reload MCP servers,” you can refresh the server list directly.
6. Recommended call order
For a first integration, this sequence is recommended:
- Create or confirm the current active Key in the web console.
- Start the MCP Host and confirm it can discover the
docpurifyServer. - Call
get_workspace_overviewto inspect account context, credits, and recent jobs. - If you have a local file path, call
upload_document_file. - Only use
submit_document_for_processingfor advanced workflows where a validfile_idalready exists. - Poll progress with
get_document_job. - Only call
get_document_resultwhenresult_ready = true. - To stop a job, check the current status first and then call
cancel_document_job. - To clean up data, call
delete_document_jobonly for a terminal job.
7. Tools reference
| Tool | Purpose | Parameters | Key response fields | Common errors |
|---|---|---|---|---|
get_workspace_overview | Read workspace summary | None; {} is recommended | can_start_new_job, active_jobs, recent_jobs, credit_balance, storage_summary | MCP_KEY_INVALID, MCP_KEY_REVOKED |
upload_document_file | Upload a local file and start processing | Required file_path; optional processing_options | document_job_id, file_id, status, estimated_credits, credits_locked | File read errors, upload failures |
submit_document_for_processing | Start processing for a pre-uploaded file | Required file_id; optional processing_options | document_job_id, status, estimated_credits, credits_locked | DOCUMENT_JOB_NOT_FOUND, ACCESS_DENIED |
list_document_jobs | Read recent jobs | Optional limit from 1-100; optional status_filter | jobs[] | Validation errors, invalid status |
get_document_job | Read one job in detail | Required document_job_id | status, progress, current_stage, failure_reason, result_ready | DOCUMENT_JOB_NOT_FOUND, ACCESS_DENIED |
get_document_result | Fetch outputs and download links | Required document_job_id | primary_markdown, artifacts, download_urls, ttl_seconds | DOCUMENT_JOB_NOT_FOUND, ACCESS_DENIED |
cancel_document_job | Cancel a non-terminal job | Required document_job_id | status, credits_effect | DOCUMENT_JOB_NOT_CANCELLABLE |
delete_document_job | Delete a terminal job and reclaim storage | Required document_job_id | deleted_job_id, deleted_artifacts, storage_reclaimed_bytes | DOCUMENT_JOB_NOT_DELETABLE |
7.1 Tool parameter tables
get_workspace_overview
Description: Read workspace summary, including credits, storage usage, recent jobs, alerts, and recommended next actions.
| Parameter | Type | Required | Description |
|---|---|---|---|
| None | — | No | Call with an empty input object. |
upload_document_file
Description: Default entry point for end-user workflows. Upload a local file and start processing.
| Parameter | Type | Required | Description |
|---|---|---|---|
file_path | string | Yes | Absolute or relative local file path on the MCP host machine. |
processing_options.selected_options | string[] | No | Recommended primary feature switches. Common values: base_processing, content_validation, image_validation, toc_validation. |
processing_options.language | string | No | Free-form language hint string. auto, zh, and en are common examples. |
processing_options.toc_pages | string | No | Optional TOC page range such as 2-3 when the user already knows the layout. |
processing_options.content_pages | string | No | Optional content page range such as 4-20 for partial processing. |
Advanced/internal fields supported but usually unnecessary for normal users: content_page_count, toc_page_count, toc_has_annotations, image_count, text_validation, image_validation, output_format.
submit_document_for_processing
Description: Advanced entry point for workflows that already have a valid file_id.
| Parameter | Type | Required | Description |
|---|---|---|---|
file_id | string | Yes | Existing DocPurify file ID. |
processing_options.selected_options | string[] | No | Same primary feature switches as upload_document_file. |
processing_options.language | string | No | Same language hint behavior as upload_document_file. |
For ordinary users, prefer upload_document_file instead of this tool.
list_document_jobs
Description: List recent document jobs for the current account, optionally filtered by status.
| Parameter | Type | Required | Description |
|---|---|---|---|
limit | integer | No | Number of jobs to return. Valid range: 1-100. |
status_filter | string | No | Optional status filter such as uploading, waiting, processing, completed, failed, or cancelled. |
get_document_job
Description: Read one document job in detail, including status, progress, current stage, failure reason, and next action.
| Parameter | Type | Required | Description |
|---|---|---|---|
document_job_id | string | Yes | Document processing job ID. |
get_document_result
Description: Fetch result content, Markdown output, artifacts, expiring download links, and missing artifact information for a completed job.
| Parameter | Type | Required | Description |
|---|---|---|---|
document_job_id | string | Yes | Document processing job ID. |
cancel_document_job
Description: Cancel a non-terminal document job.
| Parameter | Type | Required | Description |
|---|---|---|---|
document_job_id | string | Yes | Document processing job ID. |
delete_document_job
Description: Delete a terminal document job and reclaim related storage resources.
| Parameter | Type | Required | Description |
|---|---|---|---|
document_job_id | string | Yes | Document processing job ID. |
Parameter meanings:
-
file_path
A local file path on the MCP host machine. The MCP server reads this file and uploads it for you. -
file_id
The ID of a file already uploaded to DocPurify. Use it withsubmit_document_for_processing. -
document_job_id
Identifies the processing job. Save the value returned by upload or submit immediately, because later status, result, cancel, and delete calls all depend on it. -
processing_options
Passes processing preferences. Omit it when you want to use the server defaults. -
status_filter
Filters the job list. It is safer to inspect actual status values withlist_document_jobsorget_document_jobbefore adding a filter.
7.2 processing_options examples
Minimal local upload:
{
"file_path": "/absolute/path/to/demo.pdf",
"processing_options": {
"selected_options": ["base_processing"]
}
}AI-enhanced document upload:
{
"file_path": "/absolute/path/to/demo.pdf",
"processing_options": {
"selected_options": [
"base_processing",
"toc_validation",
"image_validation",
"content_validation"
],
"language": "zh",
"toc_pages": "2-3",
"content_pages": "4-20",
"toc_has_annotations": true
}
}Existing file_id with explicit page counts:
{
"file_id": "file_123",
"processing_options": {
"selected_options": [
"base_processing",
"content_validation"
],
"language": "en",
"content_page_count": 18,
"toc_page_count": 2
}
}Plain-text or Markdown file:
{
"file_path": "/absolute/path/to/notes.md",
"processing_options": {
"selected_options": ["content_validation"],
"language": "auto"
}
}Notes:
- Prefer
selected_optionsas the main feature switch. text_validationandimage_validationare compatibility booleans, butselected_optionsis the clearer long-term interface.- For
txtandmd, prefer explicitcontent_validation.
7.3 Response shape
MCP tool calls return text content containing the JSON response from DocPurify.
Successful response:
{
"success": true,
"message": "ok",
"data": {}
}Business failures return isError: true to the MCP Host, with a machine-readable code in the content when available:
{
"detail": {
"code": "DOCUMENT_JOB_NOT_FOUND",
"message": "document_job_id does not exist"
}
}8. Request examples
The natural-language instruction can be very short:
Please check my DocPurify workspace status first.If you want the MCP host to upload a local file for you:
Upload the local file at /absolute/path/to/demo.pdf with DocPurify, then keep checking the job until the Markdown result is ready.If you already have an uploaded file:
Submit the document with file_id file_123 for processing, check progress every 30 seconds, and fetch the Markdown result when it completes.To inspect a result:
Check the processing status for document_job_id job_123. If it is complete, fetch the result and summarize the main content.9. Key fields
Common get_workspace_overview fields:
can_start_new_jobactive_jobsrecent_jobscredit_balancestorage_summaryalertsrecommended_next_actions
Common get_document_job fields:
statusprogresscurrent_stagefailure_reasonuser_facing_explanationsuggested_actionsretryableresult_ready
Common get_document_result fields:
primary_markdownartifactsdownload_urlsttl_secondsmissing_artifacts
10. Security and governance
DocPurify MCP calls are bound to the user behind the API key. The service checks resource ownership before accessing files or jobs.
| Area | Current behavior |
|---|---|
| Authentication | The stdio server reads DOCPURIFY_MCP_KEY; DocPurify binds the key to a user. |
| Token lifecycle | Created, rotated, or revoked by the user; rotating immediately invalidates the old key. |
| Scopes | Per-tool scopes are not available yet; the key represents the user's MCP access. |
| Tenant isolation | File and job access is checked against the key owner. |
| Returned data | Task state, results, download links, and required status fields. |
| Download links | Links expire; clients should read ttl_seconds. |
Security recommendations:
- Do not place API keys in prompts, tool descriptions, screenshots, or shared docs.
- Do not treat download links as permanent URLs.
- Use separate accounts or test tenants for non-production integration work.
- Rotate or revoke keys when a device, script, or teammate no longer needs access.
11. Limits, pagination, and compatibility
Current limits:
- Remote Streamable HTTP MCP endpoint is not available yet.
- Resources and Prompts are not exposed.
- MCP does not upload local raw files directly.
- One account cannot keep multiple long-lived active MCP keys.
Pagination and filtering:
list_document_jobsdefaults tolimit = 10.- The maximum
limitis100. - The current list endpoint does not return a cursor. Watch future versions for pagination fields.
Idempotency:
get_workspace_overview,list_document_jobs,get_document_job, andget_document_resultare read operations.upload_document_file,submit_document_for_processing,cancel_document_job, anddelete_document_jobchange job state. Check current job state withget_document_jobbefore retrying.- External idempotency keys are not available in this release.
Compatibility:
- Adding a tool or adding response fields is treated as backward compatible.
- Removing a tool, renaming a field, or changing required parameters will be documented before release.
- Clients should ignore unknown response fields.
12. Errors and troubleshooting
| Symptom | Common cause | What to do |
|---|---|---|
The client cannot see the docpurify Server | The config file path is wrong, or npx failed to run | Confirm Node.js 18+ is available, restart the client, and check MCP Host Server logs |
tools/list is empty | The Server did not start, or the client did not finish initialization | Check npx, the package name, and environment variables |
| Tool call returns an auth error | DOCPURIFY_MCP_KEY is missing, invalid, or revoked | Copy the current Key again and confirm it is set inside env |
| Tool call times out | The network is unreachable, or the service response is slow | Confirm the network can reach DocPurify, and increase DOCPURIFY_MCP_TIMEOUT_SECONDS if needed |
DOCUMENT_JOB_NOT_FOUND | The ID does not exist or belongs to another account | Use an ID created by the current account |
ACCESS_DENIED | The resource belongs to a different user | Use the correct account Key or upload the file again |
DOCUMENT_JOB_NOT_CANCELLABLE | The job is already completed, failed, or cancelled | Do not cancel it again. Use delete_document_job if cleanup is needed |
DOCUMENT_JOB_NOT_DELETABLE | The job is still queued or processing | Cancel it first, or wait for a terminal status |
result_ready = false | Processing has not completed | Keep polling get_document_job instead of repeatedly fetching results |
For low-level connectivity checks outside an MCP Host, you can call the service debug path directly:
curl -X POST "https://api.docpurify.com/mcp/tools/get_workspace_overview" \
-H "Content-Type: application/json" \
-H "X-API-Key: $DOCPURIFY_MCP_KEY" \
-d '{}'13. Suggested strategy for AI agents
Use these rules in agent tool policies:
- Start each session with
get_workspace_overview. - Prefer
upload_document_filewhen the user provides a local file path. - Use
submit_document_for_processingwhen the user already has a DocPurifyfile_id. - Check current state before write operations to avoid duplicate submit, cancel, or delete calls.
- After receiving
document_job_id, prefer pollingget_document_job. - Call
get_document_resultonly whenresult_ready = true. - If
failure_reasonexists, show it directly to the user. - Confirm the job is
completed,failed, orcancelledbefore deleting it.
14. FAQ
My client cannot see the tools. What should I check?
Confirm that the client loaded the docpurify MCP Server. Then check command, args, Node.js version, and environment variables. If the Server is visible but tools are missing, check the client's MCP logs.
Can I pass a local file path to submit_document_for_processing?
No. Use upload_document_file for local paths. submit_document_for_processing expects an existing DocPurify file_id.
Can download links be stored permanently?
No. Result download links expire. Read ttl_seconds, then call get_document_result again after expiry to get a fresh link.
When should I rotate an API Key?
Rotate or revoke it when the Key may be exposed, a device is retired, an integration is migrated, or a teammate no longer needs access.
FAQ
Does the MCP client need to stay logged in to the website?
No. The web console is only used to manage the Key. The MCP Server reads the Key from environment variables and calls tools for the corresponding account.
What happens after I rotate the Key?
The system issues a new Key immediately and invalidates the old one at the same time. Every MCP client must update `DOCPURIFY_MCP_KEY`.
Related Docs
Last updated: 2026-03-29