DocRouter MCP Server
DocRouter MCP Server
Model Context Protocol server for seamless AI assistant integration
Overview
The DocRouter MCP Server is a TypeScript-based server that implements the Model Context Protocol, enabling AI assistants like Claude Desktop, Cursor IDE, and other MCP-compatible tools to directly interact with your DocRouter organization.
This server provides seamless document processing capabilities within your AI workflows, allowing AI assistants to upload documents, retrieve analysis results, and manage your document processing workflows programmatically.
- Document management and retrieval
- OCR text extraction and metadata
- AI-powered data extraction using prompts
- Tag and prompt management
- Advanced search functionality
Installation
Prerequisites
- Node.js 18+ installed on your system
- DocRouter Account with API access
- DocRouter Organization ID and API Token
Global Installation (Recommended)
Install the package globally to make the docrouter-mcp
binary available system-wide:
npm install -g @docrouter/mcp
Verify the installation:
# Check if binary is available
which docrouter-mcp
# Test the installation
docrouter-mcp --help
Local Installation
For project-specific installation:
npm install @docrouter/mcp
Note: Local installation requires using the full path to the executable in your MCP configuration.
Configuration
For Cursor IDE
Create .mcp.json
in your project root:
{
"mcpServers": {
"docrouter": {
"command": "docrouter-mcp",
"env": {
"DOCROUTER_API_URL": "https://app.docrouter.ai/fastapi",
"DOCROUTER_ORG_ID": "your-org-id",
"DOCROUTER_ORG_API_TOKEN": "your-api-token"
}
}
}
}
For Claude Desktop
Add to your claude_desktop_config.json
:
{
"mcpServers": {
"docrouter": {
"command": "docrouter-mcp",
"env": {
"DOCROUTER_API_URL": "https://app.docrouter.ai/fastapi",
"DOCROUTER_ORG_ID": "your-org-id",
"DOCROUTER_ORG_API_TOKEN": "your-api-token"
}
}
}
}
Important: Replace your-org-id
and
your-api-token
with your actual DocRouter credentials.
Available MCP Tools
Once configured, the following tools become available in your AI application:
Document Management
get_docrouter_documents()
|
List all documents |
get_docrouter_document(documentId)
|
Get document by ID |
get_docrouter_document_ocr(documentId)
|
Get raw OCR text |
get_docrouter_document_ocr_metadata(documentId)
|
Get OCR metadata |
Data Extraction
run_docrouter_extraction(documentId, promptRevId, force)
|
Run AI extraction |
get_docrouter_extraction(documentId, promptRevId)
|
Get extraction results |
Search and Discovery
search_docrouter_documents(query, tagIds)
|
Search documents |
search_docrouter_prompts(query)
|
Search prompts |
search_docrouter_tags(query)
|
Search tags |
Management
get_docrouter_prompts()
|
List all prompts |
get_docrouter_prompt(promptRevId)
|
Get prompt by ID |
get_docrouter_tags()
|
List all tags |
get_docrouter_tag(tagId)
|
Get tag by ID |
Help and Guidance
docrouter_help()
|
Get help information |
docrouter_document_analysis_guide(documentId)
|
Generate analysis guide |
Example Workflows
1. Document Analysis Workflow
// Search for invoice documents
const documents = await search_docrouter_documents("invoice");
// Get OCR text for the first document
const ocrText = await get_docrouter_document_ocr(documents.documents[0].id);
// Find available prompts for invoice processing
const prompts = await search_docrouter_prompts("invoice");
// Run extraction with a specific prompt
const extraction = await run_docrouter_extraction(
documents.documents[0].id,
prompts.prompts[0].id
);
2. Document Discovery Workflow
// Get all documents
const allDocuments = await get_docrouter_documents();
// Get all available prompts
const allPrompts = await get_docrouter_prompts();
// Get all tags for categorization
const allTags = await get_docrouter_tags();
3. Guided Analysis Workflow
// Get a step-by-step guide for analyzing a specific document
const guide = await docrouter_document_analysis_guide("document-id");
// Follow the guide to analyze the document
// The guide will provide specific prompts and extraction strategies
Troubleshooting
MCP Server Not Connecting
- Verify the binary exists:
which docrouter-mcp
- Check configuration syntax in your
.mcp.json
- Ensure environment variables are set correctly
- Test the server manually:
docrouter-mcp
Command Not Found
- Reinstall globally:
npm install -g @docrouter/mcp
- Check your PATH:
echo $PATH
- Use full path in configuration if needed
Environment Variables Not Set
- Verify variable names:
DOCROUTER_ORG_ID
,DOCROUTER_ORG_API_TOKEN
- Check variable values are correct and not expired
- Test API access with your credentials
Enable Debug Mode
Add debug logging to your environment:
"env": {
"DOCROUTER_API_URL": "https://app.docrouter.ai/fastapi",
"DOCROUTER_ORG_ID": "your-org-id",
"DOCROUTER_ORG_API_TOKEN": "your-api-token",
"DEBUG": "mcp:*"
}
Security Best Practices
Never Commit Credentials
Add .mcp.json
to .gitignore
if it contains real credentials
Use Environment Variables
Store credentials in environment variables instead of hardcoded values
Rotate API Tokens
Regularly rotate API tokens and limit permissions to minimum required access
Ready to Get Started?
Install the MCP server and start processing documents with AI assistance.