Skip to content

[AAASM-121] ✨ (mcp): Implement ClientSession universal governance interception#14

Merged
Chisanan232 merged 13 commits into
masterfrom
v0.0.0/AAASM-121/mcp_clientsession_adapter
Apr 30, 2026
Merged

[AAASM-121] ✨ (mcp): Implement ClientSession universal governance interception#14
Chisanan232 merged 13 commits into
masterfrom
v0.0.0/AAASM-121/mcp_clientsession_adapter

Conversation

@Chisanan232
Copy link
Copy Markdown
Contributor

Description

Implement the MCP ClientSession.call_tool runtime adapter as the universal cross-framework fallback interception layer.

This PR adds:

  • Idempotent async monkey patching for mcp.ClientSession.call_tool
  • MCPToolBlockedError for DENY/PENDING-reject governance outcomes
  • Server identifier extraction across SSE, stdio, WebSocket, and transport metadata
  • Async approval wait handling for PENDING decisions
  • Truncated result audit recording (2000 chars)
  • Unit and integration coverage for direct MCP usage and LangChain coexistence

Type of Change

  • ✨ New feature
  • 🔧 Bug fix
  • ♻️ Refactoring
  • 🍀 Performance improvement
  • 📚 Documentation update
  • 🚀 Release

Breaking Changes

Does this PR introduce any breaking changes?

  • No
  • Yes (please describe below)

Related Issues

  • Related JIRA ticket: AAASM-121
  • Related GitHub issues: N/A

Testing

Describe the testing performed for this PR:

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed
  • No tests required (explain why)

Commands run:

  • uv run pytest

Result:

  • 110 passed, 7 skipped

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Comments added for complex logic
  • Documentation updated if needed
  • All tests passing

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 30, 2026

Codecov Report

❌ Patch coverage is 94.00000% with 9 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
agent_assembly/adapters/mcp/patch.py 93.75% 9 Missing ⚠️

📢 Thoughts on this report? Let us know!

@sonarqubecloud
Copy link
Copy Markdown

@Chisanan232 Chisanan232 merged commit c43231a into master Apr 30, 2026
22 checks passed
@Chisanan232 Chisanan232 deleted the v0.0.0/AAASM-121/mcp_clientsession_adapter branch April 30, 2026 07:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant