Skip to content

Add action interceptor for config-driven MCP routing#9

Merged
jpthor merged 4 commits intomainfrom
chore/revert-app-tool-calls
Feb 26, 2026
Merged

Add action interceptor for config-driven MCP routing#9
jpthor merged 4 commits intomainfrom
chore/revert-app-tool-calls

Conversation

@jpthor
Copy link
Contributor

@jpthor jpthor commented Feb 25, 2026

Summary

  • Replace SwapTxBuilder with a generic ActionRouter that intercepts actions based on ACTION_ROUTES env var (e.g. search_token:mcp)
  • Revert build_tx to build_swap_tx as app-only action; remove server-side swap endpoint (/conversations/:id/tx/build) and MCP swap adapter
  • Extract shared processActions/processSuggestions/storeAction helpers to deduplicate buildLoopResponse and emitLoopResponse
  • Add ACTION_ROUTES config field — comma-separated action_type:target pairs (default empty = all actions to app)
  • Only search_token:mcp is supported initially; adding more routes is config-only

Test plan

  • go build ./... passes
  • go test ./... passes
  • go vet ./... passes
  • No env var set → identical behavior to current (all actions pass through to app)
  • ACTION_ROUTES=search_token:mcp → search_token actions intercepted by MCP find_token, tokens in response

🤖 Generated with Claude Code

jpthor and others added 2 commits February 25, 2026 19:23
Replace SwapTxBuilder with a generic ActionRouter that intercepts
actions based on ACTION_ROUTES env var (e.g. search_token:mcp).
Revert build_tx to build_swap_tx as app-only action, remove
server-side swap endpoint and MCP swap adapter. Extract shared
processActions/processSuggestions/storeAction helpers to deduplicate
buildLoopResponse and emitLoopResponse.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
Sends an mcp_status action to the app so the UI can show what MCP
is doing in the background (e.g. "Processing search_token via server").

Co-Authored-By: Claude Opus 4.6 <[email protected]>
jpthor and others added 2 commits February 25, 2026 23:19
Claude sometimes emits sign_tx alongside build_send_tx/build_swap_tx
in the same response, bypassing the confirmation flow. Add a server-side
guardrail in processActions to drop sign_tx when a build action is present.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
- Add AppTool type and resolveTools/cacheToolContext for app-declared
  tool manifest with Redis caching
- Add BuildActionsTable and BuildRespondToUserTool to generate prompt
  and schema from app-declared tools
- Add buildAgentTools to use dynamic enum when tools are provided
- Add isMCPTool helper for MCP status SSE emission
- Add MCP client init retry loop (10 attempts, 3s interval)
- Remove auto_execute from ToolAction, Action, prompt, and schema
- Rename mcpTool variable to route in interceptor

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@jpthor jpthor merged commit faf7e85 into main Feb 26, 2026
1 check passed
@jpthor jpthor deleted the chore/revert-app-tool-calls branch February 26, 2026 11:06
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.

2 participants