aviary-mcp 0.1.0rc1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. aviary_mcp-0.1.0rc1/.dockerignore +9 -0
  2. aviary_mcp-0.1.0rc1/.github/workflows/ci.yml +56 -0
  3. aviary_mcp-0.1.0rc1/.github/workflows/release.yml +28 -0
  4. aviary_mcp-0.1.0rc1/.gitignore +4 -0
  5. aviary_mcp-0.1.0rc1/Dockerfile +55 -0
  6. aviary_mcp-0.1.0rc1/LICENSE +201 -0
  7. aviary_mcp-0.1.0rc1/PKG-INFO +214 -0
  8. aviary_mcp-0.1.0rc1/README.md +198 -0
  9. aviary_mcp-0.1.0rc1/docs/composition.md +36 -0
  10. aviary_mcp-0.1.0rc1/docs/production.md +151 -0
  11. aviary_mcp-0.1.0rc1/examples/calculator.py +14 -0
  12. aviary_mcp-0.1.0rc1/examples/container_app.py +42 -0
  13. aviary_mcp-0.1.0rc1/examples/docker-compose/README.md +168 -0
  14. aviary_mcp-0.1.0rc1/examples/docker-compose/compose.yml +134 -0
  15. aviary_mcp-0.1.0rc1/pyproject.toml +29 -0
  16. aviary_mcp-0.1.0rc1/scripts/dependency-lock-sha256.sh +28 -0
  17. aviary_mcp-0.1.0rc1/scripts/verify-image-reference.sh +23 -0
  18. aviary_mcp-0.1.0rc1/src/aviary_mcp/__init__.py +89 -0
  19. aviary_mcp-0.1.0rc1/src/aviary_mcp/auth.py +1017 -0
  20. aviary_mcp-0.1.0rc1/src/aviary_mcp/enrollment.py +378 -0
  21. aviary_mcp-0.1.0rc1/src/aviary_mcp/exposure.py +1194 -0
  22. aviary_mcp-0.1.0rc1/src/aviary_mcp/finch.py +638 -0
  23. aviary_mcp-0.1.0rc1/src/aviary_mcp/runtime.py +875 -0
  24. aviary_mcp-0.1.0rc1/tests/fixtures/assertion-vectors.json +38 -0
  25. aviary_mcp-0.1.0rc1/tests/test_auth.py +568 -0
  26. aviary_mcp-0.1.0rc1/tests/test_composition.py +55 -0
  27. aviary_mcp-0.1.0rc1/tests/test_container_packaging.py +73 -0
  28. aviary_mcp-0.1.0rc1/tests/test_enrollment.py +193 -0
  29. aviary_mcp-0.1.0rc1/tests/test_exposure.py +849 -0
  30. aviary_mcp-0.1.0rc1/tests/test_finch.py +396 -0
  31. aviary_mcp-0.1.0rc1/tests/test_runtime.py +256 -0
  32. aviary_mcp-0.1.0rc1/uv.lock +1528 -0
