kestrel-feature-mcp
Model Context Protocol (MCP) server management and tool bridging for Kestrel Sovereign. Discover servers in the official MCP Registry, Docker's catalog, or the bundled local catalog. Run Docker MCP gateways and custom container servers through the native MCP client.
Installation
uv pip install kestrel-feature-mcp
Dependencies
kestrel-sovereign-sdk[httpx2]>=0.39.2,<1docker>=7.1.0mcp>=2.3,<3requests>=2.34.2anyio>=4.7,<5pydantic>=2.12,<3jsonschema>=4.26,<5
Usage
Once installed, the MCPAgent feature is automatically discovered by kestrel-sovereign via the kestrel_sovereign.features entry point.
Commands
!mcp-gateway-start <servers>— Start Docker MCP Gateway!mcp-gateway-stop— Stop gateway!mcp-load <image>— Load MCP server from Docker image!mcp-unload <container>— Unload a container and remove its saved connection!mcp-list— List running MCP servers!mcp-search <query>— Search official registry server names!mcp-catalog— List one page of the official registry!mcp-info <name>— Inspect an official namespaced server and version!mcp-docker-catalog <query>— Search Docker's catalog
Calling tools
Discovered server tools are mounted in the host's dynamic registry. Invoke the
advertised handle through Kestrel's governed tool dispatch; its exact owner and
handle determine permissions, approvals and audit records. The generic
mcp_call_tool / mcp_gateway_call tools and their command aliases have been
removed: allowing a generic dispatcher could otherwise bypass a DENY on its
target. A host without the dynamic registry cannot mount MCP tools.
Each handle is bound to the connection that advertised its schema. Reloading or withdrawing that connection invalidates its old handles, including a call still waiting for approval. A fresh handle and approval are required after reload.
Configuration
| Variable | Description |
|---|---|
DOCKER_HOST |
Docker daemon socket (optional, defaults to local) |
KESTREL_MCP_REGISTRY_URL |
HTTPS Registry API base, default https://registry.modelcontextprotocol.io/v0.1 |
KESTREL_MCP_REGISTRY_TIMEOUT |
Request deadline including decoding and schema validation, in seconds; default 30 |
KESTREL_MCP_REGISTRY_MAX_BYTES |
Maximum response body size, default 2097152 bytes |
KESTREL_MCP_REGISTRY_PROBLEM_CHARS |
Maximum characters per diagnostic field, default 256 |
KESTREL_MCP_REGISTRY_PROBLEMS_PER_RECORD |
Maximum diagnostic details per rejected record, default 4 |
KESTREL_MCP_REGISTRY_TEXT_CHARS |
Maximum characters per tool confirmation or error, default 8192 |
Discovery sources
mcp_search, mcp_catalog and mcp_server_info default to source="official".
Select source="local" explicitly to search or inspect bundled entries by
capability/category. Docker discovery retains the separate mcp_docker_catalog
tool. A local entry never overrides an official entry with the same name, and
an official registry error never becomes a successful local result.
Official catalog and search requests return one page, with limit from 1 to 100
(default 20). Omit limit and cursor for the local source; explicit values
are refused there. Search and catalog list latest versions only; detail lookup
can request a known exact version. Pass the exact result.metadata.nextCursor back as cursor for
the next page. Detail lookup accepts the namespaced server name and an exact
version, or latest; results retain the actual version, remote endpoint
templates, package definitions and registry metadata. Search results are
discovery metadata: they do not install packages, connect to remote endpoints or
send credentials. SSE definitions remain visible with an unsupported-transport
label. These discovery tools work without Docker.
Registry HTTPS requests use the SDK's canonical URL policy and pinned transport,
with native TLS verification, no redirects and no proxy-environment routing.
Private registry addresses, malformed page envelopes, failed pagination and
HTTP errors fail explicitly. Individual records that violate the published
schema are rejected with visible diagnostics and a partial result; the exact
next cursor remains available. result retains the unmodified response,
including rejected records, and rejected_records identifies their indices,
names and schema problems. Only conforming records are displayed as catalog
entries. A rejected detail lookup is inspectable with its schema problems;
RegistryRecord.require_valid() refuses it. Publisher text is quoted and
control characters are escaped in the human-readable rendering. The request
deadline and byte limit also apply to custom registry bases.
Schema diagnostics are bounded to 256 characters per path, detail or rejected
name, with four problems per rejected record plus an explicit omitted-count
summary. Every rejected index remains excluded from conforming results even
when diagnostics are omitted. Model-facing confirmation and error text each
have an 8192-character budget; complete record blocks and escaped cursor lines are omitted with a visible
notice rather than cutting an opaque cursor into a different value. The full
response and exact cursor remain in data.result. The next cursor has display
priority over record blocks so a normal pagination token remains available when
the record display budget is exhausted. Configure these bounds with
KESTREL_MCP_REGISTRY_PROBLEM_CHARS, KESTREL_MCP_REGISTRY_PROBLEMS_PER_RECORD
and KESTREL_MCP_REGISTRY_TEXT_CHARS. These limits apply to the official source.
Validation follows JSON Schema 2020-12 without a format checker: uri and
date-time formats are annotations, not additional validity assertions. Strict
JSON syntax, schema types, required fields, enumerations and other assertions
are enforced. Discovery does not establish that an advertised endpoint works.
The bundled registry_openapi_2025_12_01.json is an unmodified JSON conversion of
the official Registry API contract,
commit 11b7b0e274d518b6f449c5ee3518a6151d9848b9. Its upstream YAML SHA-256 is
3ed9ca429754087f2c7de81aa845c1cab3286c33941ac48482f923bbd6f1442d;
the converted JSON SHA-256 is
69a092a20321d6616d0e83933b1de39916bd0fa87975d7931ef3b92f825c7edc.
The upstream license is included alongside it as registry_contract_LICENSE.txt.
This Registry API/schema revision is independent of the MCP wire revision.
tests/fixtures/official_registry_rejected_repository.json was captured from
the official registry on 2026-10-17 for ai.agentrapay/agentra version 1.0.0.
Its repository: {} violates the published required-field contract. The
fixture proves visible rejection and continued pagination; the schema is not
relaxed to accept it.
Development
uv pip install -e ".[test]"
uv run pytest
Native MCP protocol
The feature uses the official MCP 2.x Client over Streamable HTTP. Its standard
version negotiation selects 2026-07-28 with modern servers and a mutually
supported published revision with other servers. Tool listings expose the
selected protocol_version. Container servers must expose MCP at /mcp; the
standalone HTTP+SSE transport and gateway transport="sse" selection have been
removed. Docker MCP Gateway 0.44.1 negotiates 2025-11-25; its lack of the
newer revision is tracked in
Kestrel #3683.
Features requiring newer capabilities must check the negotiated connection.
Gateway server lists describe requested configuration; observed tools do not
prove readiness of every requested server.
Tool discovery follows pagination and fails on repeated cursors. Negotiation
uses the connection deadline, then discovery uses the whole-call deadline.
Cancelled startup joins its transport owner before returning. Shutdown has its
own graceful deadline (KESTREL_MCP_CLOSE_TIMEOUT, default 15 seconds), including
session termination and partially completed SDK entry. Forced cleanup gets one
further budget of the same length. The owner timer survives caller cancellation;
failures propagate and any unfinished owner is retained for a cleanup retry.
Upgrade the MCP feature before upgrading a host with the Phoenix 20/Pydantic AI
2 dependency set. Feature 0.4's mcp<2 requirement cannot resolve with that set.
The host dependency lock must be regenerated and verified as part of the same
rollout (Kestrel Sovereign epic #3679).
Container identities bind the agent DID and image, with Docker's implicit
:latest tag made explicit by the same planner used for routing and unload.
Catalog names resolve to their container image through the load route. New managers require
owner_did; they reuse a process only when its ownership and image labels
match. Each agent can reload or unload its own server independently. MCP
container ports bind only to host loopback. Listings retain failed containers'
identifiers so they can be unloaded even when no tools were published. Saved
container entries using the former global identifiers require explicit removal
with !mcp-unload <old-identifier> and reconnection with !mcp-load <image>.
The current unload result does not distinguish saved-configuration removal
from live-process removal; outcome reporting is tracked in
#26.
Shut down the old feature before upgrading to release the processes it owns.
Hosts expose their agent DID through agent_id. Missing required Python
dependencies, invalid identities and unexpected initialization failures stop
startup. An unavailable local Docker daemon disables local Docker operations;
it is handled separately from an invalid installation. This includes Docker SDK
errors and its Requests transport failures during connection or ping. Other
implementation errors still fail startup. Saved container connections retain
their container mode when restored, even if the Docker catalog changes. Server
selectors and image references reject surrounding whitespace before routing.
Container creation is recorded before Docker starts the process, so a rejected command still leaves an identifiable resource that unload can reclaim. Resource configuration transitions are serialized per container; a slow load does not block another container's unload. Model-facing handles use the image reference, while resource ownership keeps the full DID-bound identifier. Ordinary MCP tool calls remain concurrent and hold no configuration lock.
Docker catalog discovery uses the current OCI catalog JSON API. Set KESTREL_MCP_DOCKER_CATALOG to select a catalog reference (default mcp/docker-mcp-catalog). Missing metadata is pulled into Docker's cache; unreadable catalogs return an error. Catalog counts describe available definitions, while gateway status reports this process's requested configuration and observed tools.
The installation CI matrix also runs the production connection through the
official MCP conformance harness,
pinned to 0.2.0-alpha.12 with an npm integrity lock. It runs tools_call and
request-metadata explicitly at 2026-07-28, with no expected-failure baseline.
These checks cover native tool exchange, wire schemas, per-request metadata and
version negotiation retry. Optional client capabilities that Kestrel does not
advertise are reported as skipped by the official scenario. The OAuth, input
request and extension scenarios remain outside this initial CI profile; passing
these two scenarios does not establish full client conformance (epic #3679 A7).
To run the same profile locally with Python test dependencies and Node 24+:
npm ci --prefix tests/conformance --ignore-scripts --no-audit --no-fund
for scenario in tools_call request-metadata; do
tests/conformance/node_modules/.bin/conformance client \
--command '.venv/bin/python tests/conformance/client.py' \
--scenario "$scenario" --spec-version 2026-07-28 --timeout 60000 \
--output-dir "tests/conformance/results/$scenario" || exit $?
done
Update the pinned harness and lock together, rerun both scenarios, and review new required scenarios as the remaining host capabilities land.
Metadata
Release files for kestrel-feature-mcp 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| kestrel_feature_mcp-0.6.0.tar.gz | 195.1 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| kestrel_feature_mcp-0.6.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 263.9 kB
Release files / kestrel_feature_mcp-0.6.0.tar.gz
| Download URL | kestrel_feature_mcp-0.6.0.tar.gz |
|---|---|
| Size | 195.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b42689d73e553637616c07dbecc63e1f9bf78225ce81eaae0091f1dc963dcf3a
|
|
BLAKE2b-256 checksum How to use checksums |
48318e2dabbb2cd5c2f2f5fd7a968247bc732cbdc6c92b7e2adf0affc48ae8d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.
Transparency logRelease files / kestrel_feature_mcp-0.6.0-py3-none-any.whl
| Download URL | kestrel_feature_mcp-0.6.0-py3-none-any.whl |
|---|---|
| Size | 68.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9f3606d11fdafcd49c8ff71f50a80f616429d5b5258b9915f6ce1ca510afc9ee
|
|
BLAKE2b-256 checksum How to use checksums |
6f7c522b94650083537602fd08d509c467126d914723a018a4fb251a8963746c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.
Transparency logSecurity for kestrel-feature-mcp 0.6.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for kestrel_feature_mcp-0.6.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.