MCP Secure Agents
Secure MCP server that enforces allowlist-based policies, read-only access, input validation, and human-in-the-loop for sensitive actions, enabling safe vulnerability analysis.
README
MCP Secure Agents
Практический репозиторий про безопасных AI-агентов: минимальные права, allowlist, валидация, Human-in-the-Loop и sandbox.
Цель: показать, что модель может ошибаться — но система не обязана позволять ей выполнить опасное действие.
Что здесь есть
- защищённый MCP-agent для анализа уязвимостей;
- read-only доступ к данным;
- allowlist разрешённых инструментов;
- блокировка WRITE / DELETE / shell-команд;
- валидация входных параметров;
- Human-in-the-Loop для чувствительных действий;
- журналирование решений и блокировок;
- простой policy engine, который легко расширять.
Главная идея
USER → AGENT → POLICY → TOOL → RESULT
↓
BLOCK
Агент может решить, что ему нужен инструмент. Но перед выполнением запрос проходит через политику безопасности.
Демо-сценарий
Пользователь просит:
Проверь уязвимости пакета freerdp3
Агенту разрешено:
READ package info
READ CVE database
CALL allowed API
Если агент попробует сделать:
UPDATE vulnerabilities SET status='fixed';
он получит:
BLOCKED
reason: write_database is not allowed
Это и есть главный security boundary: не просьба в system prompt, а технически enforced policy.
Быстрый старт
Требования
- Python 3.10+
uvилиpip
Установка
git clone https://github.com/TopskiyPavelQwertyGang/mcp-secure-agents.git
cd mcp-secure-agents
uv sync
Или:
python -m venv .venv
source .venv/bin/activate
pip install "mcp[cli]" pydantic
Запуск демо policy engine
uv run python demo.py
Запуск MCP server
uv run mcp dev server.py
Структура
.
├── README.md
├── QUICKSTART.md
├── demo.py
├── server.py
├── policy.py
├── validators.py
├── audit.py
├── pyproject.toml
├── policies/
│ └── agent-policy.yaml
├── examples/
│ ├── allowed.json
│ └── blocked.json
└── docs/
├── threat-model.md
└── controls.md
Security controls
1. Allowlist
Только явно разрешённые инструменты доступны агенту.
2. Permissions
Каждый инструмент получает минимально необходимые права.
3. Validation
Параметры tool-call проходят проверку до выполнения.
4. HITL
Чувствительные операции требуют подтверждения человека.
5. Sandbox
Опасные действия должны выполняться в изолированной среде.
Что попробовать руками
- Запустите
demo.py. - Посмотрите разрешённые действия.
- Попробуйте
write_database— получите блокировку. - Измените
policies/agent-policy.yaml. - Повторите запуск и посмотрите, как меняется поведение агента.
Learning path
- mcp-protocol-guide — понять MCP.
- mcp-secure-agents — научиться безопасно давать агентам инструменты.
- mcp-use-cases — перейти к рабочим сценариям.
Важно
Этот проект — учебный security lab. Не используйте demo-policy как готовую production-защиту без адаптации под вашу инфраструктуру, модель угроз, IAM и процессы аудита.
Prompt ≠ Security Boundary
Безопасность должна обеспечиваться не обещанием модели, а архитектурой системы.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.