Skip to content

Latest commit

 

History

History
124 lines (89 loc) · 2.5 KB

File metadata and controls

124 lines (89 loc) · 2.5 KB

DocForge MCP Reference

DocForge exposes a stdio MCP server (docforge-mcp) that wraps the REST API.

Install

pip install -e /path/to/docforge
# or from repo root after clone:
pip install -e .

Verify: docforge-mcp should be on PATH.

Cursor / Claude Desktop config

{
  "mcpServers": {
    "docforge": {
      "command": "docforge-mcp",
      "env": {
        "DOCFORGE_API_URL": "http://127.0.0.1:8787",
        "DOCFORGE_API_KEY": "df_OPTIONAL_AFTER_REGISTER"
      }
    }
  }
}

Use the cursor_config object from POST /api/v1/agents/register unchanged.

Environment variables

Variable Required Description
DOCFORGE_API_URL Yes Base URL of running DocForge API
DOCFORGE_API_KEY After register Auto-sent as X-DocForge-Key on tool calls

Tools

get_agent_manifest

No auth. Returns full manifest JSON (same as GET /api/v1/agent-manifest).

register_agent

No auth.

{
  "name": "my-agent",
  "description": "Optional description",
  "capabilities": ["ingest", "chunk"],
  "webhook_url": null,
  "metadata": {}
}

Returns agent id, api_key, cursor_config. Save api_key immediately.

list_agents

No auth. Lists registered agents (no secrets).

health_check

No auth. Returns API status and version.

agent_whoami

Requires API key (param or DOCFORGE_API_KEY env). Returns your agent profile.

convert_document

{
  "file_path": "/absolute/or/~/path/to/file.pdf",
  "api_key": "optional df_…"
}

Returns Markdown, token estimate, metadata.

chunk_markdown

{
  "markdown": "# Title\n\nBody…",
  "strategy": "headings",
  "max_tokens": 512,
  "overlap_tokens": 64,
  "min_heading_level": 1,
  "max_heading_level": 3,
  "include_heading_path": true,
  "token_model": "cl100k_base"
}

ingest_document

Full pipeline — preferred for RAG ingest.

{
  "file_path": "/path/to/document.docx",
  "strategy": "headings",
  "max_tokens": 512
}

Returns markdown, chunks[], token totals, document_id.

Typical agent workflow

  1. get_agent_manifest — discover endpoints
  2. register_agent — once per identity
  3. Update MCP env with DOCFORGE_API_KEY
  4. ingest_document — for each source file
  5. Push chunks[] to your vector store

Errors

Tools return JSON error objects when files are missing or the API returns 4xx/5xx. Check DOCFORGE_API_URL points to a running server (docforge-api or ./scripts/dev.sh).