Connect an MCP client

Lokasign serves its API as an MCP server, so an AI agent can call it directly instead of writing HTTP. It is the same API: one tool per operation, the same API key, the same rules. Whatever a tool call does, a client with that key could have done over /api/v1.

This page is about connecting a client. What the tools do is in the API reference and its OpenAPI document — the tools carry those descriptions with them.

What to point your client at

URL https://lokasign.net/mcp
Transport Streamable HTTP
Authentication Authorization: Bearer <api_key>, or X-Api-Key: <api_key>

The API key is the same one your application uses for the REST API. Issue or rotate it in the dashboard under API & Webhook (/api-settings); the secret is shown once, at creation.

Treat the key as a credential you are handing to an assistant: it can do everything your application can do, for your application only. Data belonging to other applications on the platform does not exist as far as that key is concerned.

Give an agent a test key (esk_test_…, issued with mode Uji). It can then create, send and even sign (simulateSigner) freely: nothing is emailed — listTestMail shows what would have been — and every executed document is a SPECIMEN without the platform seal. A live key lets the agent invite real people and produce binding documents.

Claude Code

claude mcp add --transport http lokasign https://lokasign.net/mcp \
  --header "Authorization: Bearer <api_key>"

Claude (desktop and web)

Add Lokasign as a remote custom connector. This is also the only way to get the interactive Lokasign box in the chat (below); a local mcp-remote bridge works, but answers in text only.

  1. Open Settings → Connectors (Customize → Connectors in some versions) and choose Add custom connector.
  2. Name it Lokasign and set URL to https://lokasign.net/mcp — exactly, without a trailing slash. Claude derives the sandbox origin of interactive results from this string.
  3. Leave OAuth unset. Lokasign authenticates by API key, and Claude keeps the Authorization header for OAuth, so under Request headers pick x-api-key and paste the key itself, without Bearer.
  4. Save, then enable the connector in a conversation (the tools menu under the message box).

On Team and Enterprise plans an organisation owner may have to add or allow the connector. Menu names follow Claude's own releases; if a label differs, Claude's help pages win.

Let Claude upload chat attachments itself (recommended)

A file added to the chat lands in Claude's code-execution sandbox, not on this server. Claude can send it to Lokasign for you — so you only attach the PDF and never open a link — once that sandbox may reach this host. Once, in Claude's settings:

  1. Capabilities → turn on code execution and file creation.
  2. Turn on Allow network egress.
  3. Add lokasign.net to the domain allowlist (the additional allowed domains).

Without it the upload from the sandbox is refused and Claude falls back to a link or the upload box. Claude cannot grant this from inside a conversation.

What you will see

The tools createDocumentUpload, createSigningSession and getFinalDocuments render a Lokasign box in the chat:

The box never writes into the conversation (Claude would put such a message in your message box behind a warning); it tells Claude what happened through its context instead.

A first prompt, with a PDF attached:

Tanda tangani dokumen ini dengan Lokasign. Saya penanda tangannya, sebagai Pihak Pertama.

When something is off

What you see Why, and what to do
The tools work but no box appears The connector runs through mcp-remote or another stdio bridge. Add it as a remote custom connector as above.
The connector does not connect (401) The key went into the wrong header, or with Bearer. Use x-api-key and the bare key.
Claude cannot upload the attachment lokasign.net is not on the allowlist yet. Add it, or use the link or the box Claude offers.
The signature box is missing on the signing page Claude placed the field by a text that is not in the PDF; Lokasign now refuses that (anchor_not_found). For a scanned PDF, ask for the box by position.

Cursor

In .cursor/mcp.json (this project) or ~/.cursor/mcp.json (every project):

{
  "mcpServers": {
    "lokasign": {
      "url": "https://lokasign.net/mcp",
      "headers": { "Authorization": "Bearer <api_key>" }
    }
  }
}

VS Code (GitHub Copilot agent mode)

In .vscode/mcp.json. VS Code asks for the key once and stores it outside the file, so it never lands in your repository:

{
  "inputs": [
    { "type": "promptString", "id": "lokasign-key", "description": "Lokasign API key (esk_test_…)", "password": true }
  ],
  "servers": {
    "lokasign": {
      "type": "http",
      "url": "https://lokasign.net/mcp",
      "headers": { "Authorization": "Bearer ${input:lokasign-key}" }
    }
  }
}

