Back to docs
Integrations & AvailabilityLive2026-03-29

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 with upload_document_file. Use submit_document_for_processing only when you already have a DocPurify file_id.

text
MCP Host
  -> DocPurify MCP stdio server
  -> DocPurify service
  -> Document processing jobs and results

1. 5-minute quick setup

You only need two things:

SettingNotes
npxInstalled with Node.js. It starts @docpurify/mcp-server.
DOCPURIFY_MCP_KEYThe 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.

json
{
  "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.

PrimitiveStatusNotes
ToolsAvailableQuery workspace state, upload local files, submit processing, poll progress, fetch results, cancel jobs, and delete terminal jobs.
ResourcesNot availableNo resources/list or URI templates are exposed. Results are returned through get_document_result.
PromptsNot availableNo 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.

ItemNotes
Protocol version2025-03-26
Transportstdio
Capability negotiationinitialize returns the tools capability
Tool discoverytools/list
Tool callstools/call
Credential injectionEnvironment variable DOCPURIFY_MCP_KEY
Default API basehttps://api.docpurify.com
Distributionnpm package @docpurify/mcp-server
Registry namecom.docpurify/mcp-server
Resources / PromptsNot available yet

Security reminder
In stdio mode, never put the Key into prompts or tool descriptions. Pass it only through the MCP Host env configuration.

4. Create and store an API Key

MCP API Keys are managed on the MCP page in the DocPurify web console:

  1. Sign in to DocPurify.
  2. Open the MCP page from the main navigation.
  3. Create an API Key.
  4. Save the generated Key immediately. The full Key is not shown again after you leave the page.
  5. Put the Key in DOCPURIFY_MCP_KEY inside 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.

json
{
  "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_SECONDS is 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.

For a first integration, this sequence is recommended:

  1. Create or confirm the current active Key in the web console.
  2. Start the MCP Host and confirm it can discover the docpurify Server.
  3. Call get_workspace_overview to inspect account context, credits, and recent jobs.
  4. If you have a local file path, call upload_document_file.
  5. Only use submit_document_for_processing for advanced workflows where a valid file_id already exists.
  6. Poll progress with get_document_job.
  7. Only call get_document_result when result_ready = true.
  8. To stop a job, check the current status first and then call cancel_document_job.
  9. To clean up data, call delete_document_job only for a terminal job.

7. Tools reference

ToolPurposeParametersKey response fieldsCommon errors
get_workspace_overviewRead workspace summaryNone; {} is recommendedcan_start_new_job, active_jobs, recent_jobs, credit_balance, storage_summaryMCP_KEY_INVALID, MCP_KEY_REVOKED
upload_document_fileUpload a local file and start processingRequired file_path; optional processing_optionsdocument_job_id, file_id, status, estimated_credits, credits_lockedFile read errors, upload failures
submit_document_for_processingStart processing for a pre-uploaded fileRequired file_id; optional processing_optionsdocument_job_id, status, estimated_credits, credits_lockedDOCUMENT_JOB_NOT_FOUND, ACCESS_DENIED
list_document_jobsRead recent jobsOptional limit from 1-100; optional status_filterjobs[]Validation errors, invalid status
get_document_jobRead one job in detailRequired document_job_idstatus, progress, current_stage, failure_reason, result_readyDOCUMENT_JOB_NOT_FOUND, ACCESS_DENIED
get_document_resultFetch outputs and download linksRequired document_job_idprimary_markdown, artifacts, download_urls, ttl_secondsDOCUMENT_JOB_NOT_FOUND, ACCESS_DENIED
cancel_document_jobCancel a non-terminal jobRequired document_job_idstatus, credits_effectDOCUMENT_JOB_NOT_CANCELLABLE
delete_document_jobDelete a terminal job and reclaim storageRequired document_job_iddeleted_job_id, deleted_artifacts, storage_reclaimed_bytesDOCUMENT_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.

ParameterTypeRequiredDescription
NoneNoCall with an empty input object.

upload_document_file

Description: Default entry point for end-user workflows. Upload a local file and start processing.

ParameterTypeRequiredDescription
file_pathstringYesAbsolute or relative local file path on the MCP host machine.
processing_options.selected_optionsstring[]NoRecommended primary feature switches. Common values: base_processing, content_validation, image_validation, toc_validation.
processing_options.languagestringNoFree-form language hint string. auto, zh, and en are common examples.
processing_options.toc_pagesstringNoOptional TOC page range such as 2-3 when the user already knows the layout.
processing_options.content_pagesstringNoOptional 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.

ParameterTypeRequiredDescription
file_idstringYesExisting DocPurify file ID.
processing_options.selected_optionsstring[]NoSame primary feature switches as upload_document_file.
processing_options.languagestringNoSame 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.

ParameterTypeRequiredDescription
limitintegerNoNumber of jobs to return. Valid range: 1-100.
status_filterstringNoOptional 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.

ParameterTypeRequiredDescription
document_job_idstringYesDocument processing job ID.

get_document_result

Description: Fetch result content, Markdown output, artifacts, expiring download links, and missing artifact information for a completed job.

ParameterTypeRequiredDescription
document_job_idstringYesDocument processing job ID.

cancel_document_job

Description: Cancel a non-terminal document job.

ParameterTypeRequiredDescription
document_job_idstringYesDocument processing job ID.

delete_document_job

Description: Delete a terminal document job and reclaim related storage resources.

ParameterTypeRequiredDescription
document_job_idstringYesDocument 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 with submit_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 with list_document_jobs or get_document_job before adding a filter.

7.2 processing_options examples

Minimal local upload:

json
{
  "file_path": "/absolute/path/to/demo.pdf",
  "processing_options": {
    "selected_options": ["base_processing"]
  }
}

AI-enhanced document upload:

json
{
  "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:

json
{
  "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:

json
{
  "file_path": "/absolute/path/to/notes.md",
  "processing_options": {
    "selected_options": ["content_validation"],
    "language": "auto"
  }
}

Notes:

  • Prefer selected_options as the main feature switch.
  • text_validation and image_validation are compatibility booleans, but selected_options is the clearer long-term interface.
  • For txt and md, prefer explicit content_validation.

7.3 Response shape

MCP tool calls return text content containing the JSON response from DocPurify.

Successful response:

json
{
  "success": true,
  "message": "ok",
  "data": {}
}

Business failures return isError: true to the MCP Host, with a machine-readable code in the content when available:

json
{
  "detail": {
    "code": "DOCUMENT_JOB_NOT_FOUND",
    "message": "document_job_id does not exist"
  }
}

8. Request examples

The natural-language instruction can be very short:

text
Please check my DocPurify workspace status first.

If you want the MCP host to upload a local file for you:

text
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:

text
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:

text
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_job
  • active_jobs
  • recent_jobs
  • credit_balance
  • storage_summary
  • alerts
  • recommended_next_actions

Common get_document_job fields:

  • status
  • progress
  • current_stage
  • failure_reason
  • user_facing_explanation
  • suggested_actions
  • retryable
  • result_ready

Common get_document_result fields:

  • primary_markdown
  • artifacts
  • download_urls
  • ttl_seconds
  • missing_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.

AreaCurrent behavior
AuthenticationThe stdio server reads DOCPURIFY_MCP_KEY; DocPurify binds the key to a user.
Token lifecycleCreated, rotated, or revoked by the user; rotating immediately invalidates the old key.
ScopesPer-tool scopes are not available yet; the key represents the user's MCP access.
Tenant isolationFile and job access is checked against the key owner.
Returned dataTask state, results, download links, and required status fields.
Download linksLinks 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_jobs defaults to limit = 10.
  • The maximum limit is 100.
  • 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, and get_document_result are read operations.
  • upload_document_file, submit_document_for_processing, cancel_document_job, and delete_document_job change job state. Check current job state with get_document_job before 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

SymptomCommon causeWhat to do
The client cannot see the docpurify ServerThe config file path is wrong, or npx failed to runConfirm Node.js 18+ is available, restart the client, and check MCP Host Server logs
tools/list is emptyThe Server did not start, or the client did not finish initializationCheck npx, the package name, and environment variables
Tool call returns an auth errorDOCPURIFY_MCP_KEY is missing, invalid, or revokedCopy the current Key again and confirm it is set inside env
Tool call times outThe network is unreachable, or the service response is slowConfirm the network can reach DocPurify, and increase DOCPURIFY_MCP_TIMEOUT_SECONDS if needed
DOCUMENT_JOB_NOT_FOUNDThe ID does not exist or belongs to another accountUse an ID created by the current account
ACCESS_DENIEDThe resource belongs to a different userUse the correct account Key or upload the file again
DOCUMENT_JOB_NOT_CANCELLABLEThe job is already completed, failed, or cancelledDo not cancel it again. Use delete_document_job if cleanup is needed
DOCUMENT_JOB_NOT_DELETABLEThe job is still queued or processingCancel it first, or wait for a terminal status
result_ready = falseProcessing has not completedKeep 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:

bash
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_file when the user provides a local file path.
  • Use submit_document_for_processing when the user already has a DocPurify file_id.
  • Check current state before write operations to avoid duplicate submit, cancel, or delete calls.
  • After receiving document_job_id, prefer polling get_document_job.
  • Call get_document_result only when result_ready = true.
  • If failure_reason exists, show it directly to the user.
  • Confirm the job is completed, failed, or cancelled before 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