Files
archie/internal/platform/pg/migrations/00005_mcp_servers.sql
T
sam cf249d7643 feat(connectors): MCP servers as a fourth accepted package, with their declared tools offered to agents (archie #2005)
An investigation needs Prometheus's own metrics, and Prometheus publishes an
MCP server, so the connectors module now runs MCP servers as published instead
of wrapping them: a stdio binary in its own user and network namespace with an
egress allow-list, or an HTTP endpoint dialled through declared egress.

Acceptance names the transport, the tools it permits, and the credential slots
that resolve into the server's environment (stdio) or Authorization header
(HTTP). Each permitted tool is declared as a lookup, or as an action with its
effect; a tool the server lists but the acceptance doesn't name is never
offered, and a declared tool the server doesn't list fails the start rather
than going silently missing. Declared tools reach agents beside connector
lookups through the same declaration and the same call path, with the server's
own input schema, under a name no connector can take: an accepted name runs one
package.

A server that fails to start, exits or stops answering is reported by readiness
and reconnected with backoff. Tool calls carry a deadline, results are capped,
and an error result fails its call with the server's own text rather than the
run.

The investigate prompt now asks for a time-until-full figure from
`predict_linear` through the metrics server instead of an estimate from raw
points.

The old core MCP path stays for now: the legacy gateway and task containers
still read config.Tools.MCPServers, so it goes with them.
2026-11-15 23:43:39 +11:00

30 lines
1.3 KiB
SQL

-- +goose Up
-- An accepted MCP server runs as published: a stdio binary with its arguments,
-- or an HTTP endpoint. Tools are what its acceptance declares it may offer.
ALTER TABLE connectors.accepted
ADD COLUMN args jsonb NOT NULL DEFAULT '[]',
ADD COLUMN url text NOT NULL DEFAULT '',
ADD COLUMN tools jsonb NOT NULL DEFAULT '[]';
ALTER TABLE connectors.accepted DROP CONSTRAINT accepted_contract_check;
ALTER TABLE connectors.accepted
ADD CONSTRAINT accepted_contract_check
CHECK (contract IN ('connector', 'secretengine', 'mcp'));
-- An MCP server's credential slot is an HTTP auth scheme: basic or bearer.
ALTER TABLE connectors.credentials DROP CONSTRAINT credentials_kind_check;
ALTER TABLE connectors.credentials
ADD CONSTRAINT credentials_kind_check
CHECK (kind IN ('machine', 'age', 'basic', 'bearer'));
-- +goose Down
ALTER TABLE connectors.credentials DROP CONSTRAINT credentials_kind_check;
ALTER TABLE connectors.credentials
ADD CONSTRAINT credentials_kind_check CHECK (kind IN ('machine', 'age'));
ALTER TABLE connectors.accepted DROP CONSTRAINT accepted_contract_check;
ALTER TABLE connectors.accepted
ADD CONSTRAINT accepted_contract_check CHECK (contract IN ('connector', 'secretengine'));
ALTER TABLE connectors.accepted DROP COLUMN tools, DROP COLUMN url, DROP COLUMN args;