ahto

The gateway

ahto serve is a local gateway that serves the lake and your gRPC services on one port, as MCP tools, REST routes and more. Point it at one or more gRPC backends and it serves every rpc on one port as an MCP tool, a REST route, a JSON-RPC method, a GraphQL field, a WebSocket call, an MQTT topic and a gRPC method, with an OpenAPI document for the routes. There is no sign-in unless the node is in its network's authority group (p2p.networks[].authority.member, RFC 0014): then calls need a session (when sign-in applies), and ahto ui prints a one-time code that signs the browser in. See also security.

With no configuration there are eight backends, all inside the process, and 87 rpcs (/readyz lists them). base has six rpcs (Ping, GetInfo, ListServices, CheckUpdate, WatchStatus and Watch; see proto/ahto/base/v1/base.proto), enough to try every surface. Turning sign-in on adds a ninth backend, the identity service (cli/settings.go). The debugger's rpcs (debug.*) have no sign-in, so a public gateway, or one that allows remote callers (protocol.allow_remote), denies them: they leave the catalog and GetInfo lists them in denied_rpcs. source reads the lake: see The source service. The catalog is the same on every surface, so /llms.txt always lists what your build has.

Surfaces

Every surface serves the same catalog of rpcs, on the same port.

SurfacePathWhat it is
mcp/mcpOne MCP tool per rpc, named <backend>_<method> (streamable HTTP)
mcp_sse/sseThe same tools over HTTP with server-sent events, for older MCP clients
rest/The google.api.http routes; a server stream is server-sent events
jsonrpc/rpcJSON-RPC 2.0; rpc.discover answers an OpenRPC document
openapi/openapi.jsonThe OpenAPI 3.1 document of the REST routes
ws/wsWebSocket with JSON frames; many calls on one connection
graphql/graphqlGraphQL over POST
mqtt/mqttMQTT 3.1.1 and 5 over WebSocket; request and reply topics
llms/llms.txtA short Markdown guide for agents: the surfaces, examples, one line per call
llms-full/llms-full.txtThe same with each call's comment and fields; ?backend= keeps one backend
agent/agentThe same guide as an HTML page with no JavaScript
grpcany pathgRPC on the same port (HTTP/2, plaintext or TLS)

Two more paths: /healthz says the process is up, and /readyz lists the backends.

The web app

The released binary has the web app (ui/app) built in, and ahto serve answers it on the same port: open http://127.0.0.1:8080. Every path above is then also below /api, which is where the web app calls: /api/mcp, /api/v1/base/ping, /api/llms.txt. A request below /api is served without it and with /api in X-Forwarded-Prefix, after any prefix a proxy in front sent, so the pages for agents name the right paths.

The gateway's own paths win at the root: /mcp, /healthz, /llms.txt, /openapi.json and the REST routes (/v1/...) answer as they do without the web app, and a mistyped /v1 path is still a JSON 404. Any other GET or HEAD gets the web app's file, or its index.html for a client that takes HTML. Files under /assets/ are cached for a year (their names change with each build); the rest is checked on every load. gRPC is unchanged.

ahto serve --no-ui leaves the web app out, and so does serve --stdio. A binary built without ui/app/dist (scripts/build.sh embeds it when it is there) serves the gateway alone.

Pages for agents

/llms.txt, /llms-full.txt and /agent are built on each request from the live catalog, so a denied rpc is on none of them and a moved surface shows its new path. Behind a proxy that mounts the gateway under a path, send that path in X-Forwarded-Prefix (for example /api): these pages put it in front of every path, and /openapi.json names it in servers. A prefix that is not one to four plain path segments is ignored.

sh
curl 127.0.0.1:8080/llms.txt
curl '127.0.0.1:8080/llms-full.txt?backend=base'

Each surface can be turned off or moved to another path in the configuration.

Calling an rpc

An rpc has three names, and every surface and every allow or deny list takes any of them:

