Tools

panto-mcp

rock 0.1.0-1Source

Connects panto to Model Context Protocol (MCP) servers: supervised local stdio servers and remote Streamable HTTP servers, with deferred tool discovery and calls, resource reads, prompts, and a std.lua namespace. No Lua dependencies; local server programs must be installed separately.

Install

SH
panto extensions install rock:panto-mcp

Or add it to config.toml:

TOML
[extensions]
rocks = ["panto-mcp"]

Configure servers

TOML
[mcp]
startup_timeout_ms = 30000
call_timeout_ms = 300000
idle_timeout_ms = 60000

[mcp.servers.files]
command = "npx"
args = ["-y", "@modelcontextprotocol/server-filesystem", "${project_root}"]

[mcp.servers.remote]
url = "https://example.com/mcp"

Each server takes exactly one of url (HTTP(S)) or command (stdio), plus:

FieldTypeMeaning
argsstring arrayCommand arguments
envstring mapEnvironment; ${env:VAR} expands
cwdstringWorking directory
enabledbooleanSkip the server without deleting it
expose"search" or "eager"Tool exposure; defaults to search
headersstring mapHTTP headers; ${env:VAR} expands
authstringNamed panto auth session
enabled_toolsglob arrayAllowlist
disabled_toolsglob arrayDenylist, applied after the allowlist

The three top-level timeouts are positive integer milliseconds: connect and discovery, per request, and the maximum silent interval on an HTTP stream.

HTTP servers may also set oauth:

TOML
[mcp.servers.remote.oauth]
scopes = ["read"]
client_id = "..."
issuer = "https://auth.example.com"
client_secret = "..."

A client ID requires its exact issuer, and a secret requires a client ID. An issuer without a client ID pins public dynamic-client-registration discovery, selecting the matching advertised issuer. ${project_root} expands in supported string values. Invalid server entries are skipped with warnings.

Use

The session header lists enabled servers by configured name, even before they connect. /mcp shows connection status.

ExposureTools
search (default)mcp.search, mcp.call, and mcp.read_resource when resources exist
eagerOne mcp.<server>.<tool> per server tool

Server prompts are commands of the form /mcp:<server>:<prompt>. /mcp refresh [server] refreshes metadata. The code-mode API is documented at require("panto_mcp.docs").discovery.

OAuth

Omit auth and run /mcp-login <server>; it opens your browser with open/xdg-open, skipped over SSH.

Copy the printed URL in full if you paste it yourself: a clicked terminal link stops at the first wrapped line, and the token exchange then fails. Headless sessions can paste the callback instead:

SH
/mcp-login remote https://localhost:8080/callback?code=...&state=...

A configured auth uses the named panto auth session instead of automatic OAuth.

Public DCR registrations are reused across logins and across failures, including network and refresh errors: a transient error never creates a new client.

Run /mcp-login <server> --reregister only to discard a deleted or stale registration, rediscover, and register once. It is for automatic public DCR clients only; confidential DCR is refused.

Normal login rediscovers only for a missing or failed definition. A changed discovered issuer discards the old registration. Configured client secrets stay out of extension state and catalog caches. Registrations are issuer-wide in panto state, so --reregister replaces that shared registration.

Session and stream behaviour

Automatic session names are a 128-bit SHA-256 prefix of resource, issuer, and client ID, within 128 bytes; a name change logs out the old session. Consent login with a usable token keeps working tools usable even if consent is abandoned.

  • Legacy notification streams retry with exponential backoff up to 60 seconds.
  • A 401 stops retries and shows a /mcp warning.
  • Simple eager tool names stay readable; sanitized, truncated, or encoded-looking names get stable suffixes.

Core API requirement: remote HTTP, eager tool registration, prompt commands, and OAuth need a panto build with post-activation register/unregister, http_request methods and streaming, and panto.ext.auth. Older builds support stdio plus search mode; unsupported capabilities degrade with a clear error.

Limits

Catalogs are cached locally and refreshed on connection; search does not start servers. There is no resource subscription, elicitation, task support, legacy HTTP+SSE transport, or persistent server process across panto sessions. Local stdio server executables are not bundled.