feat(adapters): add mcp_tool_interceptor() to AxonFlowLangGraphAdapter#109
Open
feat(adapters): add mcp_tool_interceptor() to AxonFlowLangGraphAdapter#109
Conversation
7f85d98 to
f365d84
Compare
Adds a factory method that returns an async MCP tool interceptor ready
for use with MultiServerMCPClient(tool_interceptors=[...]).
The interceptor enforces AxonFlow input and output policies around every
MCP tool call: mcp_check_input → handler() → mcp_check_output. Two
design decisions incorporated:
- Redacted output passthrough: when mcp_check_output returns redacted_data,
the interceptor substitutes it for the original result rather than
discarding it silently.
- Pluggable connector type derivation: accepts an optional connector_type_fn
callable to override the default "{server_name}.{tool_name}" mapping,
allowing callers to match their AxonFlow policy connector type keys.
Closes #107
f365d84 to
d3421b4
Compare
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
Closes #107.
Adds
mcp_tool_interceptor()factory method toAxonFlowLangGraphAdapter, returning an async callable ready to pass directly toMultiServerMCPClient:The interceptor enforces AxonFlow input and output policies around every MCP tool call:
mcp_check_input → handler() → mcp_check_output.Design decisions
Redacted output passthrough — when
mcp_check_outputreturnsredacted_data, the interceptor substitutes it for the original result rather than discarding it silently:Pluggable connector type derivation — accepts an optional
connector_type_fncallable to override the default"{server_name}.{tool_name}"mapping:No new runtime dependencies
MCPToolCallRequestfromlangchain-mcp-adaptersis only used for type hints underTYPE_CHECKING. The interceptor duck-typesrequest.server_name,request.name, andrequest.argsat runtime.Test plan
tests/test_langgraph_adapter.pycovering: allowed call, connector type derivation, input blocked, output blocked, redacted output passthrough, customconnector_type_fn, factory independence