FormExampleNote
Canonicalbase.BaseService.Ping<backend>.<Service>.<Method>, always unique
Shortbase.Ping<backend>.<Method>, when it is unique
Toolbase_pingThe MCP tool name and the GraphQL field name

REST

sh
curl 127.0.0.1:8080/v1/base/ping
curl -N 127.0.0.1:8080/v1/base/watch -d '{"count":3}'   # a stream: server-sent events
curl 127.0.0.1:8080/openapi.json

Fields of nested messages are query parameters with dots: ?filter.page.size=5.

When two routes match one path, the one with more literal segments is served: GET /v1/tasks/tree is GetTree, not GetTask with the id tree. A tie goes to the rpc listed first.

JSON-RPC

sh
curl 127.0.0.1:8080/rpc -d '{"jsonrpc":"2.0","id":1,"method":"base.Ping","params":{"message":"hi"}}'
curl 127.0.0.1:8080/rpc -d '{"jsonrpc":"2.0","id":1,"method":"rpc.discover"}'
  • params is the request message as an object.
  • One call or a batch of up to 50. A call with no id is a notification and gets no answer.
  • A server stream answers as {items, truncated, reason}.
  • Errors: -32700 not JSON, -32600 not a call, -32601 unknown method, -32602 bad params, -32000 the call failed (the problem is in data).

GraphQL

sh
curl 127.0.0.1:8080/graphql -H 'content-type: application/json' \
  -d '{"query":"{ base_ping(message: \"hi\") { message } }"}'
  • An rpc whose route is a GET is a query; every other rpc is a mutation.
  • The arguments are the fields of the request message.
  • A server stream answers as {items, truncated, reason}. There are no subscriptions.
  • A failure is a GraphQL error with the problem code in extensions.code.
  • POST only; a GET is answered with 405.

WebSocket

Connect to ws://127.0.0.1:8080/ws and send JSON text frames.

json
{"type":"call","id":"1","rpc":"base.Watch","body":{"count":3}}

The gateway answers each call with zero or more data frames, then one end or one error:

json
{"type":"data","id":"1","body":{"sequence":1}}
{"type":"end","id":"1"}

{"type":"cancel","id":"1"} stops a call. The id is yours to choose. One connection holds up to 64 open calls, and a stream is sent in full as it comes.

MQTT

Connect an MQTT client to ws://127.0.0.1:8080/mqtt and publish the request message as JSON to rpc/<name>, for example rpc/base.Ping.

CaseWhere the answer goesUser property status
The request has a response topic (MQTT 5)that topicok, or data then end, or error
Unary, no response topicrpc/<name>/replyok
Stream, no response topicrpc/<name>/reply, then rpc/<name>/enddata, then end
Failure, no response topicrpc/<name>/errorerror

The correlation data of the request is echoed. A client may subscribe to anything and may publish only to rpc/<name>. A request is never handed to other subscribers: this is a request and reply surface, not a message bus.

gRPC

A gRPC client calls the gateway's port as if it were the backend:

sh
grpcurl -plaintext -proto proto/ahto/base/v1/base.proto -import-path proto \
  -d '{"message":"hi"}' 127.0.0.1:8080 ahto.base.v1.BaseService/Ping

The gateway does not serve gRPC reflection and does not forward request metadata. A method that is unknown or denied answers Unimplemented.

MCP

sh
mise run mcp:add      # register the gateway in Claude Code as "ahto" for every folder
mise run mcp:tools    # print the tool table as JSON, serve nothing

Each rpc is one tool. Its description is the comment of the rpc in the proto file, and its input schema is built from the request message. A server stream is collected into one answer, up to the limits in protocol.streams or protocol.mcp.

