resk-mcp

Secure Model Context Protocol Layer for Python MCP Servers

Security & Management for the Model Context Protocol

resk-mcp (published on PyPI as mcp-resk) is an open-source Python library that adds a robust security and management layer over the official Model Context Protocol Python SDK. MCP servers expose tools, resources, and prompts to AI agents — resk-mcp authenticates, validates, and monitors every interaction.

Key Features

  • JWT authentication — secure MCP server endpoints with JSON Web Tokens
  • Input validation — validate all incoming MCP requests with Pydantic
  • PII detection — detect personally identifiable information in request parameters
  • Prompt injection protection — detect common prompt injection phrases
  • Rate limiting — configurable per-user or per-IP limits (slowapi)
  • Token-based context management — limit request size by estimated token count
  • Interaction tracking — monitor calls to tools, resources, and prompts
  • Dashboard — web-based visualization of MCP interactions and server configuration

Quick Start

pip install mcp-resk

Documentation

The full manual lives on this site: installation, every configuration variable, the enforcement order of the security controls, the dashboard API and the wire format accepted by /mcp_secure.

Why MCP Servers Need Their Own Security Layer

An MCP server is not an internal API: it is an interface that a language model discovers at runtime and invokes semi-autonomously. Three properties make it hard to secure with ordinary API tooling. First, the caller is a model — requests arrive with no human in the loop, so a single injection into tool output can chain a read-only tool into a destructive one. Second, capabilities are dynamic — tools, resources and prompts are enumerated per session, and a client that looks trusted today can surface new tools tomorrow. Third, the payload is prose — parameters that Pydantic would happily accept can still carry prompt-injection instructions aimed at the model.

resk-mcp addresses each one: JWT authentication pins down who is calling, per-caller rate limits and token budgets pin down how much, PII and injection detection screen what crosses the boundary, and interaction tracking records everything for audit.

How It Fits in the RESK Stack

resk-mcp wraps the server side of the Model Context Protocol. On the client side, resk-llm screens the prompts your agent sends before they ever reach a model, and ReskSafety enforces per-user capability masks on the LLM endpoint itself. Deployed together, a compromised tool call is stopped three times: at input, at the MCP boundary, and at generation.

FAQ

  • Does resk-mcp replace the official MCP SDK? No — it layers on top of the official Python SDK. Your existing tools, resources and transports keep working; resk-mcp adds authentication, validation, rate limiting and tracking around them.
  • Which transports are supported? The official SDK's transports (stdio, HTTP/SSE). Whatever your MCP server speaks today, resk-mcp sits between it and your clients.
  • Can I see what my agents are calling? Yes — the built-in web dashboard visualizes every tool, resource and prompt interaction, per session, so anomalous tool usage is visible immediately.
  • Is it production-ready? It is MIT-licensed, dependency-light (FastAPI, Pydantic, slowapi) and deployed behind real MCP servers. For the hardening methodology it implements, read the MCP security integration guide.

Get Started with resk-mcp

Secure your MCP server in minutes. MIT licensed.

View on GitHub PyPI Package Documentation

Related Guides

Going deeper on MCP security: the MCP security hub covers mechanisms, layers and best practices; MCP security for AI agents walks the attack surface; and the step-by-step integration guide shows how to harden a real deployment.

Questions & Support

contact[@]resk.fr

Contact Our Team