Skip to content

Latest commit

 

History

History
126 lines (93 loc) · 3.48 KB

File metadata and controls

126 lines (93 loc) · 3.48 KB
name docforge
description Register and use DocForge to convert PDF/HTML/DOCX/text into clean Markdown and deterministic RAG chunks with token estimates. Use when ingesting documents for vector stores, RAG pipelines, agent document processing, DocForge self-registration, df_ API keys, or connecting to docforge-mcp.

DocForge Agent Skill

DocForge provides document ingest and agent self-registration via MCP (stdio) and REST.

Before ingesting documents

  1. Fetch GET {DOCFORGE_ORIGIN}/api/v1/agent-manifest (or read repo AGENTS.md).
  2. If you lack a df_… API key, self-register (once per agent identity).
  3. Use the key via X-DocForge-Key header or DOCFORGE_API_KEY MCP env — never log or commit it.

Replace {DOCFORGE_ORIGIN} with the deployment URL or http://127.0.0.1:8787 locally.

Self-register (choose one)

REST

POST {DOCFORGE_ORIGIN}/api/v1/agents/register
Content-Type: application/json

{
  "name": "<agent-name>",
  "description": "<optional>",
  "capabilities": ["ingest", "chunk", "convert"]
}

Save api_key, id, cursor_config, and mcp_env from the JSON response.

MCP

  1. Connect MCP with command docforge-mcp and env DOCFORGE_API_URL={DOCFORGE_ORIGIN}.
  2. Call get_agent_manifest to discover endpoints (optional).
  3. Call register_agent with { "name": "…" }.
  4. Save api_key; set DOCFORGE_API_KEY in MCP env for later calls.

Ingest documents

MCP (preferred when configured)

Tool: ingest_document

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

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

Other tools: convert_document (Markdown only), chunk_markdown (chunk existing MD).

Tool: agent_whoami — requires key, confirms registration.

REST

POST {DOCFORGE_ORIGIN}/api/v1/ingest
X-DocForge-Key: df_…
Content-Type: multipart/form-data

file=@document.pdf
strategy=headings
max_tokens=512

Chunking

Strategy Use when
headings Structured docs with sections
size Fixed token windows, unstructured text

See {DOCFORGE_ORIGIN}/docs/agents/chunking.md for parameters.

Cursor MCP config template

After registration, use cursor_config from the register response:

{
  "mcpServers": {
    "docforge": {
      "command": "docforge-mcp",
      "env": {
        "DOCFORGE_API_URL": "http://127.0.0.1:8787",
        "DOCFORGE_API_KEY": "df_<FROM_REGISTER_RESPONSE>"
      }
    }
  }
}

Rules

  • Do not re-register repeatedly; one api_key per agent identity.
  • Do not expose api_key in output unless the user explicitly needs it for setup.
  • Prefer ingest_document over manual convert+chunk for RAG pipelines.
  • Use chunk id for idempotent vector store upserts.
  • Handle document content per the user's data classification policy.

Documentation

Doc Path
Agent guide {DOCFORGE_ORIGIN}/AGENTS.md
FAQ (AEO) {DOCFORGE_ORIGIN}/docs/faq.md
LLM index {DOCFORGE_ORIGIN}/llms.txt
MCP reference {DOCFORGE_ORIGIN}/docs/agents/mcp.md
REST reference {DOCFORGE_ORIGIN}/docs/agents/rest.md
Chunking {DOCFORGE_ORIGIN}/docs/agents/chunking.md
Manifest {DOCFORGE_ORIGIN}/api/v1/agent-manifest

For common questions (formats, registration, MCP setup, troubleshooting), read the FAQ first.

Repo copies: AGENTS.md, .cursor/skills/docforge/SKILL.md at project root.