Skip to content

Repository files navigation

docAgent MCP Server

An extensible Model Context Protocol (MCP) server that exposes a powerful suite of document processing, file transformation, data visualization, and sandboxed Python code execution tools to any MCP-compatible client (e.g., Claude Desktop, Cursor, LibreChat).


Overview

docAgent-MCPServer enables LLMs to perform heavy lifting on local files and documents directly from your MCP client interface. It provides standardized tools for text extraction, translation, summarization, file format conversions, archiving/compression, plotting, and secure containerized code execution.


Features & Tools

Tool Description
text_extractor Extracts raw text and structure from various document formats (PDF, DOCX, TXT, etc.).
text_summarizer Generates concise, structured summaries of document contents using LLM backends.
translator Translates document text across multiple languages while preserving contextual meaning.
file_conversion Converts documents and media between different supported file formats.
file_compression Optimizes and reduces file sizes across document and media types.
archiver Creates and manages ZIP archives and bundled files.
generate_plot Generates charts and visual data plots based on input data schemas.
py_runtime Runs Python scripts inside an isolated, containerized Docker sandbox.
fallback Handles graceful error recovery and input normalization across tools.

Project Structure

.
├── app/
│   ├── core/
│   │   └── logging_config.py      # Application logging setup
│   ├── dependencies/
│   │   └── llm.py                 # LLM provider clients & configs
│   ├── schemas/                   # Pydantic validation models
│   │   ├── compression_schema.py
│   │   ├── extract_schema.py
│   │   ├── fallback_input.py
│   │   ├── file_conversion_schema.py
│   │   ├── file_zipper_schema.py
│   │   ├── plotter_schema.py
│   │   ├── py_runtime_schema.py
│   │   ├── summarize_schema.py
│   │   └── translation_schema.py
│   ├── tools/                     # MCP Tool implementations
│   │   ├── archiver.py
│   │   ├── fallback.py
│   │   ├── file_compression.py
│   │   ├── file_conversion.py
│   │   ├── generate_plot.py
│   │   ├── py_runtime.py
│   │   ├── text_extractor.py
│   │   ├── text_summarizer.py
│   │   └── translator.py
│   └── utils/
│       └── Utils.py               # Shared utility functions
├── python_runtime_container_setup/ # Sandboxed Docker runtime environment
│   ├── Dockerfile
│   ├── entrypoint.sh
│   ├── test_container.py
│   └── watcher.py
├── main.py                        # MCP server entry point
├── pyproject.toml                 # Project metadata and dependencies
└── uv.lock                        # Lockfile

Prerequisites

  • Python: 3.12+
  • Package Manager: uv (recommended) or pip
  • Docker: Required if using the py_runtime containerized execution tool
  • API Keys: Required LLM provider API keys (e.g., OPENAI_API_KEY, ANTHROPIC_API_KEY, etc. depending on your configuration)
  • Google Cloud Credentials: JSON service account key files for Vision API, Document AI, and OCR services

Installation & Setup

1. Clone the Repository

git clone https://github.com/your-username/docAgent-MCPServer.git
cd docAgent-MCPServer

2. Set Up Virtual Environment & Dependencies

Using uv:

uv sync

Or using standard pip:

python3.12 -m venv .venv
source .venv/bin/activate
pip install .

3. Configure Environment Variables

Create a .env file in the root directory. refer to .env.example to produce required environment

Configure Google Service Account Credentials Document processing services (Document AI, Vision API, and OCR) require Google Cloud Service Account JSON credentials.

Create a credentials/ directory in the project root and place your downloaded JSON key files inside:

mkdir -p credentials

Ensure your JSON key files match the expected relative paths:

  • credentials/service-account.json (Google Cloud Vision API key)
  • credentials/document_ai.json (Google Document AI key)
  • credentials/doc-agent-ocr-key.json (Google Application / OCR credentials)

4. Build the Python Runtime Sandbox (Optional)

If you plan to use the py_runtime tool for sandboxed Python code execution:

docker build -t docagent-python-runtime ./python_runtime_container_setup

Running the Server

Standalone / Stdio Mode

# Using uv
uv run python main.py

# Using an activated virtual environment
python main.py

Development

  • Add New Tools: Implement your tool function under app/tools/ and define its input/output model in app/schemas/.
  • Register Tools: Import and attach tools to the server instance in main.py.
  • Container Testing: Run python python_runtime_container_setup/test_container.py to verify the Docker execution environment.

License

This project is licensed under the MIT License.

About

MCP server with document utility tools implementation for document utility AI agent client

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages