MCP

Let an AI agent generate documents for you.

doctagd exposes a Model Context Protocol (MCP) server. A client that supports Streamable HTTP and a Bearer header, such as Claude Code, Gemini CLI, Codex or an agent you build yourself, can discover your saved configs and produce documents from a plain-language request, with no upload and no field-mapping step. It is a thin layer over the same v1 API: your dtgd_ key is the credential, and every quota, drift, and idempotency rule is identical.

Vendor-neutral

Connect over streamable HTTP at https://doctagd.com/mcp from any MCP client that can send an Authorization header. Your API key is the Bearer token.

Self-describing

inspect_config returns a typed schema (date / currency / number / required) so the agent knows exactly what to send and how to format it.

Safe to retry

validate_input is a dry run that costs no quota, and an idempotency key makes generation retries safe.

You still create a config once in the app (upload a template, confirm the mapping). MCP runs configs; it does not author them. Documents and PDF entitlements count against your plan exactly as they do in the app.

Tools

Six tools, each mapping 1:1 to a v1 endpoint. Only generate_documents spends quota.

list_configs

Discover which document templates (saved configs) this account can generate.

inspect_config

Get one config's typed column schema, including every column's type, whether it is required, and (for template configs) the placeholder it feeds. Call before generating.

validate_input

Dry-run rows against a config. Returns drift, missing-required columns, and coercion notes. No quota and no document. Call it until the input is valid.

generate_documents

Generate one document per row (DOCX, or PDF on Pro/Business). Returns a jobId and a download URL. This is the only tool that uses quota.

check_job

Read a job's status and download URL. New runs generate synchronously; a concurrent idempotent retry can return an in-flight job to poll.

get_usage

Read the account's remaining monthly document allowance before starting a batch. Reflects shared-license pooling.

Connect

A Streamable HTTP MCP client that can send an Authorization header works. Get a key from your account settings (shown once), then point your client at https://doctagd.com/mcp. Use the client-specific instructions below. These reflect official client documentation checked on 7 October 2026; they describe configuration support, not an authenticated end-to-end test in every client. API-based automation and MCP connections do not require a published native doctagd connector.

Claude Code (.mcp.json)
{
  "mcpServers": {
    "doctagd": {
      "type": "http",
      "url": "https://doctagd.com/mcp",
      "headers": { "Authorization": "Bearer dtgd_…" }
    }
  }
}
Claude Code (CLI)
claude mcp add doctagd \
  --transport http \
  https://doctagd.com/mcp \
  --header "Authorization: Bearer dtgd_…"
MCP Inspector (to test)
npx @modelcontextprotocol/inspector

# Transport:  Streamable HTTP
# URL:        https://doctagd.com/mcp
# Header:     Authorization: Bearer dtgd_…
Gemini CLI (~/.gemini/settings.json)
{
  "mcpServers": {
    "doctagd": {
      "httpUrl": "https://doctagd.com/mcp",
      "headers": { "Authorization": "Bearer dtgd_…" }
    }
  }
}
Codex (~/.codex/config.toml)
[mcp_servers.doctagd]
url = "https://doctagd.com/mcp"
bearer_token_env_var = "DOCTAGD_API_KEY"

# Set DOCTAGD_API_KEY in the environment used by Codex.
# Its value is the dtgd_… key, without the Bearer prefix.

Claude custom connector

In Customize → Connectors, add a custom connector with https://doctagd.com/mcp. Choose No sign in for the OAuth setting, then add a Request header: name Authorization, value Bearer dtgd_…. The header authenticates every request; choosing No sign in does not make the server public. On Team/Enterprise, a fixed credential gives connector users that credential's account access, so configure it for the intended users.

n8n MCP Client

Add an MCP Client node, select Streamable HTTP, and set the MCP Endpoint URL to https://doctagd.com/mcp. Select Header Auth with name Authorization and value Bearer dtgd_…, or Bearer Auth with the key alone. Select a discovered tool; use JSON input mode for nested parameters such as rows.

Configuration formats differ between clients; use their documented Streamable HTTP settings rather than copying another client's file. Discovery manifest: /.well-known/doctagd-manifest.json.

ChatGPT's custom MCP connection is a separate flow. Its documented authentication options are OAuth, no authentication, or a mixture of those. doctagd requires an API-key Bearer header and does not implement OAuth account linking, so do not select no authentication or expect a doctagd key to work directly there. Codex is a separate client with header-capable configuration. Gemini CLI support also does not establish support in the consumer Gemini app.

Official setup references: Claude Code, Claude connectors, Gemini CLI, Codex, n8n, ChatGPT.

A typical agent loop

From a plain-language request to a finished document, with the agent self-correcting before it spends a slot:

The loop
1. list_configs       → find "Service Agreement"
2. inspect_config     → 13 columns, types, which are required
3. (assemble a row from the user's request)
4. validate_input     → catches a missing field / coercion note
5. validate_input     → valid: true
6. generate_documents → jobId + downloadUrl (idempotencyKey
                        keeps retries safe). No human mapping
                        step anywhere in the chain.

The user just asks

“Draft a service agreement for Acme, £12k retainer, starting 1 June.”

The agent assembles + checks

It maps the sentence onto the config's columns and validates, fixing a missing jurisdiction or a date it could not parse before generating.

You get a file back

A ready .docx (or a .zip for a multi-row batch), fetched from the returned download URL.

Auth, quota & errors

MCP shares the v1 API's auth, limits, and error contract. The tools simply forward your key and surface the same responses, so an agent can act on them:

  • The returned downloadUrl is a time-limited signed link (default 24h from issuance). Preserve the complete exp/sig query string and open it without headers while valid. The owner's Authorization: Bearer dtgd_… header also works for unsigned URLs. File retention is separate from token validity.
  • An unsigned download without authentication returns 401. An expired or invalid signature without valid fallback authentication returns 410 (link_expired / link_invalid).
  • A 409 drift error lists missingColumns and suggestions. Correct input, validate again and use a new idempotency key to retry a failed job.
  • A 402 means the monthly document quota is exhausted, or PDF was requested on a Free plan. Stop and do not retry.
  • Requests are rate-limited to 60/min (429).

For key creation, input formats, idempotency, and the full error table, see the REST API docs and plans & limits.