docflow-mcp
Enables LLM agents to classify documents, extract fields, tables, and stamps, and run compliance reviews using Docflow's document automation platform via 41 MCP tools.
README
Docflow MCP Server
MCP Server for Docflow — TextIn's document automation platform. Enables LLM agents to classify documents, extract fields/tables/stamps, and run rule-based compliance review through 41 MCP tools.
Features
- Document classification — auto-classify PDFs, images, Word, and Excel files into user-defined categories
- Field extraction — extract structured fields, table rows, handwriting, and stamps using LLM/VLM models
- Compliance review — run AI-powered rule evaluation with risk levels and detailed reasoning
- Two-layer tool design:
- 6 workflow tools — high-level composite operations for common pipelines (upload → extract → review)
- 35 resource tools — one tool per API endpoint for fine-grained configuration and edge cases
Installation
pip install git+https://github.com/intsig-textin/docflow-mcp.git
Or install in editable mode for development:
git clone https://github.com/intsig-textin/docflow-mcp.git
cd docflow-mcp
pip install -e .
Configuration
Set environment variables before starting the server:
export DOCFLOW_APP_ID=your_app_id
export DOCFLOW_SECRET_CODE=your_secret_code
# Optional: override API host (default: https://docflow.textin.com)
export DOCFLOW_HOST=https://docflow.textin.com
Get your APP_ID and SECRET_CODE from the Docflow console.
Running
Stdio (for MCP clients)
# Via installed command
docflow-mcp
# Or via Python module
python -m docflow_mcp
Claude Code Integration
Add to your Claude Code MCP settings (~/.claude/settings.json or project .claude/settings.json):
{
"mcpServers": {
"docflow": {
"command": "docflow-mcp",
"env": {
"DOCFLOW_APP_ID": "your_app_id",
"DOCFLOW_SECRET_CODE": "your_secret_code"
}
}
}
}
Or if using python -m:
{
"mcpServers": {
"docflow": {
"command": "python",
"args": ["-m", "docflow_mcp"],
"env": {
"DOCFLOW_APP_ID": "your_app_id",
"DOCFLOW_SECRET_CODE": "your_secret_code"
}
}
}
}
Tool Reference
Workflow Tools (6)
High-level tools that hide polling, multi-step logic, and upload routing.
| Tool | Description |
|---|---|
docflow_get_or_create_workspace |
Find workspace by name, or create if not found (idempotent) |
docflow_list_categories |
List all enabled categories with field configurations |
docflow_create_category |
Create category with fields and sample file |
docflow_upload_and_extract |
Upload files (list or directory) and wait for extraction results |
docflow_setup_review_rules |
Create review rule repo with groups and rules (idempotent) |
docflow_run_review |
Submit review task and wait for rule-by-rule results |
docflow_upload_and_extract — Upload Routing
Automatically selects upload mode based on file count:
- ≤ 3 files → synchronous upload (results returned immediately)
- > 3 files → asynchronous upload + polling until all files complete
Accepts either:
file_paths: explicit list of local file pathsdirectory: auto-scans for supported files (PDF, JPG, PNG, DOC, DOCX, XLS, XLSX, OFD, TXT)
docflow_setup_review_rules — Rule Structure
Rule Repository
└── Rule Group (e.g. "金额审核")
└── Rule (name, prompt, category_ids, risk_level)
risk_level: 10=high, 20=medium, 30=low
Resource Tools (35)
Thin wrappers covering every CRUD endpoint, organized by resource.
Files
| Tool | Endpoint | Description |
|---|---|---|
docflow_fetch_files |
GET /file/fetch | Query processed files, filter by status/category |
docflow_update_file |
POST /file/update | Update file metadata or verification status |
docflow_delete_files |
POST /file/delete | Permanently delete files by task_id or batch_number |
docflow_extract_fields |
POST /file/extract_fields | Re-extract specific fields without re-uploading |
docflow_retry_files |
POST /file/retry | Retry processing for failed files |
docflow_amend_category |
POST /file/amend_category | Correct misclassified file and trigger re-extraction |
Workspaces
| Tool | Endpoint | Description |
|---|---|---|
docflow_list_workspaces |
GET /workspace/list | List all accessible workspaces |
docflow_get_workspace |
GET /workspace/get | Get workspace details and statistics |
docflow_update_workspace |
POST /workspace/update | Update name, description, auth scope, or callback URL |
docflow_delete_workspace |
POST /workspace/delete | Delete workspace and all contents (permanent) |
Categories
| Tool | Endpoint | Description |
|---|---|---|
docflow_update_category |
POST /category/update | Update category name, model, prompt, or enabled status |
docflow_delete_category |
POST /category/delete | Delete category (existing file data is preserved) |
Category Tables
| Tool | Endpoint | Description |
|---|---|---|
docflow_list_category_tables |
GET /category/tables/list | List table configs (for extracting structured rows) |
docflow_add_category_table |
POST /category/tables/add | Add table field group (e.g. invoice line items) |
docflow_update_category_table |
POST /category/tables/update | Update table name or column definitions |
docflow_delete_category_tables |
POST /category/tables/delete | Delete table configs |
Category Fields
| Tool | Endpoint | Description |
|---|---|---|
docflow_list_category_fields |
GET /category/fields/list | List fields with field_ids (needed for rule references) |
docflow_add_category_fields |
POST /category/fields/add | Add fields to existing category |
docflow_update_category_field |
POST /category/fields/update | Update field name, description, or extraction prompt |
docflow_delete_category_fields |
POST /category/fields/delete | Delete fields from category |
Category Samples
| Tool | Endpoint | Description |
|---|---|---|
docflow_add_category_samples |
POST /category/sample/upload | Add sample files to improve classification (3–5 recommended) |
docflow_list_category_samples |
GET /category/sample/list | List all sample files for a category |
docflow_delete_category_samples |
POST /category/sample/delete | Remove low-quality samples |
Review Rule Repositories
| Tool | Endpoint | Description |
|---|---|---|
docflow_list_review_repos |
GET /review/rule_repo/list | List all rule repositories in workspace |
docflow_get_review_repo |
GET /review/rule_repo/get | Get repo with all groups and rules |
docflow_update_review_repo |
POST /review/rule_repo/update | Rename rule repository |
docflow_delete_review_repo |
POST /review/rule_repo/delete | Delete repo and all its rules (permanent) |
Review Rule Groups
| Tool | Endpoint | Description |
|---|---|---|
docflow_update_review_rule_group |
POST /review/rule_group/update | Rename rule group |
docflow_delete_review_rule_group |
POST /review/rule_group/delete | Delete group and all its rules |
Review Rules
| Tool | Endpoint | Description |
|---|---|---|
docflow_update_review_rule |
POST /review/rule/update | Update rule prompt, categories, or risk level |
docflow_delete_review_rule |
POST /review/rule/delete | Delete a single rule |
Review Tasks
| Tool | Endpoint | Description |
|---|---|---|
docflow_get_review_result |
POST /review/task/result | Get current review status without waiting |
docflow_delete_review_task |
POST /review/task/delete | Delete review tasks |
docflow_retry_review_task |
POST /review/task/retry | Retry entire review task |
docflow_retry_review_rule |
POST /review/task/rule/retry | Retry a single rule without re-running others |
Typical Workflow
1. docflow_get_or_create_workspace → workspace_id
2. docflow_list_categories → check existing categories
3. docflow_create_category (×N) → category_id per document type
4. docflow_upload_and_extract → files[], task_ids[]
5. docflow_setup_review_rules → repo_id
6. docflow_run_review → status, groups[rule results]
API Coverage
44 of 46 Docflow API endpoints are covered.
Intentionally omitted:
GET /auth/token— generates short-lived token for iframe embedding, not agent useGET /category/sample/download— returns binary file content, not useful for agents
Internally called (no separate tool needed):
POST /file/upload,/file/upload/sync→ used insidedocflow_upload_and_extractPOST /workspace/create→ used insidedocflow_get_or_create_workspacePOST /review/rule_repo/create,/rule_group/create,/rule/create→ used insidedocflow_setup_review_rulesPOST /review/task/submit→ used insidedocflow_run_review
Requirements
- Python ≥ 3.10
- Network access to
docflow.textin.com - Docflow account with valid
APP_IDandSECRET_CODE
License
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.