Add MCP runtime config foundation#100
Open
Flames4fun wants to merge 2 commits into
Open
Conversation
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.
Refs
#96
Describe the changes you have made in this PR -
This PR is the first of three planned pull requests toward resolving the MCP host/runtime support issue.
The issue asks the harness to move beyond the current MCP workflow adapter and define the first full-host MCP execution path. The complete issue includes keeping MCP dependencies optional, safely starting configured fixture servers or connecting to configured local servers, translating MCP tool calls into canonical
mcp/<server_id>/<tool_name>trace entries, adding local fixture tests with no external services or credentials, and updatingdocs/mcp-adapter-design.mdonce implementation choices are made.This PR intentionally does not complete the full issue. It prepares the configuration and dependency foundation needed for the following MCP host work while preserving the current
--mcp-targetworkflow behavior.Why this work is split into three PRs
The full MCP host/runtime work crosses several areas of the project: runtime configuration, optional dependency management, process execution, MCP SDK integration, trace translation, fixture servers, CLI/runner wiring, and documentation.
Splitting the implementation into three PRs keeps the work easier to review, lowers regression risk, and lets reviewers validate each layer before the next one depends on it.
The planned sequence is:
PR 1: Runtime configuration foundation
PR 2: Minimal stdio host execution
PR 3: CLI, documentation, and final integration
docs/mcp-adapter-design.mdwith the implementation choices.What this PR includes
This PR adds the MCP runtime configuration foundation.
Files changed:
src/agent_harness/mcp_runtime.pytests/test_mcp_runtime.pypyproject.tomlRuntime configuration module
This PR introduces:
MCPServerConfigMCPRuntimeConfigMCPHostRuntimeload_mcp_runtime_config(...)parse_mcp_runtime_config(...)ensure_mcp_sdk_available(...)The accepted runtime config shape is intentionally list-based:
The list shape is deliberate. It allows the harness to reliably detect duplicate
server_idvalues before runtime execution starts. Mapping-shaped server definitions are rejected because YAML mappings can collapse duplicate keys before the harness has a chance to validate them.Validation decisions
This PR validates:
server_idis requiredserver_idmust be non-emptyserver_idmust not contain/server_idvalues failserversmust be a listtransportis requiredstdiois supported for nowcommandis required forstdioargsmust be a listargsentry must be a stringtimeout_secondsdefaults to a safe valuetimeout_secondsmust be greater than zeroThese validations are intentionally conservative because this configuration will later control local process startup for MCP fixture servers.
Dependency strategy
MCP dependencies remain optional.
The base package still does not import or require the MCP SDK. The new runtime module checks for the SDK lazily through
ensure_mcp_sdk_available(...)and raises a clearAdapterErrorwith installation guidance when the SDK is unavailable.The
mcpextra now installs the SDK with a bounded range:The aggregate
adaptersextra includes the same optional MCP dependency:This keeps the base install lightweight while making the MCP install hint actionable.
What this PR intentionally does not include
This PR does not add:
list_toolscall_toolThose items are intentionally left for the following PRs so this foundation remains small and auditable.
Tests and checks run
python -m pytest tests\test_mcp_runtime.pypython -m pytest tests\test_mcp_adapter.pypython -m pytestpython -m compileall -q src\agent_harness testsCode Understanding and AI Usage
Did you use AI assistance (ChatGPT, Claude, Copilot, etc.) to write any part of this code or documentation ?
If you used AI assistance, briefly describe:
--mcp-targetworkflow remains unchanged.python -m pytest tests\test_mcp_runtime.pypython -m pytest tests\test_mcp_adapter.pypython -m pytestpython -m compileall -q src\agent_harness testsChecklist before requesting a review