Protecting MCP Servers with dmint-mcp
The Model Context Protocol (MCP) allows AI agents to discover and invoke tools. However, native MCP servers execute any tool call an agent makes without pre-execution authorization.
dmint-mcp operates as a transparent security gateway and proxy between the AI agent and your downstream MCP servers:
Supported Transports
stdio: Local commands executed as subprocesses (e.g.npx @modelcontextprotocol/server-postgres,uvx mcp-server-git).streamable-http: Remote MCP endpoints with automatic SSRF filtering, loopback protection, and Bearer authentication.
Step 1: Discover Tools & Generate Config
Instead of writing protection configs by hand, usedmint-cli to inspect your downstream server and generate both policy.json and mcp_protection.json:
- stdio (Local Command)
- streamable-http (Remote URL)
mcp_protection.json:
mcp_protection.json
Step 2: Run the dmint-mcp Gateway
Launch the proxy pointing to your Core-owned SQLite database and protection configuration:
stdio or HTTP that your AI editor can connect to directly.
Multi-Server Gateway Aggregation
You can protect multiple MCP servers behind a singledmint-mcp gateway:
Multi-Server mcp_protection.json
tools/list, dmint-mcp:
- Queries each downstream server.
- Namespaces tool names deterministically (e.g.
db_prod_query,fs_read_file). - Strips sensitive internal backend URLs or credentials from error messages.
Built-in Security Defenses
- SSRF Protection: Remote streamable HTTP endpoints validate IPs using
ipaddressparsing. Requests to loopback (127.0.0.1,::1), private subnets, or cloud metadata endpoints (169.254.169.254,metadata.google.internal) are blocked fail-closed. - Error Sanitization: Downstream database stack traces or raw connection strings are intercepted and replaced with safe, sanitized error envelopes.
- Deterministic Timeout Controls: Downstream MCP calls that hang or freeze are safely terminated after a strict timeout.
Next Steps
Cursor Integration
Configure Cursor to use dmint-mcp via .cursor/mcp.json.
Claude Code Integration
Configure Claude Code to route tools through dmint-mcp.