feat(skill): add MCP adapter for external tools #159

Closed
opened 2026-02-22 23:39:42 +00:00 by freemo · 1 comment
Owner

Metadata

  • Commit Message: feat(skill): add MCP adapter for external tools
  • Branch: feature/m3-mcp-adapter

Background

The MCP adapter runtime connects to external MCP servers, enumerates their tools, and registers them in ToolRegistry with source=mcp. MCP tool schemas are mapped to internal ToolSpec (inputs/outputs, read_only/writes/checkpointable flags). Invocations validate tool inputs/outputs against the MCP schema and surface errors consistently.

Acceptance Criteria

  • Implement MCP adapter runtime to connect to servers, enumerate tools, and register them in ToolRegistry with source=mcp.
  • Map MCP tool schemas to internal ToolSpec (inputs/outputs, read_only/writes/checkpointable flags).
  • Add invocation path that validates tool inputs/outputs against MCP schema and surfaces errors consistently.
  • Add connection lifecycle management (connect, reconnect, teardown) with safe timeouts.
  • Update docs/reference/mcp_adapter.md with runtime configuration, lifecycle, and error handling.

Definition of Done

This issue is complete when:

  • All subtasks below are completed and checked off.
  • A Git commit is created where the first line of the commit message matches
    the Commit Message in Metadata exactly, followed by a blank line, then
    additional lines providing relevant details about the implementation. The
    commit body should be appropriate in size for a commit message and relatively
    complete in describing what was done.
  • The commit is pushed to the remote on the branch matching the Branch in
    Metadata exactly.
  • The commit is submitted as a pull request to master, reviewed, and
    merged before this issue is marked done.

Subtasks

  • Implement MCP adapter runtime to connect to servers, enumerate tools, and register them in ToolRegistry with source=mcp.
  • Map MCP tool schemas to internal ToolSpec (inputs/outputs, read_only/writes/checkpointable flags).
  • Add invocation path that validates tool inputs/outputs against MCP schema and surfaces errors consistently.
  • Add connection lifecycle management (connect, reconnect, teardown) with safe timeouts.
  • Update docs/reference/mcp_adapter.md with runtime configuration, lifecycle, and error handling.
  • Tests (Behave): Add scenarios for MCP tool discovery, invocation, error mapping, and reconnect behavior.
  • Tests (Robot): Add Robot integration test using a local MCP test server stub.
  • Tests (ASV): Add benchmarks/mcp_runtime_bench.py for adapter overhead.
  • Verify coverage >=97% via nox -s coverage_report. If coverage is <97% then review the current unit test coverage report at build/coverage.xml and use it to write new Behave based unit tests to improve code coverage. Specifically, write Behave style unit tests that are descriptively named and specifically improves coverage on whichever file has the most uncovered lines by writing tests that will target the uncovered lines in the report. Once that is done rerun nox -s coverage_report to verify all tests pass and coverage is above >=97%. Only mark this as complete once coverage is >=97%, if not repeat this task as many times as is needed until coverage reaches >=97%.
  • Run nox (all default sessions, including benchmark), fix any errors if needed ensuring nox passes across entire code base, do not ignore any failure even if it seems unrelated to this commit, fix it.

Section: #### M2: Actor Graphs + Tool Sources (Day 14)
Status: Open

## Metadata - **Commit Message**: `feat(skill): add MCP adapter for external tools` - **Branch**: `feature/m3-mcp-adapter` ## Background The MCP adapter runtime connects to external MCP servers, enumerates their tools, and registers them in ToolRegistry with `source=mcp`. MCP tool schemas are mapped to internal ToolSpec (inputs/outputs, read_only/writes/checkpointable flags). Invocations validate tool inputs/outputs against the MCP schema and surface errors consistently. ## Acceptance Criteria - [ ] Implement MCP adapter runtime to connect to servers, enumerate tools, and register them in ToolRegistry with `source=mcp`. - [ ] Map MCP tool schemas to internal ToolSpec (inputs/outputs, read_only/writes/checkpointable flags). - [ ] Add invocation path that validates tool inputs/outputs against MCP schema and surfaces errors consistently. - [ ] Add connection lifecycle management (connect, reconnect, teardown) with safe timeouts. - [ ] Update `docs/reference/mcp_adapter.md` with runtime configuration, lifecycle, and error handling. ## Definition of Done This issue is complete when: - All subtasks below are completed and checked off. - A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional lines providing relevant details about the implementation. The commit body should be appropriate in size for a commit message and relatively complete in describing what was done. - The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly. - The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done. ## Subtasks - [ ] Implement MCP adapter runtime to connect to servers, enumerate tools, and register them in ToolRegistry with `source=mcp`. - [ ] Map MCP tool schemas to internal ToolSpec (inputs/outputs, read_only/writes/checkpointable flags). - [ ] Add invocation path that validates tool inputs/outputs against MCP schema and surfaces errors consistently. - [ ] Add connection lifecycle management (connect, reconnect, teardown) with safe timeouts. - [ ] Update `docs/reference/mcp_adapter.md` with runtime configuration, lifecycle, and error handling. - [ ] Tests (Behave): Add scenarios for MCP tool discovery, invocation, error mapping, and reconnect behavior. - [ ] Tests (Robot): Add Robot integration test using a local MCP test server stub. - [ ] Tests (ASV): Add `benchmarks/mcp_runtime_bench.py` for adapter overhead. - [ ] Verify coverage >=97% via `nox -s coverage_report`. If coverage is <97% then review the current unit test coverage report at `build/coverage.xml` and use it to write new Behave based unit tests to improve code coverage. Specifically, write Behave style unit tests that are descriptively named and specifically improves coverage on whichever file has the most uncovered lines by writing tests that will target the uncovered lines in the report. Once that is done rerun `nox -s coverage_report` to verify all tests pass and coverage is above >=97%. Only mark this as complete once coverage is >=97%, if not repeat this task as many times as is needed until coverage reaches >=97%. - [ ] Run `nox` (all default sessions, including benchmark), fix any errors if needed ensuring nox passes across **entire** code base, do not ignore any failure even if it seems unrelated to this commit, fix it. **Section**: #### M2: Actor Graphs + Tool Sources (Day 14) **Status**: Open
freemo added this to the v3.1.0 milestone 2026-02-22 23:39:42 +00:00
Author
Owner

Expected completion updated (Day 15 rebaseline): Day 20 / 2026-02-28 (previously Day 18 / 2026-02-26)

**Expected completion updated (Day 15 rebaseline):** Day 20 / 2026-02-28 (previously Day 18 / 2026-02-26)
freemo added the due date 2026-02-24 2026-02-23 18:41:25 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

2026-02-24

Blocks
#393 Epic: Skill & Tool Lifecycle
cleveragents/cleveragents-core
Depends on
Reference
cleveragents/cleveragents-core#159
No description provided.