AgentGuard MCP Server
Provides a secure MCP boundary for AI agents, intercepting and validating tool calls, redacting secrets, and requiring human approval for sensitive actions with a tamper-evident audit trail.
README
AgentGuard
Runtime security for AI agents. AgentGuard intercepts tool calls at an MCP boundary, validates provenance and arguments, applies deterministic policy precedence, redacts secrets, pauses sensitive actions for human approval, and writes a tamper-evident audit trail.

The application boots with a complete deterministic attack demo and zero credentials. Live adapters activate only when their hosted-service environment variables are present. AgentGuard never downloads a model and has no Ollama or local-vLLM fallback.
This is not a chatbot wrapper. It demonstrates agent security, protocol design, streaming UX, policy engineering, human-in-the-loop execution, multi-runtime architecture, observability, retrieval, evaluation, and hosted deployment.
Four attack fixtures prove four distinct controls:
| Fixture | Expected enforcement | Security control |
|---|---|---|
| Indirect prompt injection | BLOCK |
Untrusted provenance + destructive SQL |
| Secret exfiltration | REDACT |
Recursive credential removal before egress |
| Production rollback | APPROVAL |
Suspended execution + operator decision |
| Repository intelligence | ALLOW |
Explicit read-only tool authorization |
Stack, with a real job for each tool
| Technology | Implemented responsibility |
|---|---|
| Vercel AI SDK | Typed UI event streaming and hosted model calls |
| OpenAI Responses API | Explicit responses() inference route using GPT-5.6 |
| OpenAI Agents SDK | Primary hosted agent runtime connected to protected MCP tools |
| Model Context Protocol | Streamable HTTP gateway with six guarded tools |
| LangGraph | Stateful retrieve → assess → approve/finalize workflow |
| Mastra | TypeScript-native agent through LiteLLM |
| PydanticAI | Typed SecurityAssessment structured output |
| LiteLLM | Hosted provider routing, retry, and budget gateway |
| Hosted vLLM | Remote OpenAI-compatible serving adapter; never local |
| PostgreSQL + pgvector | Security-run persistence, checkpoints, semantic audit history |
| Qdrant | Hosted policy and attack-corpus vector retrieval |
| LlamaIndex | Ingestion and retrieval over the Qdrant collection |
| DSPy | Evaluation-driven policy-classifier optimization |
| Arize Phoenix | Hosted OpenTelemetry traces and evaluation visibility |
Run the credential-free demo
pnpm install
pnpm dev
Open http://localhost:3000. The first attack runs automatically. No .env.local is necessary.
pnpm typecheck
pnpm test
pnpm build
Repository map
src/app/ Next.js UI and API routes
src/components/ Recruiter-facing attack console
src/lib/guard/ Policy engine, schemas, fixtures, audit chain
src/lib/mcp/ MCP server and protected real/simulated executors
src/lib/runtimes/ OpenAI Agents, Mastra, and Python-service adapters
src/lib/ai/ LiteLLM and remote-vLLM model providers
services/intelligence/ Hosted FastAPI intelligence service
infrastructure/postgres/ pgvector schema
infrastructure/litellm/ Hosted LiteLLM routing config
tests/ Policy and browser-level verification
docs/ Architecture, threat model, demo, credentials
For the live architecture, see Architecture. For the exact optional keys and their destinations, see Credentials. For interview delivery, use the 90-second demo script.
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.
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.
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.
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.