Add pre-execution trust verification hook for MCP tool calls
- Dominant language
- Python
- Stars
- 18.3k
- Forks
- 2.1k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 29
Description
## Problem
When DocsGPT connects to an MCP server to execute a tool call, there is currently no framework-level hook to verify the server's trustworthiness before execution. This means a misconfigured or malicious MCP server could execute arbitrary operations without any pre-flight safety check.
As MCP adoption grows and users connect to third-party servers, this becomes an increasingly important security surface.
## Proposal
Add a configurable middleware/hook point that runs before any MCP tool execution:
```python
# Example: pluggable trust verification
class TrustVerifier(Protocol):
async def verify(self, server_uri: str) -> TrustResult: ...
# Users bring their own verification backend
app = DocsGPT(
trust_verifier=MyCustomVerifier() # Pluggable
)
```
The hook would:
1. Receive the MCP server URI before the tool call executes
2. Return a pass/fail/warn result
3. Allow the framework to block, warn, or proceed based on the result
## Benefits
- **Framework-agnostic**: users choose their own verification backend (local policy, external API, allowlist, etc.)
- **Opt-in**: doesn't break existing workflows — only activates when configured
- **Extensible**: works with any trust scoring service, SBOM validator, or local policy engine
- **Security-first**: addresses the growing concern around MCP server supply chain risks
## References
- [OWASP MCP Security Cheatsheet](https://owasp.org/www-project-machine-learning-security-top-10/)
- [Anthropic MCP Security Notifications](https://modelcontextprotocol.io/specification/2025-03-26/basic/security)
- Similar patterns exist in middleware architectures (Express.js middleware, Django middleware, etc.)
Contributor guide
Research direction
Start by locating the MCP tool execution path and DocsGPT initialization/configuration entry points. Review how a configurable TrustVerifier could receive the server URI before execution, then identify tests covering pass, fail, and warn outcomes; done means the hook is opt-in and can block, warn, or allow execution as specified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- security
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100