A tool's hints (read only, destructive, idempotent) follow from the rpc: one served by GET or marked NO_SIDE_EFFECTS reads, one marked IDEMPOTENT is idempotent, and a write destroys unless its name starts with Add or Sync. An rpc can set them itself with the option (ahto.base.v1.tool) from proto/ahto/base/v1/options.proto, as the task service does for UpdateTask (a write that destroys nothing) and Import (idempotent).

By default tools/list is brief: each tool has its title, the first sentence of its description and the names and types of its fields, and a describe_tools tool gives any tool in full (schema and description). The full list of every tool is about 60 KB, which every session would read before its first call. /mcp?tools=full lists them in full; protocol.mcp.brief: false makes full the default, and then /mcp?tools=brief gives the brief list. stdio follows protocol.mcp.brief. Every tool can be called either way.

Two resources let a client attach context by URI. ahto://schema is the schema of every lake table (what source_get_schema answers), and the template ahto://{repo}/{commit}/{+path} is the text of one file: repo is the repository id, commit an id, branch or tag, or HEAD or - for the default branch head. Each is read through its tool, so it is listed only while protocol.mcp lists that tool. A file over source_get_file's caps answers its first part, and _meta says truncated and next_start_line for source_get_file to read on; a binary file has no text and _meta says binary and raw_url. Tool answers are JSON text with no outputSchema: each fits max_bytes or says _truncated, and the input schema and description say the fields.

The server's instructions say which tool to call when: source_list_repositories first, since the other tools take its repository id; source_run_query after source_get_schema for counts and rankings; function_call with explain_symbol for one symbol; source_get_file with lines to read code. Three prompts start common tasks, and most clients show them as slash commands:

PromptArgumentsWhat it asks the agent to do
ahto_startnonelist the repositories, with the order of calls above
ahto_explainsymbol (required), repoexplain a symbol: explain_symbol, then its definition with source_get_file
ahto_reviewcommit (default the head), reporeview a commit: source_get_commit, the impact function, source_get_review

There is one MCP server with one tool table, reachable three ways:

TransportHowFor
Streamable HTTP/mcp on the gateway's portmost clients; each request stands alone
HTTP with server-sent eventsGET /sse opens the stream, which names the URL to POST toclients that only speak the older (2024-11-05) transport
stdioahto serve --stdioclients that start the server themselves

The two HTTP transports pass the same local-only check as every other surface, and either can be turned off or moved under protocol.surfaces. A session that stays open (stdio or SSE) is told with notifications/tools/list_changed when a backend that was down comes up and its tools appear.

With --stdio, ahto reads one JSON-RPC message per line from stdin and writes its answers to stdout, and nothing else; logs go to stderr. It binds no port and does not start the peer-to-peer node. The client is the process that started it, so it has the rights of a loopback client even when protocol.allow_remote is set. It exits when stdin closes. A client config that starts it:

json
{
  "mcpServers": {
    "ahto": {
      "command": "ahto",
      "args": ["serve", "--stdio"]
    }
  }
}

Add "--config", "/path/to/ahto.yaml" before "serve" to use a config file other than the default one.

Agents in this repository

An agent opened in this repository knows ahto and reaches the gateway with nothing set up on the machine (ADR 0012, RFC 0019). The files are committed:

