Skip to content

Make doc preprocessing options configurable in MCP server#17913

Open
kanlac wants to merge 1 commit into
PaddlePaddle:mainfrom
kanlac:feat/mcp-configurable-doc-preprocessing
Open

Make doc preprocessing options configurable in MCP server#17913
kanlac wants to merge 1 commit into
PaddlePaddle:mainfrom
kanlac:feat/mcp-configurable-doc-preprocessing

Conversation

@kanlac
Copy link
Copy Markdown

@kanlac kanlac commented Apr 12, 2026

Summary

Add --use_doc_orientation_classify and --use_doc_unwarping CLI arguments (and corresponding PADDLEOCR_MCP_USE_DOC_ORIENTATION_CLASSIFY / PADDLEOCR_MCP_USE_DOC_UNWARPING environment variables) to the MCP server.

Previously these options were hardcoded to False with no way for users to override them. The default remains False to preserve backward compatibility.

Problem

When processing scanned PDF documents via the MCP server in service mode (aistudio, self_hosted), layout detection can miss entire text blocks — lines are silently dropped from the output with no error or warning. Enabling useDocUnwarping and useDocOrientationClassify in the API request resolves the issue.

Since these options are hardcoded to False and not exposed as configuration, users have no way to work around this without patching the source code.

Related: #17164

Usage

# Via environment variables
PADDLEOCR_MCP_USE_DOC_UNWARPING=true paddleocr_mcp ...

# Via CLI arguments
paddleocr_mcp --use_doc_unwarping --use_doc_orientation_classify ...

Changes

  • mcp_server/paddleocr_mcp/__main__.py: Add two new CLI arguments with env var fallbacks
  • mcp_server/paddleocr_mcp/pipelines.py: Replace hardcoded False with configurable instance variables

Add --use_doc_orientation_classify and --use_doc_unwarping CLI arguments
(and corresponding environment variables) to allow users to enable
document preprocessing when needed. Previously hardcoded to False.
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 12, 2026

CLA assistant check
All committers have signed the CLA.

@paddle-bot
Copy link
Copy Markdown

paddle-bot Bot commented Apr 12, 2026

Thanks for your contribution!

Copy link
Copy Markdown
Member

@Bobholamovic Bobholamovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also update the documentation accordingly? Also, would it make more sense to let the agent decide whether to apply doc preprocessing, rather than fixing these settings at server init?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants