Skip to content

IntegrationsYour own code

HTTP server

Run Artiwright's MCP server over HTTP, as a service your agents and apps connect to.

HTTP server.md

Over stdio, each app starts its own Artiwright. Over HTTP, one Artiwright server runs as a service and any number of agents connect to it by URL. Use it for a hosted agent, a team, or an app written in a language without an Artiwright package.

Node.js 22.13 or newer (prerequisites), or Docker (see Docker).

  1. Choose a token. Clients must send it; without it the server answers 401.

  2. Start it:

    ARTIWRIGHT_MCP_TOKEN=choose-a-long-random-token npx -y artiwright@latest mcp --http --root /srv/artiwright

    It prints where it listens:

    artiwright MCP server on http://127.0.0.1:8765/mcp (sessions in /srv/artiwright), token required
  3. Check it answers:

    curl -s -X POST http://127.0.0.1:8765/mcp \
    -H "Authorization: Bearer choose-a-long-random-token" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json, text/event-stream" \
    -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"curl","version":"0"}}}'

    The reply includes "serverInfo":{"name":"artiwright",…}.

Option Default What it does
--http off Serve Streamable HTTP instead of stdio
--port <n> 8765 Port to listen on
--host <address> 127.0.0.1 Address to listen on; 0.0.0.0 for every interface (needs ARTIWRIGHT_MCP_TOKEN)
--root <folder> ./artiwright-sessions Sessions and finished files (or ARTIWRIGHT_ROOT)
--theme <name or file> none Theme for new documents
ARTIWRIGHT_MCP_TOKEN none When set, requests need Authorization: Bearer <token>. Without one, the server listens only on this machine and serves only requests that come from it and are addressed to it (Host and Origin must be localhost), so a web page can’t reach the server

The endpoint is always /mcp.

  • Stateless requests. Each request gets a fresh server; the documents live in the session folder, so any request can continue any session.
  • Sessions. Tools take a session argument. Use one per conversation (for example your chat’s id) so turns edit the same documents.
  • Files are sent, not read by path. Over HTTP the server doesn’t read files from its disk on a client’s behalf. Clients send a file’s contents (base64) to artiwright_open.
  • Finished files are written under <root>/<session>/outputs/ on the server. artiwright_finalize returns their path; serve them to your users from there.
claude mcp add --transport http artiwright https://artiwright.example.com/mcp --header "Authorization: Bearer YOUR_TOKEN"

Agent frameworks connect the same way through their MCP clients, with the URL and the Authorization header.

  • Put it behind HTTPS (a reverse proxy or your platform’s load balancer) and keep --host 127.0.0.1 unless the proxy needs another address.
  • Use a long random token, keep it in a secret store, and rotate it like any other credential.
  • For untrusted or multi-tenant use, run it in a container with outbound networking turned off.