@@ -0,0 +1,9 @@
1
+ .git
2
+ .github
3
+ .pytest_cache
4
+ .venv
5
+ **/__pycache__
6
+ **/*.py[cod]
7
+ dist
8
+ build
9
+ *.egg-info
@@ -0,0 +1,56 @@
1
+ name: ci
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ env:
12
+ UV_VERSION: 0.11.2
13
+
14
+ jobs:
15
+ test:
16
+ runs-on: ubuntu-latest
17
+ strategy:
18
+ fail-fast: false
19
+ matrix:
20
+ python: ["3.11", "3.12", "3.13"]
21
+ steps:
22
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
23
+ - uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
24
+ with:
25
+ python-version: ${{ matrix.python }}
26
+ - name: Install locked build frontend
27
+ run: python -m pip install "uv==$UV_VERSION"
28
+ - name: Verify lock and install
29
+ run: |
30
+ uv lock --check
31
+ uv sync --frozen --extra test
32
+ - run: uv run pytest
33
+
34
+ package:
35
+ runs-on: ubuntu-latest
36
+ steps:
37
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
38
+ - uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0
39
+ with:
40
+ python-version: "3.12"
41
+ - run: python -m pip install "uv==$UV_VERSION"
42
+ - run: uv lock --check
43
+ - name: Verify release helper scripts
44
+ run: |
45
+ sh -n scripts/*.sh
46
+ scripts/dependency-lock-sha256.sh "$(scripts/dependency-lock-sha256.sh)"
47
+ scripts/verify-image-reference.sh \
48
+ registry.example/aviary@sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
49
+ - run: uv build
50
+ - name: Validate sidecar Compose model
51
+ run: FINCH_TENANT=ci-tenant docker compose -f examples/docker-compose/compose.yml config --quiet
52
+ - name: Build non-root reference image with lock checksum gate
53
+ run: |
54
+ lock_sha=$(scripts/dependency-lock-sha256.sh)
55
+ docker build --build-arg "AVIARY_LOCK_SHA256=$lock_sha" -t aviary-mcp:test .
56
+ test "$(docker run --rm --entrypoint id aviary-mcp:test -u)" = "10002"
@@ -0,0 +1,28 @@
1
+ name: release
2
+
3
+ on:
4
+ push:
5
+ tags: ["v*"]
6
+
7
+ permissions:
8
+ contents: write
9
+
10
+ jobs:
11
+ package:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - uses: actions/setup-python@v5
16
+ with:
17
+ python-version: "3.12"
18
+ - run: python -m pip install "uv==0.11.2"
19
+ - run: uv lock --check
20
+ - run: uv sync --frozen --extra test
21
+ - run: uv run pytest -q
22
+ - run: uv build
23
+ - name: Write release checksums
24
+ run: cd dist && sha256sum * > SHA256SUMS
25
+ - uses: softprops/action-gh-release@v2
26
+ with:
27
+ files: dist/*
28
+ generate_release_notes: true
@@ -0,0 +1,4 @@
1
+ .venv/
2
+ __pycache__/
3
+ .pytest_cache/
4
+ *.egg-info/
@@ -0,0 +1,55 @@
1
+ # syntax=docker/dockerfile:1.7
2
+
3
+ # Override these with digest-pinned references in release builds, for example:
4
+ # --build-arg PYTHON_BUILD_IMAGE=python:3.12.11-slim-bookworm@sha256:...
5
+ # --build-arg PYTHON_RUNTIME_IMAGE=python:3.12.11-slim-bookworm@sha256:...
6
+ ARG PYTHON_BUILD_IMAGE=python:3.12.11-slim-bookworm
7
+ ARG PYTHON_RUNTIME_IMAGE=python:3.12.11-slim-bookworm
8
+ ARG UV_IMAGE=ghcr.io/astral-sh/uv:0.11.2
9
+
10
+ FROM ${UV_IMAGE} AS uv
11
+ FROM ${PYTHON_BUILD_IMAGE} AS build
12
+
13
+ ARG AVIARY_LOCK_SHA256=""
14
+ ENV UV_COMPILE_BYTECODE=1 \
15
+ UV_LINK_MODE=copy \
16
+ UV_PROJECT_ENVIRONMENT=/opt/aviary-venv
17
+ WORKDIR /build
18
+
19
+ # uv.lock contains artifact hashes. AVIARY_LOCK_SHA256 is an optional release
20
+ # gate for pinning the complete lock file itself (see scripts/dependency-lock-sha256.sh).
21
+ COPY --from=uv /uv /uvx /bin/
22
+ COPY pyproject.toml uv.lock ./
23
+ RUN if [ -n "${AVIARY_LOCK_SHA256}" ]; then \
24
+ printf '%s %s\n' "${AVIARY_LOCK_SHA256}" uv.lock | sha256sum --check --strict -; \
25
+ fi \
26
+ && uv sync --frozen --no-dev --no-install-project
27
+
28
+ COPY README.md LICENSE ./
29
+ COPY src ./src
30
+ RUN uv sync --frozen --no-dev --no-editable \
31
+ && find /opt/aviary-venv -type d -name __pycache__ -prune -exec rm -rf '{}' +
32
+
33
+ FROM ${PYTHON_RUNTIME_IMAGE} AS runtime
34
+
35
+ ARG APP_UID=10002
36
+ ARG APP_GID=10002
37
+ RUN groupadd --gid "${APP_GID}" aviary \
38
+ && useradd --uid "${APP_UID}" --gid "${APP_GID}" \
39
+ --home-dir /home/aviary --create-home --shell /usr/sbin/nologin aviary
40
+
41
+ ENV PATH=/opt/aviary-venv/bin:$PATH \
42
+ PYTHONDONTWRITEBYTECODE=1 \
43
+ PYTHONUNBUFFERED=1 \
44
+ AVIARY_HOST=0.0.0.0 \
45
+ AVIARY_PORT=8000
46
+ WORKDIR /app
47
+
48
+ COPY --from=build /opt/aviary-venv /opt/aviary-venv
49
+ COPY --chown=aviary:aviary examples/container_app.py /app/server.py
50
+
51
+ USER aviary
52
+ EXPOSE 8000
53
+ HEALTHCHECK --interval=15s --timeout=3s --start-period=10s --retries=3 \
54
+ CMD ["python", "-c", "import os,urllib.request; urllib.request.urlopen('http://127.0.0.1:'+os.getenv('AVIARY_PORT','8000')+'/birdz/ready', timeout=2).read()"]
55
+ CMD ["python", "/app/server.py"]
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 DigiBugCat
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,214 @@
1
+ Metadata-Version: 2.4
2
+ Name: aviary-mcp
3
+ Version: 0.1.0rc1
4
+ Summary: An opinionated FastMCP runtime for authenticated MCP and REST services through Finch
5
+ License: Apache-2.0
6
+ License-File: LICENSE
7
+ Requires-Python: >=3.11
8
+ Requires-Dist: anyio<5,>=4.5
9
+ Requires-Dist: fastmcp==3.4.4
10
+ Requires-Dist: httpx<1,>=0.28
11
+ Requires-Dist: pyjwt[crypto]<3,>=2.10
12
+ Provides-Extra: test
13
+ Requires-Dist: pytest-asyncio>=0.24; extra == 'test'
14
+ Requires-Dist: pytest>=8; extra == 'test'
15
+ Description-Content-Type: text/markdown
16
+
17
+ # AviaryMCP
18
+
19
+ AviaryMCP is a release-candidate, opinionated FastMCP runtime for publishing one
20
+ tool definition through MCP and a generated REST/OpenAPI interface. It extends
21
+ FastMCP through public APIs rather than maintaining a source fork, so MCP and
22
+ HTTP share the same registry, validation, middleware, handler, and authorization
23
+ decision.
24
+
25
+ ```python
26
+ from aviary_mcp import AviaryMCP
27
+
28
+ app = AviaryMCP("calculator")
29
+
30
+ @app.tool
31
+ def add(a: int, b: int) -> int:
32
+ """Add two integers."""
33
+ return a + b
34
+
35
+ app.run(transport="http", host="127.0.0.1", port=8000)
36
+ ```
37
+
38
+ `access="local"` is the safe default: HTTP may bind only to loopback, and
39
+ in-process/stdio calls receive a local principal. An unauthenticated network
40
+ service requires explicit `access="public"`. Supplying `auth=` (or a FastMCP
41
+ 3.4 token verifier through `mcp_auth=`) selects private mode.
42
+
43
+ An authenticated REST face uses normalized principals and operation-centric
44
+ scopes:
45
+
46
+ ```python
47
+ from aviary_mcp import AviaryMCP, Principal, StaticKeyAuth
48
+
49
+ app = AviaryMCP(
50
+ "calculator",
51
+ auth=StaticKeyAuth({
52
+ # Use a generated, high-entropy secret in production. The provider
53
+ # immediately retains only its SHA-256 digest.
54
+ "development-secret": Principal(
55
+ subject="example-client",
56
+ scopes={"tool:call:add"},
57
+ ),
58
+ }),
59
+ )
60
+ ```
61
+
62
+ `LocalAuth`, `StaticKeyAuth`, `FinchAssertionAuth`, `AnyOf`, and `AllOf`
63
+ normalize callers into a `Principal`. One outer ASGI authentication boundary
64
+ protects `/mcp`, generated REST routes, and application custom routes together.
65
+ The generated REST operation calls
66
+ `invoke_tool`, which checks `tool:call:<tool-name>` (plus any scopes registered
67
+ with `require_scopes`) before entering FastMCP's normal validation, middleware,
68
+ and handler path. When application auth is configured, the generated catalog
69
+ and OpenAPI routes also require authentication so they do not disclose a
70
+ private service's capability schema. Custom transports can obtain identical
71
+ policy behavior by supplying their normalized principal to `invoke_tool`.
72
+
73
+ The HTTP server exposes:
74
+
75
+ - `POST /mcp` — FastMCP's streamable HTTP MCP transport
76
+ - `GET /api/v1/tools` — tool catalog
77
+ - `POST /api/v1/tools/{tool_name}` — JSON object arguments and a FastMCP
78
+ `ToolResult` response
79
+ - `GET /api/v1/openapi.json` — generated OpenAPI 3.1 document
80
+ - `GET /birdz` — unauthenticated application liveness
81
+
82
+ Every non-health HTTP body, including `/mcp`, is bounded to 1 MiB by default
83
+ (`max_json_request_bytes=`). Generated errors use a stable JSON envelope, and
84
+ private OpenAPI documents publish their configured security schemes.
85
+
86
+ Finch edge identity uses an asymmetric, short-lived caller assertion:
87
+
88
+ ```python
89
+ from aviary_mcp import AviaryMCP, FinchAssertionAuth
90
+
91
+ app = AviaryMCP(
92
+ "calculator",
93
+ auth=FinchAssertionAuth(tenant="andrew", service="calculator"),
94
+ )
95
+ ```
96
+
97
+ The verifier fetches the rotating ES256 public JWKS from
98
+ `https://jwks.finchmcp.com/.well-known/finch-jwks.json` and binds each request
99
+ to its audience, method, exact local path and query, raw body digest, expiry,
100
+ and one-time assertion ID. Multi-process deployments must inject a shared
101
+ atomic replay store; the default replay store is process-local. Finch exposure
102
+ rejects local-trust auth trees and can warm the JWKS before registering ready.
103
+
104
+ The Finch control client can hold a dynamic registration lease against the
105
+ local Go agent contract:
106
+
107
+ ```python
108
+ from aviary_mcp import FinchClient, Registration
109
+
110
+ client = FinchClient()
111
+ async with client.maintain(Registration(
112
+ "calculator",
113
+ "http://127.0.0.1:8000",
114
+ routes=("/mcp", "/api/v1"),
115
+ )):
116
+ ...
117
+ ```
118
+
119
+ The Finch exposure controller supervises the HTTP server, dynamic lease,
120
+ first-run approval, readiness, and shutdown together. Most applications use it
121
+ through `app.run(expose="finch")`; `create_finch_exposure()` is public for async
122
+ supervisors that need explicit lifecycle control.
123
+
124
+ For a Finch-native application, the runtime now owns that lifecycle directly:
125
+
126
+ ```python
127
+ from aviary_mcp import AviaryMCP, FinchAssertionAuth
128
+
129
+ app = AviaryMCP(
130
+ "calculator",
131
+ access="private",
132
+ auth=FinchAssertionAuth(tenant="andrew", service="calculator"),
133
+ )
134
+
135
+ app.run(
136
+ expose="finch",
137
+ app_path="calculator",
138
+ edge_auth="key", # private default; public is a separate approval
139
+ enrollment_output="auto", # TTY instructions or one-line container JSON
140
+ )
141
+ ```
142
+
143
+ The app registers `/mcp`, its configured `api_base`, and `/birdz` as one exact
144
+ allowlist. On first run, device approval is the default: the local Finch agent
145
+ generates the proof key and returns only a verification URL, user code, and
146
+ machine fingerprint. The SDK prints that safe prompt, waits while the operator
147
+ approves the exact service, routes, edge mode, and fingerprint, and resumes when
148
+ Finch has atomically saved a service-scoped credential. AviaryMCP never receives
149
+ a device secret, CLI/admin token, join ticket, or refresh credential.
150
+
151
+ `edge_auth="key"` is private by default. It requires an AviaryMCP app with
152
+ `FinchAssertionAuth`, and the assertion service must match `app_path`.
153
+ `edge_auth="public"` requires an explicitly `access="public"`, unauthenticated
154
+ app plus a separate public-edge confirmation in the browser; the two modes
155
+ cannot be mixed. `/birdz` is process liveness, while `/birdz/ready` returns 200
156
+ only after Finch confirms a live relay.
157
+
158
+ Try it:
159
+
160
+ ```console
161
+ python -m venv .venv
162
+ .venv/bin/pip install -e '.[test]'
163
+ .venv/bin/python examples/calculator.py
164
+
165
+ curl http://127.0.0.1:8000/api/v1/tools
166
+ curl -X POST http://127.0.0.1:8000/api/v1/tools/add \
167
+ -H 'content-type: application/json' -d '{"a": 20, "b": 22}'
168
+ ```
169
+
170
+ ## Production containers
171
+
172
+ The repository includes a multi-stage, non-root reference `Dockerfile` and a
173
+ sidecar Compose deployment under [`examples/docker-compose/`](examples/docker-compose/).
174
+ The default first run is credentialless: start the stack, read the one-line safe
175
+ enrollment event from the app logs, open `verification_uri_complete`, and approve
176
+ the displayed manifest. Finch retains the resulting scoped credential in its
177
+ private persistent state volume, and AviaryMCP pins the approved tenant into its
178
+ assertion verifier before becoming ready. `FINCH_TENANT` is an optional stricter
179
+ account pin, not required configuration. The application receives only a
180
+ dedicated-group Unix control socket and never receives Finch credentials.
181
+ Dependency artifacts are pinned in `uv.lock`; release builds can also gate the
182
+ complete lock with `scripts/dependency-lock-sha256.sh`.
183
+
184
+ Container liveness and readiness are intentionally separate. `/birdz` shows
185
+ that the app process is serving; `/birdz/ready` stays unavailable through device
186
+ approval and relay startup, then becomes healthy only when the Finch relay is
187
+ live. Orchestrators should gate traffic and rollout completion on readiness.
188
+
189
+ See [`docs/production.md`](docs/production.md) for release gates, container
190
+ security boundaries, deployment/rollback steps, and the remaining cloud and
191
+ operator decisions.
192
+
193
+ ## Release-candidate boundaries
194
+
195
+ The runtime deliberately uses FastMCP 3.x public APIs and does not vendor or
196
+ patch FastMCP. FastMCP child servers can be composed with the public live
197
+ `mount()` API; see [`docs/composition.md`](docs/composition.md). REST
198
+ streaming/background tasks and idempotency remain future work. The generated HTTP operation invokes
199
+ `FastMCP.call_tool`, so FastMCP middleware and input validation are shared rather
200
+ than reimplemented.
201
+
202
+ ### Current MCP authentication boundary
203
+
204
+ FastMCP token verifiers passed as `mcp_auth=` are adapted through their public
205
+ `verify_token()` API and participate in the same outer request boundary as
206
+ Aviary providers. This supports direct bearer JWT/OAuth access without a split
207
+ REST/MCP configuration. The adapter does not mount a FastMCP OAuth provider's
208
+ authorization-server or discovery routes; Finch owns OAuth at the edge for this
209
+ release candidate. Hosted standalone OAuth discovery remains a post-pilot item.
210
+
211
+ `FinchAssertionAuth` includes a bounded in-process replay cache by default. A
212
+ multi-process or horizontally scaled application must provide an atomic shared
213
+ replay store before production traffic so a one-time assertion cannot be
214
+ accepted by two workers.