secure-proxy
Provides a pre-built Discord connection that lets the caller make authenticated, allowlisted Discord API requests, with the daemon injecting the caller's Discord credentials.
Provides a pre-built GitHub connection that lets the caller make authenticated, allowlisted GitHub API requests, with the daemon injecting the caller's GitHub credentials.
Provides a pre-built Google connection for authenticated Google API requests, including OAuth2 token minting with scopes and per-service connection tests.
Provides a pre-built Linear connection that lets the caller make authenticated, allowlisted Linear API requests, with the daemon injecting the caller's Linear credentials.
Provides a pre-built Notion connection that lets the caller make authenticated, allowlisted Notion API requests, with the daemon injecting the caller's Notion credentials.
Provides a pre-built OpenAI connection that lets the caller make authenticated, allowlisted OpenAI API requests, with the daemon injecting the caller's OpenAI credentials.
Provides a pre-built Slack connection that lets the caller make authenticated, allowlisted Slack API requests, with the daemon injecting the caller's Slack credentials.
Provides a pre-built Stripe connection that lets the caller make authenticated, allowlisted Stripe API requests, with the daemon injecting the caller's Stripe credentials.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Drawlatch
Alpha software: expect breaking changes between updates.
Drawlatch gives AI agents authenticated access to external APIs without giving them the credentials. A daemon holds your secrets and makes the API calls. Agents reach it through a local MCP server over an end-to-end encrypted, mutually authenticated channel, and can only call the URL patterns each connection allows.
32 pre-built connections (GitHub, Slack, Discord, Stripe, Notion, Linear, OpenAI, …) plus your own custom connectors. See CONNECTIONS.md.
Per-caller access control. Each agent identity (caller) sees only its own connections and secrets.
Real-time events. WebSocket, webhook, and polling listeners buffer events for agents to read. See INGESTORS.md.
Admin dashboard for callers, connections, secrets, and listeners, served by the daemon itself.
Using Callboard? Drawlatch is built in. Callboard manages connections, secrets, and agent identities through its UI, so you don't need to set up drawlatch separately.
How it works
Claude Code ◄─ stdio ─► MCP server (local, no secrets) ◄─ HTTP + E2EE ─► drawlatch daemon (holds secrets) ─ HTTPS ─► APIThe local MCP server holds only its caller keypair and the daemon's public keys. Each session starts with a handshake: Ed25519 signatures for mutual authentication, then X25519 ECDH to derive AES-256-GCM session keys. The daemon matches each request to an allowlisted connection, injects that connection's headers and secrets, and makes the call. All crypto uses Node's built-in crypto module.
Related MCP server: AI Service Gateway MCP
Quick start (single machine)
Requires Node.js 22 or later.
npm install -g @wolpertingerlabs/drawlatch
drawlatch init # server keypair, configs and .env in ~/.drawlatch
drawlatch set-password # dashboard password (at least 8 characters)
drawlatch start # start the daemon in the backgroundinit is idempotent and never overwrites existing files. Annotated examples: remote.config.example.json, proxy.config.example.json, and .env.example (append only the lines you need to ~/.drawlatch/.env; don't overwrite it, it also holds the dashboard password hash). It writes "host": "0.0.0.0", so the daemon listens on every interface (the dashboard is password-protected; set "host": "127.0.0.1" in ~/.drawlatch/remote.config.json for loopback only). It does not create a caller. Create one next.
Create a caller. The local MCP server authenticates as the caller named by MCP_KEY_ALIAS (default: default), using the keypair in ~/.drawlatch/keys/callers/<alias>/. Either:
Dashboard: open
http://127.0.0.1:9999/, go to Callers → New caller, name itdefault, then on Connections enablegithuband setGITHUB_TOKEN. Changes apply immediately.CLI:
drawlatch generate-keys caller default # In ~/.drawlatch/remote.config.json, set: "callers": { "default": { "connections": ["github"] } } echo 'DEFAULT_GITHUB_TOKEN=ghp_your_token' >> ~/.drawlatch/.env # secrets are prefixed with the caller alias drawlatch restart
Register the MCP server with Claude Code:
claude mcp add drawlatch -- node "$(npm root -g)/@wolpertingerlabs/drawlatch/dist/mcp/server.js"Add -e MCP_KEY_ALIAS=<alias> (before --) to use a caller other than default, and -e MCP_CONFIG_DIR=/abs/path for a config directory other than ~/.drawlatch. Use absolute paths: a ~ inside an MCP env value is not expanded.
Check the setup:
drawlatch doctor # config, keys, required secrets, daemon health
drawlatch status # PID, port, uptime, active sessions, dashboard URLThis repo is also a Claude Code plugin marketplace (.claude-plugin/): /plugin marketplace add WolpertingerLabs/drawlatch, then /plugin install drawlatch@drawlatch. Its MCP server is named secure-proxy and passes MCP_CONFIG_DIR and MCP_KEY_ALIAS through from your environment.
Daemon and MCP server on different machines
The MCP server reads PEM files only, so you exchange public keys by hand:
Client machine: install drawlatch, run
drawlatch generate-keys caller laptop, and create~/.drawlatch/proxy.config.jsonwith"remoteUrl": "http://<daemon-host>:9999"(see Proxy config). Don't runinithere; it would create an unrelated server keypair.Copy the client's
keys/callers/laptop/*.pub.pemto the daemon machine's~/.drawlatch/keys/callers/laptop/, and add"laptop": { "connections": [...] }to itscallers.Copy the daemon's
keys/server/*.pub.pemto the client's~/.drawlatch/keys/server/.drawlatch restarton the daemon, then register the MCP server on the client with-e MCP_KEY_ALIAS=laptop.
Traffic is encrypted end to end, but the dashboard cookie is not marked secure. Put the daemon behind a TLS-terminating proxy if you expose it beyond a trusted network.
Callboard instances use credential bundles instead: drawlatch issue-caller <alias> -o <alias>.drawlatch-caller.json (or Issue credentials on the dashboard's caller page), then import the file in Callboard. On the same host, --into <callboard keys dir> writes the key files directly. Issuing mints a new keypair and keeps only its public half, so issuing for an existing alias rotates its keys and deletes any private key drawlatch held for it. After a CLI issue, drawlatch restart so a running daemon accepts the new key; dashboard issues apply immediately.
A co-located Callboard can also provision itself. When the daemon starts with DRAWLATCH_LOCAL_CALLER_KEYS_DIR set and the caller named by DRAWLATCH_LOCAL_CALLER_ALIAS (default callboard-local; Callboard sets default) is missing from config or has no keys, drawlatch issues it and writes the caller keys to <dir>/callers/<alias>/ and the server public keys to <dir>/server/. DRAWLATCH_LOCAL_CALLER_CONNECTIONS (comma-separated) sets its connections. If that is unset, it keeps the existing entry's connections or copies the default caller's.
MCP tools
The local MCP server exposes these tools. Every call goes through the encrypted channel and runs as the authenticated caller.
Tool | Purpose |
| HTTP request to an allowlisted URL. Connection headers are injected for you. |
| The caller's connections: docs links, allowed endpoint patterns, the names of secrets that are set, auto-injected header names, |
| Run a connection's built-in credential check. Some cost a little credit; see CONNECTIONS.md. On an OAuth2 connection it mints a token first and reports |
| All built-in templates, with which are enabled for this caller and which secrets are set (booleans). Custom connectors aren't listed. Each entry's |
| Enable or disable a connection for this caller. Refused when the caller has |
| Set or delete (empty string) this caller's secrets. Write-only. Refused when the caller has |
| Which required and optional secrets are set for a built-in connection (booleans). |
| Read buffered listener events after a cursor. |
| State, buffer size, event counts, and errors for this caller's listeners. |
| Start, stop, or restart a listener. |
| Configurable listener fields per connection. |
| Read or change listener parameters. |
| Fetch dynamic choices for a listener field (for example, your Trello boards). |
| Manage multi-instance listeners. |
| Check a listener's configuration and credentials. |
| This caller's vault items: name, kind, exposure, field names, notes, tags, metadata, |
| Save a new vault item ( |
| Change a vault item. |
| Delete a vault item. |
| The values of a |
| Ask the operator for access to another caller's item ( |
| This caller's own access requests: |
| Cancel one of this caller's pending requests ( |
set_secrets and set_connection_enabled let an agent change its own caller's configuration, which can grant it more access: secrets resolve per caller by name, so a connection the agent enables for itself starts with any secret it shares a name with (a custom connector reading GITHUB_TOKEN picks up the token the caller set for github). The agent still can't read secret values or reach URLs outside the allowlists, and OAuth2 connections are operator-only even with selfManage allowed: the agent can't enable one or set its credentials, because OAuth2 credentials are shared by name (every caller's google connection reads GOOGLE_OAUTH_REFRESH_TOKEN, and a custom connector may read the same name). The built-in google counts as OAuth2 here in both of its auth modes: the agent can't enable it or set any of its four credentials. Set selfManage: false on a caller to refuse both tools to its agent. The dashboard can still make the change. Callers that drawlatch creates (dashboard New caller, issue-caller for a new alias, local Callboard provisioning) start with selfManage: false. A caller entry without the field allows both tools, so existing configs behave as before.
The daemon also accepts wait_for_events, a long-poll over all of a caller's event streams. The local MCP server doesn't expose it; long-running clients such as Callboard call it over the encrypted channel. See INGESTORS.md.
It likewise accepts ingest_logs, which appends records to the caller's audit log. The local MCP server doesn't expose it either. See Audit log.
The vault tools aren't gated by selfManage: they touch only the caller's own vault, and reaching another caller's item takes a grant that only the operator can give. No tool grants, denies, or revokes access.
Configuration
Config directory
Everything lives in ~/.drawlatch/, or $MCP_CONFIG_DIR if set:
remote.config.json daemon config: callers, custom connectors, host/port, rate limit, tunnel
proxy.config.json local MCP server config: daemon URL and timeouts
.env secrets (mode 0600), plus the dashboard password hash
keys/server/ the daemon's Ed25519 + X25519 keypair
keys/callers/<alias>/ one keypair per caller (public half only, when issued as a bundle)
logs/drawlatch.log daemon log (drawlatch logs)
data/sessions.json dashboard login sessions
audit/<caller>/ append-only audit logs shipped by callers (see Audit log)
vault.enc.json encrypted vault, created on the first save (see Vault)
keys/vault.key the vault's key, mode 0600, created with vault.enc.json (SENSITIVE)
drawlatch.pid PID of the background daemonEach key directory holds signing.{pub,key}.pem and exchange.{pub,key}.pem. Private keys are written 0600 and key directories 0700. On startup the daemon moves the legacy keys/local, keys/remote, and keys/peers/* layouts into this one.
Daemon config (remote.config.json)
Field | Default | Description |
|
| Bind address. Env override: |
|
| Listen port. Env override: |
|
| Encrypted requests per minute per session. Over the limit, the daemon returns |
|
| Caller aliases and what each may use (see below). |
|
| Custom connector definitions (see below). |
|
| Start a Cloudflare quick tunnel at boot. Env override: |
LOG_LEVEL in .env or the environment sets daemon log verbosity: error, warn, info (default), or debug.
The daemon re-reads remote.config.json for each new session and after dashboard changes. When drawlatch saves it (dashboard, tools), it writes a temp file next to it and renames it into place, so a reader never sees a half-written file. A symlinked remote.config.json is written through to its target, and the file's mode is kept. If the directory isn't writable but the file is, the file is written in place instead, with a one-time warning. Hand edits that add callers or change listeners need drawlatch restart.
Callers
{
"callers": {
"default": { "connections": ["github", "stripe", "internal-api"] },
"ci": { "name": "CI runner", "connections": ["github"] }
}
}Field | Description |
| Required. Built-in connection names or custom connector aliases. See Overlapping connections for two whose allowlists overlap. |
| Display name for logs and the dashboard. |
| Per-caller secret values (see Secrets). |
| Listener settings (INGESTORS.md). |
| Forward matching events to Claude Code remote triggers (INGESTORS.md). |
| Whether the caller's agent may run |
| Per-connection OAuth2 settings: |
| The built-in |
Caller public keys are read from keys/callers/<alias>/. Aliases must match ^[a-zA-Z0-9][a-zA-Z0-9_-]*$.
Secrets
Connections reference secrets as ${NAME} (for example, ${GITHUB_TOKEN}). For caller <alias>, the daemon looks up NAME in this order:
A literal value in the caller's
envmap:"env": { "GITHUB_TOKEN": "ghp_..." }.The environment variable
<ALIAS>_<NAME>, with the alias uppercased and-replaced by_. Examples:DEFAULT_GITHUB_TOKEN,MY_AGENT_GITHUB_TOKEN.
A bare GITHUB_TOKEN is never used. This keeps one caller from picking up another's credentials. The daemon loads .env at startup, so restart after editing it by hand. The dashboard and set_secrets write <ALIAS>_<NAME> to .env and apply the change immediately.
Agents can also keep their own secrets in a per-caller, encrypted vault. Vault items are separate from connection secrets: they don't resolve as ${NAME}. A request uses them as ${vault:<name>} instead (Using vault items in requests).
If a secret isn't set, its placeholder is sent literally (for example, Authorization: Bearer ${GITHUB_TOKEN}), and the upstream API will usually answer 401. An awsSigV4 connection without its signing keys fails the request instead of sending it. drawlatch doctor, drawlatch config, and the dashboard's Secrets page show what's missing. They check only built-in templates, and only secrets used in a template's headers or, for aws, its signing keys, or for google, the credentials of the auth mode the caller selects: custom connectors are skipped, and a token that goes in the URL (Telegram, Trello) isn't flagged. doctor also prints the unprefixed name ("Set GITHUB_TOKEN in …/.env"); whatever it says, set <ALIAS>_<NAME> (DEFAULT_GITHUB_TOKEN for the default caller).
Known issue: an
envvalue that redirects to another variable, such as"GITHUB_TOKEN": "${ALICE_TOKEN}", is ignored; the prefixed variable (<ALIAS>_GITHUB_TOKEN) is used if set. Status checks still report the redirected secret as set. Use a literal value or the prefixed variable instead.
Header-only secrets
A secret that a connection's own headers reference is header-only: it is injected into those headers, and nowhere else. A request may not reference it as ${NAME} in its URL, its headers, or a resolveSecretsInBody body; such a request is rejected before anything is sent, and the daemon logs the connection and secret name. Upstreams echo identifiers back in error messages: Drive's GET https://www.googleapis.com/drive/v3/files/<id> answers File not found: <id>, so a header token written into such a URL would otherwise come back to the agent.
Header-only secrets are one kind of withheld secret. The others are a webhook listener's signatureSecret, anything a connector lists in withheldSecrets (the slack template lists SLACK_APP_TOKEN, which Socket Mode reads directly), any secret whose value contains a withheld value of 4 or more characters, and AWS SigV4 signing keys and OAuth2 credentials, which, unlike the others, don't resolve in headers or listener configs either: only drawlatch's signer or token manager reads them. list_routes reports them as withheldSecretNames. placeholderSecrets releases only header-only secrets, not the other kinds.
Scrubbing. Withheld values, and on an OAuth2 connection the minted access token (as ${OAUTH2_ACCESS_TOKEN}), are replaced with ${NAME} in response bodies, statusText, and listener output: buffered events (poll_events, wait_for_events, triggers) and ingestor_status errors, which are scrubbed of every secret.
JSON bodies, including
+jsontypes such asapplication/problem+json, are parsed, and their string values and keys are scrubbed.Text bodies, headers,
statusText, URLs and error messages are scrubbed of every form of the whole value that can appear on the wire:as-is, and
encodeURIComponent-encoded;as a URL path serializes it (
'and|kept, a space as%20,"as%22,\as/);as a URL query serializes it (
'encoded too);form-encoded (a space as
+), and as a form parser decodes the query form (a+as a space, and%XXescapes decoded, so a value written%41%41%41%41is also scrubbed asAAAA);as UTF-8 read back as Latin-1 (how a non-ASCII header value can echo);
each of those JSON-string-escaped (with and without
\/).
Only whole values are scrubbed, never a piece of one, so ordinary text that happens to contain part of a secret (
SummerfromSummer#2024!xyz) is left alone. The catch, for${VAR}connection secrets: URL parsing cuts a value at a#and splits it at a?into path and query parts, and an&splits a query value into parameters. An upstream that echoes only one part (say, the decoded path) hands that part back as is. Don't put a connection secret containing#,?or&in a URL; send it in a header instead. Vault values containing one are refused in a URL, so the gap doesn't apply to them.Scrubbing is best-effort defense in depth: base64, case-changed, or otherwise transformed copies aren't recognised, and values under 4 characters are never scrubbed.
Secrets a request may reference are left alone in bodies and events, since the caller can use them by design and many are ordinary values (REDDIT_SUBREDDIT, TWITCH_USER_ID) that appear in real responses. Values that are public but sent in a header are withheld too: Twitch's Client-Id and Reddit's User-Agent show up as ${TWITCH_CLIENT_ID} and ${REDDIT_USER_AGENT} in responses. A custom connector that needs them verbatim lists them in placeholderSecrets.
Built-in templates that authenticate in the URL keep working, because their tokens aren't in headers: Trello (?key=${TRELLO_API_KEY}&token=${TRELLO_TOKEN}) and Telegram (/bot${TELEGRAM_BOT_TOKEN}/). An upstream can still echo those back.
Template requests. testConnection, testIngestor, and listenerConfig option lookups come from the connection, not the agent. They run against their own connection only, may use withheld secrets (never signing keys), and their headers override the connection's headers of the same name, so Slack's listener test sends its app token instead of the bot token. Their responses are still scrubbed. Listeners also receive withheld secrets (the Discord gateway needs its bot token).
Upgrading custom connectors. A custom connector whose agents were told to write a header secret into a URL, body, or request header now has those requests rejected. If the API really needs the secret there, list it in placeholderSecrets. At startup the daemon logs a warning, and drawlatch doctor fails a check, for a connector whose description, name, or listenerConfig.description references a withheld secret, or whose placeholderSecrets entry can't take effect. It suggests placeholderSecrets only for a secret withheld because the headers use it; the other kinds can't be released.
Custom connectors
Use these for APIs without a built-in template, or to override one: a connector whose alias matches a built-in name replaces that template.
{
"connectors": [
{
"alias": "internal-api",
"name": "Internal Admin API",
"allowedEndpoints": ["https://admin.internal.example/**"],
"headers": { "Authorization": "Bearer ${ADMIN_KEY}" },
"secrets": { "ADMIN_KEY": "${ADMIN_KEY}" }
}
]
}With this connector, caller default reads ADMIN_KEY from DEFAULT_ADMIN_KEY.
Field | Description |
| Required. Name referenced from a caller's |
| Required. URL globs: |
| Headers injected into every request. |
| Sign every request with AWS Signature Version 4: |
| Mint the bearer token from OAuth2 client credentials instead of a static header. See OAuth2 token minting. |
|
|
| Extra secret names to withhold from request URLs, headers, and bodies, like header-only ones. They still resolve in |
| Header secrets that requests may also reference as |
| Resolve |
| Default outbound timeout for this API, and the most a caller may request (see Request timeouts). |
| Shown to agents by |
| Credential test and event listener definitions. Built-in templates in |
| Several named credential tests instead of one: |
Upgrading: URL matching. Request URLs are matched, and sent, in the form the URL parser produces (see Security model). A pattern's scheme and host are compared the same way (case-insensitive, :443/:80 and a trailing dot ignored), so https://API.example.com:443/** keeps working. Paths and queries are not rewritten in patterns, though, and the parser percent-encodes some characters in requests: a space becomes %20, { and } become %7B/%7D, ", <, > and ` are encoded, and ' is encoded in the query. A custom pattern that spells one of those literally (https://api.example.com/search?q=a b*) no longer matches; write the encoded form (q=a%20b*) or use a wildcard.
AWS SigV4 signing
AWS APIs need a signature computed per request, so a static header can't authenticate them. A connector with awsSigV4 gets one from the daemon instead. After the URL, headers, and body are final, the daemon signs the exact bytes it sends and adds Authorization, X-Amz-Date, X-Amz-Content-Sha256 (the SHA-256 of the body), and X-Amz-Security-Token when a session token is set. The built-in aws template uses it.
Credentials are the connector's
AWS_ACCESS_KEY_IDandAWS_SECRET_ACCESS_KEYsecrets, plusAWS_SESSION_TOKENfor temporary credentials. They resolve per caller like any other secret, so"AWS_ACCESS_KEY_ID": "${PROD_AWS_ACCESS_KEY_ID}"insecretspoints a connector at different variables. The first two count as required. If either is missing, the request fails without being sent. Only the signer reads these three. They, and any other secret whose value contains one of them, are never substituted for${VAR}in a URL, a header, a connector's ownheaders, a body withresolveSecretsInBody, or a listener's requests; a request that references one is rejected.Service and region come from the request hostname:
<service>.<region>.amazonaws.com,<id>.<service>.<region>.amazonaws.com(API Gateway, SageMaker runtime),<id>.<region>.<service>.amazonaws.com(OpenSearch), interface VPC endpoints (vpce-….<service>.<region>.vpce.amazonaws.com), and S3's virtual-hosted, path-style, dual-stack, and legacys3-<region>hosts, withs3-outpostsands3-object-lambdaas their own signing names. A global endpoint such assts.amazonaws.comoriam.amazonaws.comsigns forus-east-1, andiam.us-gov.amazonaws.comforus-gov-west-1. A few endpoint prefixes map to a different signing name (bedrock-runtimeandbedrock-agent*→bedrock,email→ses,aps-workspaces→aps). For anything else, setserviceandregionexplicitly, which overrides the inference for every request on that connector.Reserved names. A request may not set
Authorization,Host,X-Amz-Date,X-Amz-Content-Sha256, orX-Amz-Security-Token, or carry presigned-URL query parameters (X-Amz-Signature,X-Amz-Credential, and so on). Such a request is rejected. Otherx-amz-*headers, such asX-Amz-Targetorx-amz-meta-*, are sent and signed.What's signed:
host, every header sent except hop-by-hop ones (connection,user-agent,content-length, and similar), and the body. A string body is sent as UTF-8, with fetch's defaulttext/plain;charset=UTF-8content type unless you set one. Multipart uploads are serialized before signing. Paths are normalized and encoded per segment as SigV4 requires. S3 paths are encoded once and not normalized. S3 keys with a.or..path segment (including%2E%2Eforms) are unsupported: every request with one is refused before it is parsed or signed (see Security model).Redirects aren't followed, even to the same host: the signature covers the original URL. A 3xx comes back to the caller with its
Locationheader (see Redirects).
OAuth2 token minting
A connector with an oauth2 block gets its Authorization: Bearer token from the daemon, which runs an OAuth2 grant against the provider's token endpoint and caches the result. The agent never sees the client credentials, the refresh token, the service-account key, or the minted access token. The google connection is built on this: its route is composed per caller from callers.<alias>.google into one ordinary oauth2 route; see CONNECTIONS.md → Google.
{
"connectors": [
{
"alias": "acme",
"allowedEndpoints": ["https://api.acme.example/v2/**"],
"secrets": {
"ACME_CLIENT_ID": "${ACME_CLIENT_ID}",
"ACME_CLIENT_SECRET": "${ACME_CLIENT_SECRET}",
"ACME_REFRESH_TOKEN": "${ACME_REFRESH_TOKEN}"
},
"oauth2": {
"tokenUrl": "https://auth.acme.example/oauth/token",
"grant": "refresh_token",
"clientAuth": "body",
"secretRefs": {
"clientId": "ACME_CLIENT_ID",
"clientSecret": "ACME_CLIENT_SECRET",
"refreshToken": "ACME_REFRESH_TOKEN"
},
"scopes": ["items.read", "items.write"]
},
"testConnection": { "url": "https://api.acme.example/v2/me" }
}
]
}Field | Description |
| Required. The token endpoint. Must be |
| Required. |
| Required for |
| Required. Names of keys in |
| Scopes to request. Sent as |
| Refuse a token whose response doesn't say which scopes it grants. Default |
|
|
|
|
| Mint a new token this long before the cached one expires. Default |
Unknown fields are rejected. An invalid block on a built-in template fails when it loads; on a custom connector it drops that connection for each caller, with a message in the daemon log at boot.
Credentials are signer-only. Every
secretRefssecret, and any secret whose value contains one, is never substituted for${VAR}anywhere: not in a request URL, header, or body, not in the connector's ownheaders, not in a listener config. A request that references one is rejected. They count as required secrets for a built-in template.Not combinable with an
Authorizationentry inheaders, a header that references a credential,awsSigV4, orresolveSecretsInBody. NoallowedEndpointspattern may match the token endpoint URL: checked against the URL with a query, with a trailing slash, and with its host written with or without a trailing dot. Other paths on the same host are fine (Dropbox, Box, and X serve their API and token endpoint from one host). A pattern withoutscheme://hostmatches every host and is refused. Only apolllistener is allowed: a webhook or websocket listener would make its own requests (webhook auto-registration, a gateway connect) without the token, so it is refused until supported.Requests: a request may not send
Authorization(any case) or anaccess_tokenquery parameter. The token is minted after every other check, so a rejected request never mints one.Scopes: a token whose granted
scopeincludes anything not requested is refused, whateververifyGrantedScopessays, and so is one withoutscopewhen verification is on. Fewer scopes than requested is accepted, andtest_connectionlists the missing ones. Per caller,oauth2Overridesnarrows the requested scopes; widening them takes a custom connector.Caching: tokens are kept in memory only, per caller, connection, grant, token URL, credentials, and scopes, so rotating a secret or changing scopes mints a new token instead of serving the old one. Verification and skew settings are part of the key too. A rotated refresh token returned by the provider is used until the configured one changes; it is lost on restart, and forgotten after 30 days unused. Concurrent requests for the same token share one token-endpoint call, and
refresh_tokenrequests that share a refresh token (two callers, two connections, two scope sets) go one at a time, each sending the latest rotation, so a provider that rotates (or revokes a reused token's family) never sees the same refresh token twice.Retries: a
401from the API mints a fresh token and resends the request once. It doesn't when the current token is under 30 s old (an agent can make any allowlisted URL answer401, and must not be able to turn that into a token request per call) or when another request already replaced the token that got the401; the401is returned as is. Anything else,403included, isn't retried. A403result carries ahintnaming the token's scopes.Scrubbing: the minted token is replaced with
${OAUTH2_ACCESS_TOKEN}in response bodies, headers, the final URL, and error messages, like a withheld secret.Token endpoint: called without following redirects, with a timeout, and reading at most 64 KiB of response. Errors name the connection, the HTTP status, and a recognised OAuth2 error code (
invalid_grant,invalid_scope,invalid_client,unauthorized_client,access_denied,admin_policy_enforced, Google'sinvalid_rapt) with a fixed hint. They never include the response body. Those codes are terminal: the same credentials aren't tried again for 60 s.Listeners: poll listeners on an
oauth2connection get managed tokens too (INGESTORS.md). Other listener types are refused (see above).Overlapping connections: if more than one of a caller's connections matches a request URL and any of them is OAuth2, the request is refused with an error naming them, rather than using whichever is listed first. See Overlapping connections.
Service accounts (jwt_bearer)
The daemon signs an RS256 JWT assertion with the service-account key (RFC 7523) and exchanges it at tokenUrl for an access token; there is no refresh token.
Key format: the
serviceAccountKeysecret holds base64 of the JSON key file (base64 -w0 key.json), which survives.envfiles and the dashboard's single-line input. The JSON itself is accepted too, including after a.envround trip has turned its\nescapes into real newlines. A malformed key fails with one fixed message naming only the secret, never its content. Only the signer reads the key: like everysecretRefssecret it is never substituted anywhere.Claims:
issis the key'sclient_email,scopethe connection's scopes,audthe connection'stokenUrl(never the key file'stoken_uri),iatnow, andexpan hour later.subis present only whensubjectis set, which only admin config can do: a custom connector'soauth2.subject, the caller'soauth2Overrides[alias].subject, or itsgoogle.subject.Caching: the token cache key includes the subject and a fingerprint of
client_email,private_key_id, and a hash of the private key, so a new key or subject mints a new token.Errors carry service-account hints:
unauthorized_clientmeans the service account isn't authorized for domain-wide delegation in the Admin console;access_deniedmeans the requested scopes aren't authorized for its client ID there;invalid_grantmeans the key is revoked, the subject isn't a user in the domain, or the daemon's clock is off.
Constant ( | Value | Meaning |
|
| Longest one token-endpoint request may take. A request's remaining budget can make it shorter. |
|
| How long a terminal token failure is remembered before the same credentials are tried again. Changing a secret or scopes clears it. |
|
| Default |
|
| Largest |
|
| A |
|
| A rotated refresh token unused this long is forgotten. |
|
| Largest token-endpoint response read. |
Overlapping connections
A request goes to the first of the caller's connections whose allowedEndpoints match its URL, in connections order. When two connections can match the same URL, that order silently decides which credential the request carries.
The daemon logs a warning at boot for each pair of a caller's connections with a pair of allowlist patterns that can match a common URL, naming the patterns. Hosts are compared as globs and paths by their literal prefix up to the first wildcard; a wildcard host on both sides, or a pattern without
scheme://host, counts as overlapping. Among the built-in templates, the overlapping ones are alternatives for one API:discord-botanddiscord-oauth. Enable one per caller. Within thegoogleconnection, services on one host (Calendar and Drive, both onwww.googleapis.com) don't overlap; a custom connector on a path a caller'sgoogleselection allows (sayhttps://www.googleapis.com/drive/v3/**next todrive: "read") does, and its requests there are refused.If an OAuth2 connection is among the matches for a request, the request is refused with an error naming the connections. Narrow the allowlists or remove one of the connections. The check compares the URL in parsed form, so host case, an explicit default port, or a trailing dot don't dodge it, but it is best-effort: a path spelled differently (
/%63alendar/for/calendar/) matches patterns only as written, so don't rely on the refusal to keep two connections apart. Non-overlapping allowlists do.Between connections without OAuth2, the first match still wins, as before.
Proxy config (proxy.config.json)
Read by the local MCP server, which won't connect without this file. init writes it. Fields missing from the file fall back to these defaults.
Field | Default | Description |
|
| Daemon URL. |
|
| Handshake timeout (ms). |
|
| Local → daemon deadline (ms) for calls that don't pass |
Keys are read from keys/callers/<MCP_KEY_ALIAS or "default">/ and keys/server/.
Request timeouts
A proxied call has three nested deadlines. The innermost fires first, because only the daemon's outbound fetch can actually cancel the upstream call:
Layer | Deadline | Default |
daemon → upstream API | per-call |
|
MCP server → daemon |
|
|
MCP client → MCP server | your client's tool timeout ( |
|
The MCP server sends the daemon an outbound budget of its own deadline minus 5 s, so the outbound leg always finishes first. Passing
timeoutMswidens the local deadline to match.exa,firecrawl, andparallelallow up to 120 s, andperplexityup to 180 s. All four exceed the MCP client's 60 s default, so raiseMCP_TOOL_TIMEOUTto use the full ceiling. They already fit under the defaultrequestTimeout. For long jobs, prefer the API's async submit-and-poll endpoints.list_routesreports each connection'sdefaultTimeoutMsandmaxTimeoutMsunder the current budget.On an OAuth2 connection, minting the token (and re-minting after a
401) comes out of the same deadline as the API call, and a single token request is further capped atOAUTH2_TOKEN_TIMEOUT_MS(10 s).test_connectiondoes the same: its test request gets what minting left of the budget.The 290 s outbound maximum sits below undici's internal 300 s headers timeout, which would otherwise fire first with an opaque error.
A timed-out call is cancelled at the socket and reported as
Upstream request timed out after <n>ms. If the local budget was the binding limit, the error names the setting to raise. A host that never accepts the connection is reported asUpstream never accepted the connection.The MCP server accepts
timeoutMsonly as a positive integer up to 290000. The daemon treats invalid values from other clients as unset. A malformedrequestTimeoutMson a connection falls back to 25 s; it doesn't remove the ceiling.
Redirects
The daemon follows redirects itself rather than leaving them to fetch, whose default forwards every header except Authorization and Cookie to wherever Location points. For a proxied request (secure_request, test_connection, test_ingestor, resolve_listener_options), each hop is checked first:
Allowlist: the target must match the same connection's
allowedEndpoints, on the same host or another one.No downgrade: an
httpsURL never redirects tohttp, even on the same host.Cross-origin headers: when the scheme, host, or port changes, only
Accept,Accept-Language,Content-Language,Content-Type, andUser-Agentgo along, and only when their value contains none of the connection's secrets. Connection headers such asx-api-key,Circle-Token,DD-API-KEY, or Twitch'sClient-Id, and caller headers with resolved placeholders, are dropped for that hop and every later one. A same-origin hop keeps all headers, and so does a plain upgrade fromhttpon port 80 tohttpson port 443 with the same hostname. Any other port change counts as cross-origin.Method and body: 301 and 302 turn a
POSTinto aGET, 303 turns anything butGETorHEADinto aGET, and both drop the body and its content headers. 307 and 308 resend the method and body, multipart uploads included. IfresolveSecretsInBodysubstituted a secret into the body, a 307 or 308 to another origin isn't followed, since the body would go there as-is.Limit: at most 5 hops.
A hop that fails a check isn't followed and isn't an error. The 3xx comes back as the result, with its Location header, and the target is never contacted. Secrets in response header values, such as a refused Location that echoes ?key=… back, are shown as ${NAME}, both as-is and URL-encoded. Response bodies are scrubbed of withheld secrets only. When redirects were followed, the result has a url field with the final URL, scrubbed the same way.
awsSigV4 connections never follow redirects, and an OAuth2 token endpoint is never followed either. Listener requests (polls, webhook auto-registration, Slack Socket Mode connect) and trigger dispatch follow redirects only on the request URL's own origin; see INGESTORS.md.
Audit log
Callers can ship durable log records to the daemon with the ingest_logs tool (Callboard uses it for permission-review decisions). It is write-only: no tool reads, lists, changes, or deletes what is stored. Read the files on the daemon's machine.
The input mirrors OTLP's ExportLogsServiceRequest in its JSON encoding (resourceLogs[].scopeLogs[].logRecords[], hex traceId/spanId, uint64 times as decimal strings, proto3 JSON spellings such as "NaN" doubles and SEVERITY_NUMBER_* names). A record may also carry a parentSpanId, which OTLP lacks. The reply mirrors ExportLogsServiceResponse: {} when everything was stored as sent, else { "partialSuccess": { "rejectedLogRecords": <n>, "errorMessage": "…" } }. Only a non-object input or a non-array resourceLogs fails the whole call.
Validation keeps data rather than dropping it, as OTLP requires of receivers. An unknown field is stored under extra and a known field with an invalid value under invalid ({"reason", "raw"}), both keyed by path such as logRecord["spanID"], resource["entityRefs"] or logRecord.attributes["latency"] (client-chosen keys are JSON-quoted, so a key containing . can't collide with nested data). At most 128 unknown fields per object and 256 entries per map are kept; past that the line is marked truncated. Those records are stored and reported in errorMessage as kept: … warnings with rejectedLogRecords: 0. A record is rejected (rejected: …) only when it isn't an object, sits under a container that isn't one, or is over a size limit.
Records go to audit/<caller>/<YYYY-MM-DD>.jsonl (UTC day of receipt), one JSON object per line. Files are 0600 and directories 0700. Each append is fsync'd before the reply, and so is the directory when a file is created. A line looks like this (wrapped here):
{"drawlatch.caller":"callboard","drawlatch.received_at":"2026-10-11T12:00:00.000Z","drawlatch.sequence":42,
"drawlatch.source":"client","time_unix_nano":"1760184000000000000","severity_number":9,"severity_text":"INFO",
"event_name":"permission.review.result","trace_id":"…","span_id":"…","parent_span_id":"…",
"body":{"verdict":"approve"},"attributes":{"tool.name":"Bash"},"resource":{"service.name":"callboard"},
"scope":{"name":"callboard.permission-review","version":"1"}}The drawlatch.* fields are set by the daemon: the caller is the authenticated session's, sequence counts up within each file, and source is client for caller records. The daemon's own lines (quota_exceeded below, and vault events) have source: "daemon". Everything else is what the client sent, flattened (attribute lists become objects, AnyValues become plain JSON; an intValue too big for a JSON number stays a string). Optional fields are left out when absent. Use jq, for example jq -c 'select(.trace_id == "…")' ~/.drawlatch/audit/*/*.jsonl.
Limits: 1000 records and 4 MiB stored per call, and 256 KiB per line (the shared resource and scope count toward every line under them). Records past a limit are rejected. Strings over 16 KiB are cut and end in …[truncated]; past 128 attributes or keys, 256 array items, or 8 levels of nesting, the extra is dropped. Any of these adds "truncated": true to the line. A call counts as one request against rateLimitPerMinute.
Each caller also has a stored-bytes budget: a 16 MiB burst refilling at 192 KiB a minute (about 270 MiB a day). Records past it are rejected with audit byte budget exhausted, and the daemon records the gap itself with a line clients can't write:
{"drawlatch.caller":"callboard","drawlatch.received_at":"…","drawlatch.sequence":43,"drawlatch.source":"daemon",
"drawlatch.event":"quota_exceeded","rejected_records":120,"rejected_bytes":4194304,
"window_start":"…","window_end":"…","budget":{"capacity_bytes":16777216,"refill_bytes_per_minute":196608}}There is at most one such line per caller per minute, covering every refusal since the last one. The first refusal after a quiet minute is recorded in the same append that answers the call. Later ones wait for a timer, which writes them even if the caller stops sending. Whenever a marker write fails, the timer retries with backoff (1 s doubling to 5 min) until it succeeds.
On SIGTERM or SIGINT (drawlatch stop sends SIGTERM):
ingest_logsstops accepting calls and answersserver shutting down; retry after restart. Callboard keeps the batch and resends it after the restart.A call already in progress writes its marker in the same append that answers it.
Pending counts are written before the daemon closes its port, again after it closes, and once more if it reaches its 10 s forced exit. Each attempt waits at most 2 s, so a held-open connection can't hold them back.
drawlatch stopwaits 15 s before falling back to SIGKILL, longer than the daemon's own shutdown.
So once a shutdown has begun, every refusal is on disk before the daemon exits, unless the day's marker allowance is used up or the disk keeps failing. What can still be lost is the counts waiting for the timer when the daemon is SIGKILLed or crashes, or the machine loses power: up to a minute of refusals for each caller over budget, or longer while a failing disk keeps the timer retrying. These lines come from a separate 1 MiB-a-day allowance, not the caller's budget. jq 'select(."drawlatch.source" == "daemon")' finds them.
Every authenticated caller can write to its own log; there is no per-caller switch. Records carry the client's own timestamps, but only the drawlatch.* stamps are the daemon's. Anyone holding a caller's private key can add records as that caller, but not change or remove existing ones. Within the budget they can also crowd out real records; the quota_exceeded lines make that visible on the hub.
Vault
Each caller has its own vault: named items (passwords, tokens, notes, key/value sets) that its agent saves and manages with the vault_* MCP tools. A caller sees only its own items, plus the items the operator has shared with it. No tool lists or changes another caller's vault.
Items. An item has a name (1-64 letters, digits, _ or -, starting with a letter or digit, unique within the caller's vault; constructor and prototype are reserved), a kind, secret values, and plain-text notes, tags, and metadata:
|
|
| exactly |
|
|
| 1-16 fields named |
Everything in values is secret, username included, and only field names ever leave the daemon. notes, tags, and metadata are not secret: vault_list returns them, so don't put secrets in them. An item also has a stable id (it survives a rename), createdBy (agent or admin), createdAt, updatedAt, and valueUpdatedAt (the last change to values), and an optional connections list: the connections the item may be used on (binding).
Exposure. inject (the default) means no tool ever returns the value: not vault_list, not vault_get, not any other tool. reveal means the caller's agent can read it back with vault_get, and every such read is written to the caller's audit log first; if that write fails, vault_get fails and returns nothing. Items of either exposure can be used in requests as ${vault:<name>} (below).
Agents can only tighten. On the agent's side, vault_update may change exposure from reveal to inject but never back, and may add a connections list or narrow one but never widen or remove it. Otherwise an inject item could be switched to reveal and read. Only the operator can loosen an item, on the dashboard's Vault page or through the admin API.
What the agent saves passes through its own context: vault_create and vault_update carry the values. inject keeps a saved value out of later responses, not out of the conversation that saved it. For a secret the agent should never see, create the item on the dashboard instead (Vault → New item): it is stored with createdBy: "admin" and the agent can only use it by reference.
Limits (errors name the field and the limit, never the value): 64 KiB per field, 128 KiB per item, 500 items per caller, 32 MiB for the whole vault; notes 4 KiB; 16 tags of up to 64 characters; 32 metadata entries, keys up to 64 and values up to 256 characters. Every field of an inject item must be at least 4 characters long.
Storage. The vault is one file, vault.enc.json, holding every caller's items in a single AES-256-GCM envelope:
{"format":"drawlatch-vault","version":1,"alg":"aes-256-gcm","keyId":"3fa1c09e7b2d4e51",
"iv":"…","tag":"…","ciphertext":"…"}Item names, notes, and tags are encrypted too; only the header is plain. The key is keys/vault.key: 32 random bytes, base64 on one line, mode 0600. The daemon creates both files on the first successful save, not at init or startup, and never creates a key while vault.enc.json exists. keyId is a public fingerprint of the key (the first 8 bytes of a SHA-256 over it), so a file paired with the wrong key fails with a key-id message rather than a decryption error. Every save writes a temporary file (mode 0600) and renames it over the old one, so a crash leaves the old vault or the new one, never a torn file, and nothing on disk is ever plaintext. Only the daemon reads or writes the vault; two daemons on one config dir aren't supported (the PID file prevents it).
If keys/vault.key is missing while vault.enc.json exists, every vault tool fails with Vault key keys/vault.key is missing; restore it from backup. and everything else keeps working. A key file readable by group or others is refused with the chmod to fix it. A vault file from a newer drawlatch is refused. drawlatch doctor checks that the key is present when the file is, that the key is 0600, and that the file decrypts, and prints the key id and item count (never the key).
Backup and key loss.
Back up
vault.enc.jsonanywhere: it's useless without the key.Back up
keys/vault.keyseparately, for example in a password manager (cat ~/.drawlatch/keys/vault.keyis a single base64 line). Anyone with both files can read every caller's vault.Lose the key and the vault is gone. There's no recovery. To start over, move the old file aside (
mv vault.enc.json vault.enc.json.lost); the next save creates a new key and an empty vault.Syncing the whole config dir also syncs the key (and
.env, which is already plaintext). Excludekeys/from sync if you want the vault backup to be safe.
Deleting a caller (dashboard, DELETE /api/admin/callers/:alias) deletes its vault items too, revokes every grant to or from it, withdraws every pending request by it or for its items, and drops its own request history, so a new caller with the same alias starts empty and inherits no access. If the vault can't be read (its key is missing, say), the deletion fails and the caller is left in place.
Audit events. Vault events are daemon lines (drawlatch.source: "daemon") in the owner's audit log, whoever acted. They carry vault.owner, vault.item (the name at the time), vault.item_id, vault.actor (a caller's alias, or admin for the dashboard), and vault.via (mcp or admin; for a vault_get with a purpose, that purpose, such as git-credential, with vault.via_asserted: true, since it's the client's claim), plus:
| Extra fields |
|
|
|
|
|
|
|
|
|
|
Request events are written only when the owner has a vault, so a request naming a made-up caller creates no audit directory. Events never carry a value, ciphertext, or key, and don't count against the caller's ingest_logs byte budget.
Using vault items in requests
A secure_request can reference the caller's own vault items. The daemon substitutes the value on the way out, and the value never comes back to the agent:
Placeholder | Resolves to |
| The item's |
| That field, for example |
| Another caller's item, when an active grant shares it with this caller (at either mode). The caller's own alias as |
Names, owners, and fields can't contain /, ., :, or }, so a placeholder parses only one way.
Where in the request |
|
URL path and query | Resolves, unless the value contains |
URL scheme, user info, host, port | Refused: |
Request headers | Resolves. |
Body (string, JSON, multipart | Resolves only when the connection sets |
| Never: sent as written. |
Connection headers, template requests ( | Never: sent as written. |
Checked before sending. Every placeholder in a position where it resolves is looked up before anything is sent, OAuth2 token minting included. A placeholder for an item that doesn't exist, a field the item lacks, a malformed placeholder, another caller's item that isn't shared with the caller, or an item bound to other connections fails the request with the position, the placeholder, and the reason, for example
Header "X-Key" references ${vault:nope}, which can't be used: no such item "nope" in your vault.Unlike an unknown${VAR}, an unknown vault placeholder is never sent literally. A request without one doesn't read the vault at all, so it works even when the vault key is missing.No URL delimiters in a URL. A value containing
#,?or&is refused in the URL path or query, before anything is sent:The request URL references ${vault:pw}, which can't be used: it contains a URL delimiter (#, ? or &); send it in a header instead.URL parsing would cut such a value or split it across components, and an echo of one piece couldn't be scrubbed. The message never says which character. The same value works in a header, or in a body where the connection resolves placeholders.One pass.
${VAR}and${vault:…}placeholders are substituted together, over the string as written. A vault value containing${GITHUB_TOKEN}is sent as is, and so is a connection secret containing${vault:x}.${VAR}placeholders work as before: withheld ones are refused, unknown ones are sent literally.Same checks after. The substituted request goes through every usual check: the URL is matched against the allowlist again (a value that adds a
..segment is refused), header values with a carriage return, newline, or NUL are refused by header name, and SigV4 signs the final request.Scrubbing. Every substituted value,
revealitems included, is handled like a withheld secret. It's replaced with${vault:<owner>/<name>.<field>}(for example,${vault:alice/gh-token.value}) in the response body, headers,statusText, the final URL after redirects, and error messages, in every whole-value wire form listed under Scrubbing, so an upstream that echoes the request URL as it received it doesn't hand the value back. A header carrying one is dropped on a cross-origin redirect, and a body carrying one isn't resent to another origin by a 307 or 308. Scrubbing is best-effort in the same way, and skips values under 4 characters (only arevealitem can have one).Binding. When an item has a
connectionslist, it resolves only on those connections:item "gh-token" is not allowed on connection "slack" (it is bound to "github"). Without one, it resolves on any connection the caller has. An agent can add or narrow a binding, never widen or remove it.Round trips. Scrubbing covers echoes in the same response only. An agent can still write an injected value into a resource on an API that accepts writes (a card titled with
${vault:x}through a query parameter, say) and read it back in a later request. Trello's and Telegram's URL tokens have the same gap. Bind a sensitiveinjectitem to the one connection that needs it.Before this version
${vault:…}meant nothing and went out literally. A request that still contains one where it resolves is now refused unless the item exists.Another caller's item. Without an active grant, the request fails with one answer whether or not the item exists:
no such item "gh" shared with you by "alice" (using another caller's item needs a grant from the operator; ask with vault_request_access). Each use is written to the owner's audit log asvault.injectbefore anything is sent; if that write fails, the request fails and nothing is sent. Right before sending, the daemon checks the vault again, so a revoke, delete, rename, rebind, or value change that lands while the request is being prepared fails it rather than sending past it. The item'sconnectionsbinding applies to the grantee too. The line is written only once every other check has passed: a request refused before sending (a value with a URL delimiter in the URL, a..segment, a carriage return or newline in a header, a binding mismatch, and so on) leaves novault.injectline in the owner's log. So a grantee can learn, one refused request at a time, whether the value has such a character, without the owner's log showing the attempts.Own-item uses aren't written to the audit log per request. The daemon's
[audit]request line names the tool, not the values.
Access requests and grants
An agent can ask for another caller's item. Only the operator, on the dashboard, can approve.
bob's agent calls
vault_request_accesswithowner: "alice",name: "forgejo-token", areason, and optionallymode: "reveal"(the default isinject). It gets{requestId, status: "pending"}.The request appears on the dashboard's Vault → Requests tab, with the reason labelled as text the requesting agent wrote.
The operator grants it (choosing the mode) or denies it (with an optional note bob sees in
vault_list_requests).Once granted, bob uses the item as
${vault:alice/forgejo-token}insecure_request, within the item'sconnectionsbinding, and sees it invault_list'sshared. At moderevealit can also read the value withvault_getandowner: "alice".The operator can revoke the grant at any time (Vault → Grants). The next request or
vault_getfails.
No existence oracle when asking.
vault_request_accessanswers the same way whether or not alice has that item and whether or not a caller named alice exists, and at that pointvault_list_requestsshows the same thing for both: apendingrequest. Later they can differ. If alice deletes the item, a request for it turnswithdrawnwhile a request for an item she never had stayspending, which shows the first item existed. If the operator deletes the caller alice, every pending request to her turnswithdrawn, while a request naming an alias that never was a caller stayspending, which shows alice existed. A request that stayspendingdoes so until the operator denies it or the requesting agent cancels it. The operator sees "no such item" and can only deny. Asking for your own item is refused.One pending request per requester, owner, and item name: asking again returns the existing request unchanged. If an active grant already covers the mode asked for, the answer is
{status: "granted"}and nothing is created. After a deny or a cancel, a new request may be made. Each requester may have at most 20 pending requests.Effective mode is the lower of the grant's mode and the item's exposure. Reveal can be granted only on a
revealitem, and if the item later becomesinject, the grant works inject-only until the operator loosens the item again.Item changes. Grants and requests are bound to the item's
id. A value change keeps them. A rename keeps them too andsharedshows the new name, but placeholders using the old name stop resolving (no such item). Deleting the item revokes its grants (item_deleted) and withdraws its pending requests; re-creating the name makes a new item with no grants.The owner's agent isn't told who asked and can't approve or veto. It may still rename or delete its item, with the effects above.
History. Decided requests are kept, the newest 500; revoked grants are kept for 90 days. Pending requests and active grants never expire on their own: deny or revoke them.
No MCP tool grants, denies, or revokes. Those exist only on the admin API, behind the dashboard login.
Git credential helper
drawlatch vault git-credential is a git credential helper that answers from one vault item, so git can push and fetch with a token that lives only in the vault.
It works only for items the caller may reveal: its own reveal items, or another caller's item granted to it at reveal. An inject item, or one shared inject-only, is refused. That's deliberate. A credential helper has to hand the value to git, and the daemon can't tell git running the helper from an agent running the same command (or git credential fill) in its shell with the same caller keys. Anything the helper can read, an agent with those keys can read, so the helper is limited to items that agent could read with vault_get anyway. It still buys you a few things:
the token isn't in a remote URL or a dotfile, and with the setup below git doesn't save it in
~/.git-credentials, a keychain, or a credential cache either, as long as no other helper for that URL comes after the reset line (see below);it isn't in the model's context unless the agent asks for it with
vault_get;every use is written to the owner's audit log as
vault.revealwithvault.via: "git-credential";rotating the value on the dashboard (Vault → Replace value) takes effect for git at once.
Setup, on a machine with the caller's keys (the same MCP_CONFIG_DIR, proxy.config.json, and keys/callers/<alias>/ the local MCP server uses):
Save the token as a
revealitem, for exampleforgejo-token(kindtoken, orpasswordwith ausernamefield). An agent can save it withvault_createandexposure: "reveal"; for a token the agent shouldn't see in its conversation, create it on the dashboard (Vault → New item, exposurereveal).Point git at the helper for that host only, with a URL-scoped helper key, and pass the same host to
--hostso the helper refuses any other host even if the config is too broad. Clear the inherited helpers first:git config --global credential.https://forgejo.example.com.helper '' git config --global --add credential.https://forgejo.example.com.helper \ '!drawlatch vault git-credential --item forgejo-token --host forgejo.example.com'The empty value matters. A URL-scoped helper is added to the helpers git already has (
osxkeychainfrom macOS git,manageron Git for Windows, astoreorcacheyou set up), not used instead of them, and after a successful login git asks every helper that applies to save the credential. Without the reset line, one of them writes the vault token to disk or a keychain, and from then on answersgetbefore the vault helper does, so uses stop being audit-logged and a rotated value no longer reaches git.An empty
helpervalue clears only the helpers git has read up to that point. git reads system config, then~/.gitconfig, then the repository's.git/config, each top to bottom. So the reset covers helpers in system config (whereosxkeychainandmanagerusually are) and lines above it in the same file. A helper that applies to the URL and comes later is still added after it and still saves the token: acredential.helperlower in~/.gitconfig(runninggit config --global credential.helper …after these lines can put one there), or one in a repository's.git/config. Check what git will use, from inside a repository you'll push from:# Every helper entry, in the order git reads them. Nothing that applies to the # URL should come after the empty line. git config --show-origin --get-regexp '^credential\..*helper$' # The helpers git actually runs for the URL. Only the drawlatch helper should # be listed. (This also asks them to erase a stored credential for it, which # does no harm here.) printf 'url=https://forgejo.example.com\n\n' | GIT_TRACE=1 git credential reject 2>&1 | grep run_commandDon't check with
git credential approve: without a password git runs no helpers at all, so it prints nothing either way.To set it for one repository only, run both commands inside it without
--global. Add--caller <alias>when the keys aren'tMCP_KEY_ALIAS's (ordefault),--owner <alias>to use another caller's item granted atreveal, and--username <u>when the item has nousernamefield and the host wants a particular one.git clone https://forgejo.example.com/org/repo.gitnow gets its credentials from the vault. Check withdrawlatch vault listthat the item is there and isreveal.
What the helper does:
getreads git'skey=valuerequest from stdin. If--hostis set and git'shostisn't exactly that (case-insensitive, port included:forgejo.example.com:3000needs--host forgejo.example.com:3000), it exits 1 without contacting the daemon. Otherwise it callsvault_getwithpurpose: "git-credential"and printsusername=(the item'susernamefield, else--username, elsex-access-token) andpassword=(the item'svaluefield).storeanderasedo nothing and exit 0: the vault is managed by the agent and the dashboard, not by git. The helper itself never writes the token anywhere. Whether git does depends on the other helpers for that URL: none run if every one of them comes before the reset line (see the check above).Errors (an
injector ungranted item, a missing item, a host mismatch, a value with a newline, the daemon not running) go to stderr without any value, and exit 1, so git moves on to its next helper or prompts.
The helper authenticates the same way the MCP server does: the caller handshake over the encrypted channel, then the ordinary vault_get tool. It uses no admin password and no new endpoint, and it never opens the vault file or its key, so it works the same from another machine. There's deliberately no drawlatch vault get command that prints a value, and no command that writes one.
Webhooks and the tunnel
Webhook listeners (GitHub, Stripe, Trello) receive POST /webhooks/<path> on the daemon's port, so the daemon must be reachable from the internet. drawlatch start --tunnel (or "tunnel": true) runs a Cloudflare quick tunnel; cloudflared must be installed. The tunnel URL appears in drawlatch status, and the daemon sets any unset callback-URL variable a webhook template references (for example, TRELLO_CALLBACK_URL) before starting listeners. Details: INGESTORS.md.
Admin dashboard
The daemon serves a web dashboard and its JSON API from the same port as the MCP protocol: http://127.0.0.1:9999/ by default. From it you can create, issue, and delete callers; choose whether a caller's agent may manage its own connections and secrets (Agent permissions on the caller page); enable connections; set secrets; choose each caller's Google services; configure, test, and control listeners; manage each caller's vault items and decide access requests; and watch events, ingestors, sessions, and a secrets matrix. Connection and secret changes apply to open sessions immediately. Running listeners pick up new secrets, or a newly enabled connection, only when they are (re)started: use the listener controls or drawlatch restart. Listener parameter changes restart the listener.
Password. The dashboard stays locked until a password is set. drawlatch set-password (alias change-password) prompts on a TTY or reads the password twice from stdin (printf '%s\n%s\n' "$PW" "$PW" | drawlatch set-password). It stores a scrypt hash and salt in .env as AUTH_PASSWORD_HASH / AUTH_PASSWORD_SALT. Restart the daemon after setting it from the CLI. Changing it from the dashboard (Change password, /settings/password) applies immediately and signs out every other session.
Security.
The password, not loopback, is the trust boundary. That's why the daemon can bind
0.0.0.0.The session cookie (
drawlatch_session) ishttpOnlyandsameSite=strict, with a 7-day rolling expiry. It has nosecureflag, so use a TLS-terminating proxy beyond a trusted network.Per-IP rate limits:
login and password change: 3/min combined
auth check and logout: 20/min
/handshake: 30/min/webhooks: 120/min/health: 60/min/api/admin: 300/min, with credential issuance and vault reveal each limited to 10/min (separate counters)
Without a password, the MCP protocol still works. Login, auth checks, and
/api/admin/*return503.
Vault. The Vault page (/vault?caller=<alias>, also linked from each caller page as "Vault: N items"; the nav entry shows a badge with the number of pending access requests) has three tabs. Items lists a caller's items: name, kind, exposure, tags, bound connections, who each is shared with ("bob (inject)"), and when each changed, never a value. From it you can:
New item: an item created by the admin (
createdBy: "admin"). It defaults toinjectand to being bound to one of the caller's enabled connections; keep the binding unless the item really needs every connection (Round trips).Edit the name, exposure, binding, tags, notes, and metadata. Unlike the agent, the admin may loosen an item:
inject→reveal, or a wider or removed binding.Replace value: write-only inputs with a show/hide toggle while typing. The current value is never shown.
Delete, after a confirmation.
Reveal, after a confirmation that says it is recorded: the values appear in masked fields with show and copy buttons, and are cleared when you close the panel, after 60 seconds, or when you navigate away. A reveal works on
injectitems too, since the admin could loosen them anyway, and writesvault.revealwithvault.actor: "admin"to the caller's audit log before anything is returned; if that write fails, the reveal fails.
Requests is the pending access-request queue: requester, owner and item, the item's binding (or "not bound: usable on any of bob's connections"), the mode asked for, and the reason, shown as plain text under a label saying the requesting agent wrote it. Grant shows the binding again and opens a mode choice with inject preselected; reveal is disabled unless the item's exposure is reveal. Inject means no tool returns the value to the grantee, not that it can never see it: on an unbound item it can send the value to any API it has enabled and read it back from one that stores it (Round trips), so bind the item first. Deny takes an optional note of up to 1 KiB (UTF-8 bytes). A request for an item the owner doesn't have shows "no such item" and can only be denied. Decided requests are in a collapsible history below. Grants lists active grants with Revoke (after a confirmation), noting when a reveal grant works inject-only because the item is inject; revoked grants are collapsed below.
Edits, value replacements, and deletes are sent with the vault revision the page loaded (If-Match). There is one revision for the whole vault, not one per item or caller, so a save made meanwhile by any caller's agent, or from another dashboard tab, makes a pending edit fail with 409 instead of being overwritten. The dialog then says so and the list reloads with the current revision, so you can check the item and save again.
OAuth2 connections. The caller page and the configure dialog show each OAuth2 connection's grant and the scopes that caller gets (after its oauth2Overrides), the service-account subject if one is set, and why the daemon drops a connection for that caller, if it does. oauth2Overrides is read-only here: edit it in remote.config.json. The caller page shows a red banner for a caller whose config can't be loaded at all (configProblem).
Test results. Test on a card reports the test's own verdict (success), so a reachable API that answers 401 is a failed test. For google, the result lists each selected service on its own line (✓/✗, the status, not consented, or skipped: no token when no token could be minted), with the hint and the consent scopes, and a copy button for them.
Google services. The google card shows the caller's auth mode ("User OAuth", "Service account", or "Service account · delegated") and one chip per selected service and level, and its secret status counts only that mode's credentials. Configure opens the Google services editor, which edits callers.<alias>.google:
Auth mode: switching it swaps the secrets section below to that mode's credentials (saved through
set_secretsas the admin, like any card) and turns off any level the new mode doesn't offer, saying which.Services: one row per service with
Offand its levels, each with its summary, all taken from the catalog (GET /google/catalog). A level the mode doesn't offer is disabled ("not available with a service account").Subject (service account): the Workspace user to act as. Required, with an inline error, when Gmail is selected; checked with the daemon's own rule.
Consent scopes: the selection's scopes as you click, as a
SCOPES="…"line for the refresh-token recipe (user OAuth) or a comma-separated list for the Admin console's domain-wide delegation entry (service account), with a copy button. A change that removes scopes says the old token will be refused until it's re-consented.Notes: each cross-service scope note that applies (for example
sheets: readwithdrive: file).Save: if the change could let the agent reach more (a scope the caller doesn't have, any change of auth mode, or a subject set or changed), a confirmation lists why (each added level's summary, the mode change, the subject) and the scopes to re-consent; then the selection is saved (
PUT /callers/:alias/google), and the dialog offers to run the test. Remove this caller's Google selection deletes the block; an enabledgoogleis then dropped for the caller until a selection is saved.
Changes apply to the caller's open sessions at once. Each save or removal writes a google_selection line to the daemon's [audit] log with the before and after modes and services and whether a subject is set, never the subject itself.
API. The dashboard is a client of /api/admin/* (paths below are relative to it). Read endpoints report secrets as booleans only. /connections includes each template's auth; /callers/:alias/connections and /callers/:alias/connection-status add the caller's effective auth/callerAuth and a problem for a dropped connection:
GET /meta,/health,/connections,/callers,/ingestors,/sessions,/secretsGET /callers/:alias/connections,/callers/:alias/connection-status,/callers/:alias/ingestors,/callers/:alias/events,/callers/:alias/listener-configsGET /vault/status:{keyPresent, keyId, fileExists, revision, callers: {alias: itemCount}, pendingRequests}, pluserrorwhen the vault can't be read.keyIdis the key's public fingerprint, never the key.GET /callers/:alias/vault/items:{revision, items}, each item's metadata andfields(names only) withgrants: [{grantee, mode, effectiveMode}]for its active grants. Never a value.GET /vault/requests?status=<pending|granted|denied|cancelled|withdrawn>: access requests, newest first, each withitem({name, kind, exposure, connections?}as it is now,connectionsabsent when the item is unbound, ornullwhen the owner has no such item).reasonis agent-written text.GET /vault/grants?status=<active|revoked>: grants, newest first, each withitemandeffectiveMode(nullonce revoked).GET /google/catalog:{authModes: [{id, secrets}], services: [{id, name, docsUrl, enableApi, levels: [{id, summary, scopes, auth, subjectRequired?}]}], crossScopeNotes}. No allowlists or test requests.GET /callers/:alias/google:{enabled, selection, consentScopes, problem?, notes}.selectionis the caller's validgoogleblock (subject included) ornull;problemis why an enabledgoogleis dropped, or why a stored block is invalid;notesare the cross-service scope notes that apply.
GET /callers includes vaultItems per caller (null when the vault can't be read), and configProblem for a caller whose config can't be resolved at all (a connection name that is neither a template nor a connector): its handshakes fail and its listeners don't start until it's fixed, while other callers are unaffected. A dropped connection, a removed template ID included, is a problem on that connection instead, and the caller's other connections and listeners keep working. For google, /connections reports composed: "google" and no auth, with the user-OAuth credentials as requiredSecrets; the per-caller views report the selected mode's, and their auth/callerAuth adds google: {auth, services}.
Write endpoints (… = /callers/:alias/connections/:connection):
Method and path | Action |
| Create a caller with a keypair on drawlatch's disk |
| Issue or rotate a credential bundle (10/min) |
| Delete a caller, its keys, its vault items, and the secrets recorded in its |
| Set the caller's |
| Persist the tunnel flag (applies on restart) |
| Set the caller's Google selection. Validated like |
| Remove the caller's Google selection; returns the |
| Enable or disable a connection |
| Set secrets; empty string deletes |
| Run the connection or listener test |
| Start, stop or restart a listener |
| Read or set listener params |
| Manage listener instances |
| Fetch dynamic field options |
| Create an item ( |
| Update an item. The admin may loosen it; |
| Delete an item |
| Return the item's values (or one field), after writing |
| Grant a pending request: |
| Deny a pending request (note at most 1 KiB of UTF-8): |
| Revoke a grant: |
The vault and Google endpoints answer with Cache-Control: no-store, errors included, and an unknown request or grant id is 404. PATCH and DELETE take an optional If-Match: <revision> (from GET …/vault/items) and answer 409 with the current revision when the vault has changed since. Only …/reveal ever returns a value. If vault.enc.json exists but keys/vault.key is missing, every item, request, and grant endpoint answers 503 with the restore-from-backup message (a create with an invalid body still gets its 400 first) and no new key is created; /vault/status still answers, with error set, and GET /callers shows vaultItems: null. With no vault file yet, the item endpoints work normally: GET …/vault/items returns {revision: 0, items: []}, a PATCH, DELETE, or reveal of an item answers 404, and the first create makes the key and the file.
Connection and listener operations share their implementation with the MCP tools (src/remote/tool-dispatch.ts). The unauthenticated GET /health returns status, active session count, uptime, and the tunnel URL.
CLI reference
drawlatch [command] [options] (no command: status if running, else help)
init Create server keys, proxy/remote configs and .env (idempotent)
start Start the daemon in the background
-f, --foreground Run in the foreground (for process managers)
-t, --tunnel Also start a Cloudflare quick tunnel (requires cloudflared)
--port <n>, --host <addr>
stop | restart Stop (SIGTERM, then SIGKILL after 15s) / restart; restart keeps an active tunnel
status PID, address, dashboard URL, password state, uptime, health, sessions
logs Show the log (~/.drawlatch/logs/drawlatch.log)
-n, --lines <n> Lines to show (default 50)
--follow Keep tailing
--requests Include per-request [audit] lines (hidden by default)
watch [connection] Stream listener events live (loopback only)
--full Print full payloads instead of a 100-character preview
config Show effective config and per-caller secret status (--path: config file path)
doctor Check config, keys, required secrets, dropped connections, custom
connectors' withheld secrets, the vault and daemon health; exits 1
if any check fails
generate-keys caller [alias] Caller keypair in keys/callers/<alias>/ (default alias "default")
generate-keys server Server keypair in keys/server/
generate-keys show <path> Fingerprint of an existing keypair
issue-caller <alias> Issue a caller credential bundle (for Callboard)
--name <name> Display name (default: keep existing, else the alias)
--connections <a,b> Connections (default: keep existing, else copy "default")
--endpoint <url> Daemon URL pinned in the bundle (default: this daemon's host:port)
--passphrase Encrypt the bundle's private keys (scrypt + AES-256-GCM)
-o, --output <file> Write to a 0600 file instead of stdout
--into <keysDir> Same host: write key files into a Callboard keys directory
set-password Set the dashboard password (alias: change-password)
vault list Your vault items (name, kind, exposure, field names) and items shared with
you, as a caller over the encrypted channel; never values
--caller <alias> Caller keys to use (default: MCP_KEY_ALIAS, else "default")
vault git-credential <get|store|erase>
git credential helper answering from one reveal item (Git credential helper)
--item <name> The item (required)
--owner <alias> Another caller's item granted to you at reveal
--caller <alias> As for vault list
--username <u> Username when the item has no username field (default x-access-token)
--host <host> Answer only for this git host; otherwise exit 1 without contacting the daemon
-h, --help / -v, --versionSecurity model
Endpoint allowlisting: requests go only to URLs matching the caller's connections. A URL with a control character (tab, CR, LF, NUL, DEL), which URL parsing would silently delete, and a path with a
.or..segment (including%2eforms, and%2f,%5c, or\as separators), are refused on every connection, since either would change the path after it was checked. The allowlist is matched against the URL as parsed, and that parsed form is exactly what is sent. Double-encoded forms (%252e%252e) and..;aren't resolved by drawlatch or fetch, so they reach the upstream as written. Poll listener URLs get the same checks after listener params are substituted (INGESTORS.md). Redirects are followed only to allowlisted URLs, never fromhttpstohttp, and without credential headers across origins (Redirects).Per-caller isolation: each caller sees only its connections, and secrets resolve only from its own
envor<ALIAS>_-prefixed variables.No secrets on the client: the MCP server never holds API credentials. Secret placeholders resolve server-side, in request bodies only when a connection opts in. Secrets a connection injects in its own headers can't be placed in a request at all, and are scrubbed from response bodies (Header-only secrets).
OAuth2: on an
oauth2connection the agent never sees the client credentials, refresh token, service-account key, or minted access token, and only the operator chooses scopes and the user a service account acts as. The agent can't reconfigure that: on the agent path,set_connection_enabledrefuses to enable any OAuth2 connection (one that reuses the same credentials at broader scopes, say) andset_secretsrefuses to set or delete an OAuth2 credential, whateverselfManagesays. The dashboard and admin API can. SetselfManage: falseon these callers anyway, so the agent can't add other connections either. Scopes bound what a token can reach, not what the agent does with it.Mutual authentication: Ed25519-signed handshake against a pinned server key and registered caller keys.
Encryption: AES-256-GCM with per-session X25519 ECDH keys, and monotonic counters against replay.
Sessions expire after 30 minutes idle.
Rate limits apply per session (
rateLimitPerMinute) and per IP on unauthenticated endpoints.Loopback-only routes (
/events/stream, used bydrawlatch watch) accept only a direct connection from this machine: the socket must be loopback and the request must carry no forwarding header (X-Forwarded-For,-Host,-Proto,X-Real-IP,Forwarded,Via, and similar). A reverse proxy in front of drawlatch connects from loopback, so these routes refuse proxied requests (403); don't expect them to work through a proxy. Caddy and Cloudflare (including the built-in tunnel) add these headers by default, so they're refused. A forwarder that adds none, such as a default nginxproxy_pass(noproxy_set_header X-Forwarded-For …),ssh -R, or socat, can't be told apart from a local client, so don't put one in front of drawlatch. The per-IP rate limits also see such a proxy as one client.Request log: every request and response is logged with caller and session (
drawlatch logs --requests).Caller audit log:
ingest_logsis append-only and write-only over the protocol, stamped with the authenticated caller (Audit log).Vault: each caller's vault is encrypted at rest under a key file only the daemon reads. No tool returns a vault value except
vault_geton an item the caller may reveal (its ownrevealitem, or one granted to it at effective modereveal), which is audit-logged first, and none returns the vault file, its ciphertext, or the key. Access to another caller's item needs a grant, and only the operator can grant, deny, or revoke: no MCP tool can, since any authenticated caller can call any tool by name. A value injected with${vault:…}is scrubbed from the response like a withheld secret and can't choose the request's host. An agent can only tighten an item's exposure, never loosen it.Vault from the CLI:
drawlatch vault listand the git credential helper run as a caller: the same handshake, keys, and tools as the MCP server, no admin password, no extra endpoint, no access to the vault file or key. They print only whatvault_getreturns to that caller, so aninjectitem never reaches git, and whoever holds a caller's keys can read that caller'srevealitems either way.Vault on the dashboard: no admin API response carries a vault value except the explicit
POST …/reveal, which needs a confirmation in the UI, is limited to 10/min, isno-store, and is written to the owner's audit log (actor: "admin") before it answers. The dashboard keeps a revealed value only in the reveal panel's state, never in a shared cache or storage, and clears it on close, after 60 seconds, and on navigation. Values are write-only everywhere else on the dashboard. Anyone with the dashboard password can reveal every caller's items.
Package exports
Drawlatch is mainly a CLI and daemon. Hosts such as Callboard can import these subpaths; any other deep import fails with ERR_PACKAGE_PATH_NOT_EXPORTED.
Export | Contents |
| The MCP stdio server ( |
| Key generation, loading and fingerprints, |
|
|
| Idempotent config-dir migrations ( |
| Daemon entry point. Resolve its path and run it with |
|
|
| Admin API types, including the caller bundle format ( |
Development
npm install # also builds (prepare script)
npm run build # tsc + copy connection templates + build the dashboard
npm test # unit tests (vitest); npm run test:e2e for live-API tests (.env.e2e)
npm run lint # eslint src/
npm run format # prettier
npm run dev:remote # daemon via tsx, config in ~/.drawlatch-dev
npm run dev:mcp # MCP server via tsx, config in ~/.drawlatch-devbin/drawlatch.js CLI
src/mcp/server.ts local MCP stdio server
src/mcp/client.ts caller side of the encrypted channel (MCP server and `drawlatch vault`)
src/cli/vault.ts drawlatch vault list / git-credential
src/remote/server.ts daemon: handshake, /request, webhooks, dashboard, admin API
src/remote/tool-dispatch.ts tool implementations shared by MCP and the admin API
src/remote/ingestors/ WebSocket, webhook and poll listeners
src/connections/<category>/<name>.json built-in connection templates
src/shared/ config, secrets, crypto, handshake protocol
src/auth/ dashboard password and sessions
frontend/ React + Vite dashboard (built to frontend/dist)License
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Credential broker for AI agents: scoped, revocable API access with policy enforcement and audit.
Governed access to sensitive data, secrets and APIs for AI agents. A signed proof for each decision.
Call third-party APIs from agents without leaking secrets. SSRF blocked, per-key quotas.
Security gateway for AI agents: policy, approval, and audited execution, no secrets shared.
Related MCP Servers
- AlicenseAqualityCmaintenanceCredential isolation proxy for AI agents. Injects API keys at the network boundary so your agent never sees the raw credential. Supports domain allowlists, agent auth, policy enforcement, and audit logging.382 npm16Apache 2.0
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to securely access authenticated services (HTTP, SSH, SMTP) without exposing secrets, by acting as a server-side proxy that injects authentication.MIT
- AlicenseNot gradedqualityBmaintenanceBounded egress gateway & secret proxy for AI agents and applications, enabling safe credential injection into upstream requests while keeping raw secrets out of LLM prompt contexts.MIT
- AlicenseAqualityDmaintenanceEnables AI agents to make authenticated API calls and run commands with secrets injected, while keeping credentials completely hidden from the model, with policy enforcement, grants, and audit logging.6MIT