Getting started

MCP quickstart

Zero to a working render_datachain + resources/read in five calls.

MCP quickstart

Five curls. Five minutes. Ends with a rendered datachain HTML document fetched from the MCP Apps resource.

All calls target https://api.dtpr.io/mcp and use the same mcp-session-id so the rendered document persists between them.

SID=$(uuidgen)

1. Initialize

curl -s https://api.dtpr.io/mcp \
  -H 'content-type: application/json' \
  -H "mcp-session-id: $SID" \
  --data '{"jsonrpc":"2.0","id":1,"method":"initialize"}'

Response includes protocolVersion: "2025-06-18" and the server capabilities.

2. List tools

curl -s https://api.dtpr.io/mcp \
  -H 'content-type: application/json' \
  -H "mcp-session-id: $SID" \
  --data '{"jsonrpc":"2.0","id":2,"method":"tools/list"}'

Returns the nine tools documented at MCP tools.

3. Discover schema versions

curl -s https://api.dtpr.io/mcp \
  -H 'content-type: application/json' \
  -H "mcp-session-id: $SID" \
  --data '{
    "jsonrpc":"2.0","id":3,
    "method":"tools/call",
    "params":{"name":"list_schema_versions","arguments":{"datachain_type":"ai"}}
  }'

Pick a canonical version from data.versions[].id for step 4.

4. Render a datachain

curl -s https://api.dtpr.io/mcp \
  -H 'content-type: application/json' \
  -H "mcp-session-id: $SID" \
  --data '{
    "jsonrpc":"2.0","id":4,
    "method":"tools/call",
    "params":{
      "name":"render_datachain",
      "arguments":{
        "version":"ai@2026-04-16-beta",
        "datachain":{
          "schema_version":"ai@2026-04-16-beta",
          "elements":[{"element_id":"purpose.example","category_id":"purpose"}]
        }
      }
    }
  }'

The response's _meta.ui.resourceUri is ui://dtpr/datachain/view.html. Step 5 fetches that HTML.

5. Read the rendered HTML

curl -s https://api.dtpr.io/mcp \
  -H 'content-type: application/json' \
  -H "mcp-session-id: $SID" \
  --data '{
    "jsonrpc":"2.0","id":5,
    "method":"resources/read",
    "params":{"uri":"ui://dtpr/datachain/view.html"}
  }'

The response body carries the full HTML document (mime type text/html;profile=mcp-app). Hand it to your iframe's srcdoc.

Next

Copyright © 2026