Repository navigation
feat(examples): ship echo-mcp, an MCP server bundle that runs through the gateway - #209
Merged
Merged
Conversation
… the gateway A second example beside hello, for a machine with Docker: envs/echo builds an MCP server from a Dockerfile (an AgentEnvEnvironment with one tool, echo), deploy_env deploys it behind the gateway, and env_outcome_verifier checks it by calling the tool through the env's MCP endpoint. It is registered as echo-mcp under agent_env.bundles, so `agent-env run echo-mcp` runs it by name. The server's requirements name agentenv-framework-protocol and mcp, since the protocol doesn't install mcp. A release pins the protocol line to the version it ships with, beside the pyproject pin. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…ed rewrites Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A second example bundle,
echo-mcp, ships in the wheel beside hello. Where hello needs nothing, echo-mcp needs Docker. It builds an MCP server from a Dockerfile, deploys it through the gateway, and checks it by calling its tool:agent-env runlists it beside hello. A rerun writes nothing.The bundle
src/agent_env/examples/echo-mcp/, registered asecho-mcp = "agent_env.examples":envs/echo/, the server:server.pyis anAgentEnvEnvironmentwith one tool,echo, which returns the text it's sent.@environment_card(name="echo")names the env, so it needs noenv.toml.Dockerfileuses the gateway's own pinnedpython:3.11-slim, so a first run pulls that base once.requirements.txtnamesagentenv-framework-protocolandmcp>=1.25,<2. The protocol doesn't installmcp, and without it the container exits at startup.artifacts/check_echo/verify.py, one file, so afileartifact: it callsechothrough the env's MCP endpoint and checks the text comes back.tasks/smoke.json:deploy_env→env_outcome_verifier. Deploying through the gateway, the default, builds the gateway and service-database infra on the first run.Release pin
publish-pypi.ymlpins the protocol line inrequirements.txtto the release's exact version, as it already pinspyproject.toml. In the repo the line is unpinned, so a run from a clone installs the newest published protocol.tst/unit/test_release_protocol_pins.pychecks, on every PR, that each file the release rewrites (pyproject.tomland the requirements path the workflow names) holds exactly one line itssedmatches. A moved folder or a rewritten line then fails the PR, instead of a release after the protocol is already on PyPI.Tests
run_bundle_built_envs_test.py): runsagent-env run echo-mcpby name, then reruns it. The rerun must leave the image, env, artifact and task at "v1, unchanged". Passed locally in 65 s.process_scope_socket_test) failed under parallel load, and passes alone three times out of three; it fails the same way on other branches.agent-env plugin listrow now readsbundle echo-mcp, bundle hello.test_container_journey.pypassed locally (2 passed).--compile-bytecode, which leaves__pycache__in bothenvs/echo/andartifacts/check_echo/. Two runs ofecho-mcpboth pass, and the second leaves every entry unchanged. So the compiled files change neither a hash norcheck_echo's type as a single-file artifact.Not hot path (an example, docs and the publish step), so no release of its own. The example reaches users with the next release.
🤖 Generated with Claude Code


Confidence Score: 5/5
The PR appears safe to merge, with no blocking issues found.Summary
Adds
echo-mcp, a bundled example that builds a Docker image, deploys an MCP server through the gateway, and checks itsechotool.No actionable new issues were found. No previous review threads were supplied.
Diagram
%%{init: {'theme': 'neutral'}}%% flowchart LR A["agent-env run echo-mcp"] --> B["Build echo image"] B --> C["Deploy through gateway"] C --> D["Call echo tool"] D --> E["Check returned text"] E --> F["Tear down sandbox"]Reviews (4) · Last reviewed commit: "Merge remote-tracking branch 'origin/mai..." · Reviewed by Greptile