Clients that only speak stdio

A client that starts MCP servers as local processes reaches a remote one through the mcp-remote bridge. Claude Desktop can do this too, in claude_desktop_config.json — but use the custom connector above where you can: over the bridge Claude shows no Lokasign box.

{
  "mcpServers": {
    "lokasign": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://lokasign.net/mcp", "--header", "Authorization:${LOKASIGN_AUTH}"],
      "env": { "LOKASIGN_AUTH": "Bearer <api_key>" }
    }
  }
}

The header value travels through env because some clients split arguments on spaces, and Bearer <api_key> would arrive broken.

Any other client that supports a remote MCP server over HTTP with a custom header works the same way: point it at the URL above and set Authorization (or X-Api-Key). Client configuration formats change with their releases — if a snippet here no longer matches, your client's own documentation wins.

Check it before wiring it up

With the MCP Inspector, no installation needed:

npx @modelcontextprotocol/inspector

It opens in your browser. Choose transport Streamable HTTP, enter https://lokasign.net/mcp, add the header Authorization: Bearer <api_key>, and connect: you should see the tools, the four guides under Resources, and the two prompts.

Or make one call by hand:

curl -X POST https://lokasign.net/mcp \
  -H "Authorization: Bearer <api_key>" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'

In all of these, use a test key (esk_test_…) while you are trying things out.

Two things worth knowing

All 31 tools arrive in one tools/list. The page size is set above the size of the catalogue on purpose: the whole list is about 47 KB, small enough that splitting it bought nothing and cost a failure with no symptom — a client that ignored nextCursor saw a short list and was told nothing about the rest.

Follow nextCursor anyway if your client is hand-rolled. It is absent today, and handling it costs one loop; that loop is what keeps you correct if the catalogue ever outgrows a page.

Tool names are the API's operationIds, verbatim: createSignatureRequest, getTemplate, listWebhookDeliveries. So a transcript can be checked against the API reference line by line, and an endpoint added to the API becomes a tool without anybody maintaining a list.

Files the person has: upload links

A tool call is JSON, so it cannot carry a file — and an AI client usually does not hold the bytes of a chat attachment anyway. That is why uploadDocument offers only document_url over this connection. For a file the person has, call createDocumentUpload: it returns an upload_url that takes one PDF within 15 minutes, with no API key.

Then call getDocumentUpload until status is completed, and use document.gid as documents[].document_gid in createSignatureRequest. A link takes exactly one file; a refused file (not a PDF, password-protected, too large) leaves it open for another try.

In Claude, the attachment travels this way without you opening anything once the sandbox may reach this host — see Let Claude upload chat attachments itself above.

Guides and prompts on the same connection

Besides the tools, the server offers the integration guides as resources and two ready-made prompts, so an agent does not have to be told where the documentation lives.

Resource What it is
lokasign://docs/LOKASIGN.md The integration context for AI assistants — read this first
lokasign://docs/quickstart From sign-up to a first executed agreement (Indonesian)
lokasign://docs/signing Email, iframe and WebView signing (Indonesian)
lokasign://docs/templates The .docx tag grammar, with tested samples (Indonesian)
Prompt Arguments Use
integrate-lokasign stack, goal (both optional) Start an integration: the agent loads the context, looks at your application through the tools, proposes a plan, then builds.
diagnose-lokasign-error error (required), call Explain a failed call and what to change.

Clients that support prompts list them in their prompt menu; Claude Code shows them as slash commands (/mcp__lokasign__integrate-lokasign).

Where to start once connected

The server tells the agent this when it connects, so you do not have to — but for your own reading, the usual order is: getApplication to confirm which application the key belongs to and what limits apply, then listTemplates → getTemplate → checkTemplateData → createSignatureRequest to send an agreement, and getSignatureRequest or webhooks to follow it. To have the person in the conversation sign a file they have: createDocumentUpload → getDocumentUpload → createSignatureRequest with fields placed by anchor and the signer as delivery: "embedded" → sendSignatureRequest → createSigningSession without embedder_origin. Three calls are deliberately left for a person to decide rather than an agent: activateTemplate, rotateWebhookSecret and voidSignatureRequest.