MCP

Let an AI agent generate documents for you.

doctagd exposes a Model Context Protocol (MCP) server. MCP is an open standard, so any compatible agent, including Claude, ChatGPT, Gemini, 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

Poll a generation job by id for its status and download URL. Runs are usually synchronous, so the job is often already done.

get_usage

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

Connect

Any 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. That includes agent CLIs and SDKs (Claude Code, OpenAI Agents SDK / ChatGPT developer mode, Gemini CLI), IDE assistants (Cursor, VS Code, Cline, Windsurf, Zed), open agents (Goose, Continue), and automation tools with an MCP client node (n8n), plus anything you build with the official MCP SDKs.

Most MCP clients (config file)
{
  "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_…

Config-key names vary slightly by client (VS Code uses servers; most others use mcpServers), but the URL and Authorization header are the same everywhere. Discovery manifest: /.well-known/doctagd-manifest.json.

doctagd authenticates with your API key (Bearer), which works with any header-capable client above. The one-click “Add connector” buttons in the consumer Claude, ChatGPT, and Gemini apps use OAuth rather than a header. That flow is on our roadmap, so for now use a client that can send an Authorization header.

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 (about 24h). Open it or hand it to the user directly; no header needed. The Authorization: Bearer dtgd_… header also works (e.g. for fixed automations).
  • A 409 drift error lists missingColumns and suggestions. The agent should remap and retry.
  • 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.