Add pre-execution trust verification hook for MCP tool calls
Problem
When a Flowise agent calls an MCP tool, there's no framework-level hook to verify the server's trustworthiness before execution. Flowise has had documented MCP-related security vulnerabilities in the past, and currently there's no middleware layer to validate MCP servers before tool dispatch.
This is especially relevant for Flowise deployments where users configure MCP servers from untrusted sources.
Proposal
Add a configurable middleware/hook point that runs before any MCP tool execution:
// Example: pluggable trust verification
const flow = new Flowise({
mcpTrustVerifier: {
async verify(serverUri, toolName, params) {
// User brings their own verification logic
const result = await myTrustCheck(serverUri);
return { allowed: result.score > 0.5, reason: result.details };
}
}
});
The hook should:
- Run before any MCP tool call is dispatched
- Receive the server URI, tool name, and parameters
- Return allow/deny/warn with optional metadata
- Be opt-in with zero overhead when not configured
Benefits
- Framework-agnostic: Users choose their own verification backend (local policy, external API, OWASP-aligned checks)
- Opt-in: Doesn't break existing workflows
- Extensible: Works with any trust scoring service or local policy engine
- Security: Addresses OWASP MCP Top 10 risks around unverified server trust (MCP08)
References
- OWASP MCP Security Cheatsheet
- OWASP MCP Top 10 — MCP08: Unverified MCP Server Trust
- Similar proposals: Langflow (#13333), LangChain (#37657), Semantic Kernel (#14032)
pre-execution trust verification + post-execution signed receipts give full coverage.
trust verification says "this server is safe to call." the receipt proves "this is what the server actually did." if the server passes trust but returns compromised data, the receipt chain makes it auditable.
we built this. 4 lines to integrate. cross-validated across 5 JCS implementations.
github.com/arian-gogani/nobulex
I did a quick public-code pass on the MCP path, and this looks like it could be made testable without needing a large design upfront.
Two concrete surfaces I would consider:
packages/server/src/services/custom-mcp-servers/index.ts:authorizeCustomMcpServer()already buildsserverParams, createsMCPToolkit, initializes, stores discovered tools, and has focused tests inindex.test.ts. This looks like a good place to test registration/discovery trust decisions.packages/components/nodes/tools/MCP/core.ts:MCPTool()is the actual dispatch point that creates a fresh client and callsclient.request({ method: 'tools/call', ... }). If the goal is pre-execution trust verification, this is the place where a deny/warn/allow decision should happen beforetools/call, not only during initial authorization.
A small acceptance checklist that would make the hook safer:
- No verifier configured means no behavior change.
- A deny decision prevents
tools/calland still closes the client. - The verifier receives redacted/contextual fields only: transport type, server URL/origin or server id, tool name, and arguments summary/shape rather than raw secrets.
- Cached tool discovery does not bypass per-call verification; the cache can avoid re-listing tools, but each execution should still pass through the hook.
- Tests cover both discovery-time behavior around
authorizeCustomMcpServer()and execution-time denial inMCPTool().
No private access or credentials needed for this. Happy to help with a small test-first PR if maintainers want that direction. No worries if not useful.
MCP tool trust verification needs to happen at the transport layer, not the application layer. Before the agent sees any tool schema, the framework should validate the MCP server's identity and capabilities against an allowlist. We handle this by requiring each MCP server to pass a health check endpoint and match a configured tool allowlist before any tool calls are dispatched. Unknown servers or servers returning unexpected tool schemas get rejected before the agent can invoke them. The verification step adds negligible latency (<50ms) but prevents an entire class of attacks where a malicious MCP server exposes tools designed to exfiltrate data or execute unauthorized operations. Production deployment with MCP security: https://github.com/dakera-ai/dakera-deploy/blob/main/docker/docker-compose.yml
following up since this thread has been active — a few things worth connecting.
@bmtriet's two integration surfaces are right. the authorizeCustomMcpServer() path covers discovery-time trust decisions; MCPTool() is where per-call execution-time verification should happen. the key property that distinguishes these: discovery-time authorization is cached (the server is known-good) but execution-time verification is per-call (the specific tool call stays within authorized scope).
the receipt layer sits at the MCPTool() boundary — after the tool executes, the receipt proves exactly what was called with what parameters, independently verifiable by a party who wasn't running Flowise. action_ref = SHA-256(JCS({agent_id, action_type, scope, timestamp_ms})) is the content-derived identifier that ties the authorized scope to the executed action.
for the Flowise-specific integration: the action_type maps to the MCP tool name and the scope maps to the server origin + tool schema hash — so two calls to the same tool with the same inputs produce the same action_ref, enabling idempotency checking alongside audit. pip install nobulex for the receipt primitive; the field set is in agentrust-io/integrations#6 (merged this week) as a concrete reference.