# Connect from code and self-hosted tools

> For AI agents: a documentation index is available at https://makespdf.com/llms.txt — every docs page also has a markdown twin (append .md to the page URL), including this one: https://makespdf.com/docs/integrations/mcp-code.md

makesPDF's MCP server is a plain Streamable HTTP endpoint, so any agent framework
or self-hosted tool that speaks MCP over HTTP can connect with an API key in an
`Authorization` header. This one guide covers five of them: LangGraph, AutoGen,
Airflow, OpenClaw and Node-RED. They all get the same tools, billing and
download behaviour as the no-code automation tools documented separately.

## Endpoint and key

Point every client at `https://makespdf.com/api/v1/mcp`, over Streamable HTTP,
with your API key as a Bearer token:

```
https://makespdf.com/api/v1/mcp
Authorization: Bearer <your API key>
```

Create a key at [Settings → API keys](https://makespdf.com/settings/api-keys?ref=mcp-code).
All five clients below take a static header, so none of them needs the OAuth
sign-in that browser-based MCP clients use; if a client supports client ID
metadata documents, the [MCP page](https://makespdf.com/docs/mcp) covers that path.

| Client | Connect with |
| --- | --- |
| LangGraph | `langchain-mcp-adapters`, a URL and an `Authorization` header |
| AutoGen | `McpWorkbench` with `StreamableHttpServerParams` |
| Airflow | The `common-ai` provider's `mcp` connection, token in the Password field |
| OpenClaw | Settings → MCP, header in the server config |
| Node-RED | `node-red-contrib-mcp`, URL, transport and API key |

## Tools you get

Once connected, every makesPDF tool is available to the client. The five you
will reach for most:

| Tool | Arguments | What it does |
| --- | --- | --- |
| `render_markdown` | `markdown`, optional `options` | Markdown → PDF (1 credit per 10 pages) |
| `render_template` | `templateId`, `data` | A stored or library template filled with your data |
| `validate_markdown` | `markdown` | Free accessibility check before you render |
| `list_templates` | optional `q`, `category`, `tags` | Find a library template such as `invoice-classic` |
| `get_render_download_url` | `artifactId` | Free. Re-issue a download link for an artifact you own |

Template create, read, update and delete are there too, plus the authoring
skill and ownership-proof resources; the [MCP page](https://makespdf.com/docs/mcp) lists
every tool.

## LangGraph

`langchain-mcp-adapters` turns the server's tools into LangChain tools, which a
LangGraph agent uses like any other tool. Install the adapter, LangGraph and the
OpenAI provider the example uses:

```bash
pip install langchain-mcp-adapters langgraph "langchain[openai]"
export MAKESPDF_API_KEY=...  # mint at https://makespdf.com/settings/api-keys?ref=mcp-code
export OPENAI_API_KEY=...    # create_react_agent resolves openai:gpt-4o-mini through it
```

Point `MultiServerMCPClient` at the server with the `http` transport
(`streamable_http` is the same transport under its other name) and pass the key
in `headers`:

```python
import asyncio
import os

from langchain_mcp_adapters.client import MultiServerMCPClient
from langgraph.prebuilt import create_react_agent

client = MultiServerMCPClient(
    {
        "makespdf": {
            "transport": "http",  # Streamable HTTP
            "url": "https://makespdf.com/api/v1/mcp",
            "headers": {"Authorization": f"Bearer {os.environ['MAKESPDF_API_KEY']}"},
        }
    }
)


async def main() -> None:
    tools = await client.get_tools()
    agent = create_react_agent("openai:gpt-4o-mini", tools)
    result = await agent.ainvoke(
        {"messages": [{"role": "user", "content": "Render '# Hello' to a PDF."}]}
    )
    print(result)


asyncio.run(main())
```

`client.get_tools()` returns the whole tool list for `create_react_agent` or any
other LangGraph graph. The [LangGraph guide](https://makespdf.com/docs/integrations/langgraph)
covers the shim route instead — the `makespdf[langchain]` tools over the REST
API, with no MCP server in between.

## AutoGen

AutoGen's Python extensions ship `McpWorkbench`, which wraps an MCP server and
exposes `list_tools` and `call_tool`. Install the MCP extra and give the
workbench `StreamableHttpServerParams`:

```bash
pip install -U "autogen-ext[mcp]"
```

```python
import asyncio
import os

from autogen_ext.tools.mcp import McpWorkbench, StreamableHttpServerParams


async def main() -> None:
    params = StreamableHttpServerParams(
        url="https://makespdf.com/api/v1/mcp",
        headers={"Authorization": f"Bearer {os.environ['MAKESPDF_API_KEY']}"},
    )
    async with McpWorkbench(server_params=params) as workbench:
        tools = await workbench.list_tools()
        print([tool["name"] for tool in tools])
        result = await workbench.call_tool(
            "render_markdown", {"markdown": "# Hello from AutoGen"}
        )
        print(result)


asyncio.run(main())
```

`McpWorkbench` is an async context manager: it opens the session on entry and
closes it on exit. AutoGen's Python repository was archived in October 2026, so
treat a new project as a migration and pin the versions you test.

## Airflow

The `apache-airflow-providers-common-ai` provider has an `mcp` connection type.
Create a connection with:

- **Connection type**: `mcp`
- **Host**: `https://makespdf.com/api/v1/mcp`
- **Password**: your makesPDF API key

The provider sends the password as a static `Authorization: Bearer <token>`
header on HTTP transports, and its Transport extra defaults to `http`
(Streamable HTTP). The provider's `MCPHook` reads the connection named
`mcp_default` unless you pass another id, so naming it `mcp_default` is the
shortest path:

```json
{
  "conn_id": "mcp_default",
  "conn_type": "mcp",
  "host": "https://makespdf.com/api/v1/mcp",
  "password": "<your makesPDF API key>"
}
```

The provider installs like any other Airflow provider, so the same connection
works on a self-managed Airflow instance.

## OpenClaw

OpenClaw is self-hosted: server definitions live under `mcp.servers` in its
config, and Settings → MCP writes them through the Gateway.

1. Open the Control UI and go to **Settings → MCP**.
2. Under **Configured servers**, select **Add server**.
3. Give it a unique name, pick the **Streamable HTTP** transport and enter
   `https://makespdf.com/api/v1/mcp`.
4. Select **Add server**, then add the header in the scoped config editor,
   which has the fields beyond the basics — headers, environment values, OAuth
   metadata, TLS settings and tool filters.

```json5
{
  mcp: {
    servers: {
      makespdf: {
        url: "https://makespdf.com/api/v1/mcp",
        transport: "streamable-http",
        // Authorization: Bearer <your API key> — add it in Settings → MCP, not here
      },
    },
  },
}
```

OpenClaw's docs say to keep credentials out of config literals, so store the key
through the supported secret mechanisms rather than pasting it into the config
file. Verify the server answers with `openclaw mcp doctor makespdf --probe`;
saving a definition does not prove reachability. OpenClaw also supports OAuth
servers through `auth: "oauth"` and `openclaw mcp login <name>`; makesPDF
sign-in uses client ID metadata documents, which we have not tested with
OpenClaw, so use the API key.

## Node-RED

`node-red-contrib-mcp` adds MCP nodes to Node-RED: an **mcp server** config node
(URL, transport, API key), **mcp tool** and **mcp tools** nodes, and an **ai
agent** node that runs the tool loop for you. Install it from the Palette
Manager (**Menu → Manage palette → Install**, search for
`node-red-contrib-mcp`) or from your user directory:

```bash
cd ~/.node-red && npm install node-red-contrib-mcp
```

Then:

1. Add an **mcp server** config node, set **URL** to
   `https://makespdf.com/api/v1/mcp`, the transport to **http** (Streamable
   HTTP) and paste your API key.
2. Add an **mcp tool** node, pick the config node and set the tool name to
   `render_markdown`; the arguments go in `msg.payload`.
3. Wire an **inject** node in front and a **debug** node behind, or hand the
   server to an **ai agent** node and ask for the document in plain text.

```json
[
  {
    "id": "makespdf-trigger",
    "type": "inject",
    "name": "Render",
    "props": [{ "p": "payload" }],
    "payload": "{\"markdown\": \"# Hello from Node-RED\"}",
    "payloadType": "json",
    "wires": [["makespdf-tool"]]
  },
  {
    "id": "makespdf-tool",
    "type": "mcp-tool-call",
    "name": "Render markdown",
    "server": "makespdf-server",
    "toolName": "render_markdown",
    "wires": [["makespdf-debug"]]
  },
  {
    "id": "makespdf-debug",
    "type": "debug",
    "name": "Result",
    "active": true
  },
  {
    "id": "makespdf-server",
    "type": "mcp-server-config",
    "name": "makesPDF",
    "url": "https://makespdf.com/api/v1/mcp",
    "transportType": "http"
  }
]
```

## Get the PDF

Both billed renders return the PDF twice: as an embedded base64 resource for
clients that render attachments, and as a `downloadUrl`, a signed link that
needs no API key, so the client's own HTTP call or shell can save it with
`curl -o document.pdf <downloadUrl>`. The link expires 15 minutes after the
render; call `get_render_download_url` with the `artifactId` for a fresh one
(free), for as long as the artifact is kept — 7 days by default. Every result
also carries `pageCount` and `creditsDeducted`; the `downloadUrl` and
`artifactId` are present when the artifact was recorded, and omitted if capture
failed.

## Billing and limits

Renders bill your makesPDF credits exactly like the API: 1 credit per 10 pages
on success, nothing on failure. Validation, listing and
`get_render_download_url` are free. On the Free and Hobbyist plans, unless the
account holds Growth credits, each page carries a small makespdf.com link. Rate
limit: 2,000 renders/hour per caller. The full tool reference is on the
[MCP page](https://makespdf.com/docs/mcp).