FileRead byWhat it holds
AGENTS.mdCodex, Cursor, Copilot, Gemini, Zed, opencode, Amp, Junie and most otherswhat ahto is, which tool when, how to test and commit
CLAUDE.mdClaude Code@AGENTS.md, so both read one text
.mcp.jsonClaude Code, VS Code Copilot, Grokthe server ahto at ${AHTO_MCP_URL:-http://127.0.0.1:8080/mcp}
.claude/settings.jsonClaude Codeturns ahto on and allows its read-only tools with no prompt
.claude/skills/ahto-mcp/Claude Code, Cursor, Cline, opencode, Amp, Goosethe skill: the order of calls, cut answers, what not to call
.agents/skills/ahto-mcpCodex, Gemini, Zed, Amp, Goosea link to the same skill

Claude Code asks once whether to trust the folder; after that the server and the read-only tools work. The tools that change state (adding, removing or syncing a repository, adding a function, changing settings, running an agent) still ask each time. Set AHTO_MCP_URL when the gateway runs on another port. Personal settings go in .claude/settings.local.json, which git ignores, as it ignores every other file in .claude/.

The source service

ahto serve also serves the lake (--lake or lake.dir) as ahto.source.v1.SourceService (proto/ahto/source/v1/source.proto), for a code browser and for agents. It holds one DuckDB engine, opened read-only and locked down, checks the lake's manifest every second and swaps to a new engine when a crawl or storage gc publishes; calls in flight finish on the old engine. With no lake the calls answer Unavailable until one appears.

RpcRESTTakesCached
ListRepositoriesGET /v1/source/repositoriesno
ResolveGET /v1/source/resolverepo, rev (branch, tag, HEAD or id; empty is the default branch), pathno
GetTreeGET /v1/source/treerepo, commit, pathyes
GetFileGET /v1/source/filerepo, commit, pathyes
GetSyntaxGET /v1/source/syntaxrepo, commit, path (a file in any language ahto parses; another file is FailedPrecondition)yes, by blob as well
ListHistoryGET /v1/source/historyrepo, commit, path, page_token, limit (default 50, at most 1,000)yes
GetCommitGET /v1/source/commitrepo, commityes
FindFilesGET /v1/source/files/findrepo, commit, text (a part of the path, any case; empty is every file), limit (default 50, at most 1,000)yes
GetActivityGET /v1/source/activityrepo, commit, path (empty is the whole repository), bucket (day, week, month or year; empty is month)yes
ListFileStatsGET /v1/source/files/statsrepo, commit, path (a folder or a file; empty is every file), limit (default 50, at most 1,000)yes
ListAuthorsGET /v1/source/authorsrepo, commit, path (empty is the whole repository)yes
GetUpkeepGET /v1/source/upkeeprepo, commit, path, as_of (RFC 3339; empty is now)no
GetBlameGET /v1/source/blamerepo, commit, path (a file)yes
RunQueryPOST /v1/source/querysql (one SELECT or WITH), limit (rows, default 1,000, at most 100,000), timeout (default 10 s, at most 60 s)no
WatchSnapshotsGET /v1/source/snapshots/watchno; a stream of published snapshots

repo is the repository's id or name. commit must be a full commit id: resolve a branch or tag with Resolve first. An answer named by a commit id never changes, so the REST answers of the cached rpcs carry Cache-Control: public, max-age=31536000, immutable and an ETag, and a request with that If-None-Match gets 304. Errors carry no cache headers.

sh
curl '127.0.0.1:8080/v1/source/resolve?repo=github.com/golang/example&rev=master&path=hello'
curl '127.0.0.1:8080/v1/source/tree?repo=github.com/golang/example&commit=<id>&path=hello'

GetSyntax is the syntax tree of a source file in any parsed language (go/parser for Go, tree-sitter for the rest), one node per syntax node in preorder: its kind, its parent's index (-1 for the root), depth, byte offsets and name. It reads syntax_nodes when the parse stage stored the blob's nodes (stored is true), else parses the file now; the two answers are the same node for node. A file with syntax errors still has a tree, with status syntax_error and the first error.

The bytes of a file are not in GetFile; its raw_url points at the raw surface:

sh
curl '127.0.0.1:8080/raw/v1/<repo>/blob/<blob id>?path=hello/hello.go'
curl -H 'Range: bytes=0-99' '127.0.0.1:8080/raw/v1/<repo>/blob/<blob id>'   # 206

/raw takes GET and HEAD, answers ranges, and sends the immutable headers with the blob id as the ETag. path only picks the content type. Images, audio, video, PDF, Wasm, zip and gzip go out as their type; every other blob is text/plain when it is UTF-8, else application/octet-stream, so HTML and SVG in a repository never run as a page on the gateway's origin (nosniff and a sandbox content security policy as well). Each repository has one held git cat-file process, so its blobs are read one at a time.

FindFiles gives the first limit files and total, the count of every match. GetActivity counts, per bucket of author time in UTC (hour, day, week from Monday, month or year), the first-parent commits from commit that change path and their distinct author emails, as git log --first-parent --no-renames -- <path> lists them. Both take a commit id so their answers never change. GetActivity and ListHistory take an optional window of author time, since and until (RFC 3339 timestamps, half-open: since counts, until does not), so a zoomed chart asks only for what it shows:

sh
curl '127.0.0.1:8080/v1/source/activity?commit=<id>&bucket=hour&since=2026-11-01T00:00:00Z&until=2026-11-08T00:00:00Z'

The Arrow surface streams the full answer of either one as an Arrow IPC stream (application/vnd.apache.arrow.stream), with no JSON to parse and no page limit:

sh
curl -o files.arrow '127.0.0.1:8080/arrow/v1/<repo>/files?commit=<id>&text=_test.go'
curl -o activity.arrow '127.0.0.1:8080/arrow/v1/<repo>/activity?commit=<id>&path=src&bucket=week'

files has the columns path, kind, mode and oid; activity has start (the bucket's first second, Unix seconds), commits and authors, and takes since and until as RFC 3339 or Unix seconds. The <repo> is escaped as in /raw. The surface takes GET and HEAD and sends the same immutable headers and ETag as the cached rpcs. It runs the same named query as the rpc, so both give the same rows. A binary built without -tags=duckdb_arrow answers 501; scripts/build.sh and the mise tasks build with the tag.

The workbench rpcs

The developer workbench boards of the web app read five more rpcs:

  • ListFileStats lists the files of commit under path, by path, each with its kind, size, lines, language, and the first-parent commits that change it (commits, distinct authors, last_commit and last_time), the first limit of them and total. It is the data of the code city.
  • ListAuthors lists the authors of the first-parent commits from commit that change path, by email: name, email, commits, and the author time of their first and last change, the most commits first.
  • GetUpkeep says whether path is still kept up, from the same authors: the last change, the whole calendar months since then (months_idle), the authors whose last change is in the twelve months before as_of, and how many authors changed it in all. Its answer moves with as_of, so it carries no cache headers.
  • GetBlame runs git blame --porcelain on the repository's mirror: hunks (a run of lines one commit last changed: commit, the path and original_line there, line and lines in the file) and commits (author, email, author time, subject, whether it is the boundary, and the previous commit and path). It follows renames, as git does.
  • RunQuery runs one read-only SELECT or WITH over the lake's views and gives columns, rows as JSON values (a time in RFC 3339, bytes in base64, an integer beyond 2^53 as a string) and truncated when more rows were there. Anything else (several statements, a write, a file read such as read_text) is InvalidArgument; a query past its timeout is DeadlineExceeded. It is never cached, and neither the service nor the gateway logs the SQL.
sh
curl '127.0.0.1:8080/v1/source/files/stats?repo=<repo>&commit=<id>&path=src'
curl '127.0.0.1:8080/v1/source/upkeep?repo=<repo>&commit=<id>&path=src&as_of=2026-11-23T00:00:00Z'
curl -X POST 127.0.0.1:8080/v1/source/query -d '{"sql":"SELECT count(*) FROM commits","limit":10,"timeout":"5s"}'

The Arrow surface has two more routes. stats is the full ListFileStats (columns path, kind, size, lines, language, commits, authors, last_commit, last_time), with the immutable headers. query is RunQuery as Arrow: the SQL as sql in a GET, or as the body of a POST (at most 1 MiB), with limit and timeout (such as 5s) as query parameters; it answers Cache-Control: no-store and no ETag.

sh
curl -o city.arrow '127.0.0.1:8080/arrow/v1/<repo>/stats?commit=<id>'
curl -o rows.arrow --data-binary 'SELECT * FROM commits' '127.0.0.1:8080/arrow/v1/<repo>/query?limit=50000'

The task service

The task service (proto/ahto/task/v1/task.proto, backend task) keeps the node's task tree: projects at the root, epics under them, and tasks to any depth. The design is in RFC 0020 and ADR 0014.

The tree lives in one DuckDB file, tasks.path (by default tasks/tasks.duckdb in ahto's data folder). ahto serve opens it and holds it while it runs. In the gateway of any other command, or when another process holds the file, every task rpc answers UNAVAILABLE and says why. ahto task opens the file itself while no process holds it, and calls this gateway's gRPC when ahto serve does. In public mode every task rpc answers PERMISSION_DENIED: the tree is the owner's own.

RpcRESTWhat it does
ListTasksGET /v1/taskstasks by parent, depth, state, label, repository or assignee, paged
GetTaskGET /v1/tasks/{id}one task with its path from the root, its links and its rollup
GetTreeGET /v1/tasks/treea subtree in rank order, to a depth, with each node's rollup
AddTaskPOST /v1/tasksa task under a parent, or a project; after or before a sibling
UpdateTaskPATCH /v1/tasks/{id}the fields in update_mask
MoveTaskPOST /v1/tasks/{id}/moveto another parent or place among siblings
SetStatePOST /v1/tasks/{id}/statethe state, with evidence, a pull request or a reason
AddLink, RemoveLinkPOST /v1/tasks/{from_id}/links, .../links/removedepends_on, relates, duplicates
AddCommentPOST /v1/tasks/{task_id}/commentsa comment, kept in the history
RemoveTaskDELETE /v1/tasks/{id}a tombstone on the task and its subtree
ListHistoryGET /v1/tasks/historythe ops of a task or a subtree, newest first, paged
ListNextGET /v1/tasks/nextready tasks whose dependencies are done, by due day then rank
PlanTasksGET /v1/tasks/planthe open tasks under a root fitted into days, and what does not fit, paged by day
GetChainGET /v1/tasks/chainthe longest chain of open tasks by hours, each waiting on the one before
ListLateGET /v1/tasks/lateopen tasks past their due day, or planned to end after it, paged
WatchTasksGET /v1/tasks/watcha stream of new ops
Export, ImportGET /v1/tasks/export, POST /v1/tasks/importthe whole op log in the ahto.task.v1 format

States are backlog, ready, doing, review, done and dropped. A rollup counts the subtree below a task, not the task itself: total, done, dropped, hours and the latest due day.

Guards. A write that breaks a rule answers FAILED_PRECONDITION with a Refusal detail naming the guard: dependencies_done (doing while a dependency is open), open_children (done while a child is open), evidence (done with no evidence and no pull request) and reason (dropped, or leaving done, without one). These four are skipped by a force_reason, which the op keeps with the guards it skipped. move_cycle, dependency_cycle, missing and state keep the tree whole and cannot be forced. Over REST a refusal is HTTP 400.

Versions. Every task has a version. Pass it as expected_version on a write: when the task changed since, the write answers ABORTED with a Conflict detail that holds the task as it is now. Without expected_version the write is blind. Links and comments do not change the version.

Planning. PlanTasks fits the open tasks under root_id (every open task without one) into days from start_on (today without it), hours_per_day hours a day (8 without it, at most 24). A task waits on its open depends_on tasks and its open children; of the tasks whose waits are over, the one due soonest goes first, undated ones last. A dependency of a task is as urgent as the task. A task's hours may split across days; a task without hours takes no time, and a parent without hours of its own takes no day and ends with its last child. Every day is a working day. What does not fit is a Miss with a reason: overdue (due before the plan starts), after_due (the plan ends it after its due day), dependency_cycle or beyond_horizon (it would end more than 3,660 days out). The misses come on the first page. GetChain answers the chain with the most hours (fewer tasks between equals) and the ids of any dependency loop; ListLate answers the overdue and after_due misses.

History. Every write is an op in an append-only log: its op_id is the SHA-256 of its fields, and with p2p on and its key there, sig is the node's ed25519 signature. Import refuses an export with a changed op, adds only the ops the store lacks, and works the tree out again, so importing twice adds nothing.

sh
curl -X POST 127.0.0.1:8080/v1/tasks -d '{"title":"ahto","state":"STATE_READY"}'
curl -X POST 127.0.0.1:8080/v1/tasks -d '{"parent_id":"<id>","title":"write the docs","state":"STATE_READY","due_on":"2026-12-15"}'
curl '127.0.0.1:8080/v1/tasks/tree?id=<id>&depth=2'
curl 127.0.0.1:8080/v1/tasks/next
curl '127.0.0.1:8080/v1/tasks/plan?root_id=<id>&hours_per_day=6&start_on=2026-12-01'
curl '127.0.0.1:8080/v1/tasks/chain?root_id=<id>'
curl '127.0.0.1:8080/v1/tasks/late?root_id=<id>'
curl -X POST 127.0.0.1:8080/v1/tasks/<id>/state -d '{"state":"STATE_DONE","pr":"<pull request url>"}'
curl -o tasks.json 127.0.0.1:8080/v1/tasks/export
curl -X POST 127.0.0.1:8080/v1/tasks/import --data-binary @tasks.json   # on another node

Configuration

The settings layers are described in configuration. The gateway's section:

yaml
protocol:
  listen: 127.0.0.1:8080
  allow_remote: false           # true: accept a non-loopback address and remote callers
  origins: []                   # web origins passkeys are used from besides loopback ones,
                                # e.g. https://ahto.example.com (scheme://host[:port])

  tls:                          # both set: every surface over TLS; both empty: plaintext
    cert_file: ""
    key_file: ""

  services:                     # the gRPC backends
    orders:
      address: 127.0.0.1:50051
      descriptors: reflection   # default; or "embedded", or a path to a descriptor set
      timeout: 30s

  rpcs:                         # every surface; a denied rpc does not exist anywhere
    allow: ["base.*", "orders.*"]
    deny: ["orders.OrderService.Purge"]

  streams:                      # how much of a stream MCP, JSON-RPC and GraphQL collect
    max_items: 100
    timeout: 10s

  surfaces:                     # turn one off, or move it
    openapi: {enabled: false}
    mqtt: {enabled: false}
    grpc: {enabled: false}
    rest: {path: /api/}

  mcp:
    deny: ["orders_delete_*"]   # MCP only, on top of protocol.rpcs
    max_stream_items: 20        # overrides protocol.streams for MCP
    tools:
      orders_get_order: {title: Get an order, read_only: true}

Keep the TLS key outside the repository; the config holds only its path.

Extend the gateway from Go

The repository root holds no main package, so the module can be imported. A program extends the gateway through protocol.Options:

go
g, err := protocol.New(ctx, settings, protocol.Options{
    // A gRPC service served from inside the process, with no port.
    Local: []protocol.Local{{Name: "orders", Desc: &ordersv1.OrderService_ServiceDesc, Impl: &orders.Service{}}},
    // A surface of your own. A built-in name replaces that surface.
    Surfaces: []protocol.Surface{protocol.NewSurface("hello", "/hello", func(g *protocol.Gateway) http.Handler {
        return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
            rpc, _ := g.Lookup("orders.ListOrders")
            req, _ := protocol.Decode(rpc, nil)
            out, _ := g.Call(r.Context(), "hello", rpc, req)
            _, _ = w.Write(out)
        })
    })},
})

A service with its own settings embeds the base config.Config in its struct and loads it with config.Load, so it gets the same layers.

From docs/gateway.md · This page as Markdown