Spaces:
Sleeping
title: Vapt Agent
emoji: ๐
colorFrom: red
colorTo: green
sdk: gradio
sdk_version: 6.0.1
app_file: app.py
pinned: false
license: apache-2.0
short_description: AI-powered VAPT agent built with Claude, MCP, and Gradio.
tags:
- mcp-in-action-track-enterprise
- mcp-in-action-track-consumer
- mcp-in-action-track-creative
- building-mcp-track-enterprise
- building-mcp-track-consumer
- building-mcp-track-creative
thumbnail: >-
https://cdn-uploads.huggingface.co/production/uploads/66d9b98cec009ab887601d00/2x4OCbl46kVrGOh1a2S4z.png
๐ VAPT Agent - Intelligent API Security Testing
MCP's 1st Birthday Hackathon Submission ๐
Hosted by Anthropic & Gradio on Hugging Face
๐ Hackathon Page
LinkedIn post - Refer HERE || Demo Video - Refer HERE
๐ Project Overview
VAPT Agent is an autonomous, AI-powered Vulnerability Assessment and Penetration Testing (VAPT) platform that revolutionizes API security testing. By combining Anthropic's Claude Agent SDK, Postman MCP Server, Gradio Web Interface, and RAG-based security education, this project showcases the power of Model Context Protocol (MCP) for building intelligent, context-aware security tools.
๐ฏ What Makes This Special?
This project demonstrates three powerful MCP integrations:
- ๐ค Anthropic Claude Agent SDK - Powers the core VAPT reasoning agent with Claude Haiku 4.5 from AWS Bedrock.
- ๐ฎ Postman MCP Server - Enables automatic API discovery and OpenAPI specification generation
- ๐ ๏ธ Custom VAPT MCP Server - Provides specialized security testing tools (SQL injection, XSS, auth testing, etc.)
- ๐งฉ Gradio Web Interface โ Provides an interactive, real-time UI for the VAPT workflow, enabling progress streaming, report visualization, dashboard analytics, and an integrated AI Security Tutor.
Combined with a modern Gradio interface and RAG-powered AI tutor using Chroma vector search, VAPT Agent bridges the gap between automated security testing and developer education.
๐๏ธ Architecture Overview
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Gradio Web Interface โ
โ (Real-time Progress, Visual Dashboard, AI Security Tutor) โ
โโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ VAPT Agent Orchestrator โ
โ (vapt_agent.py) โ
โโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โผ โผ
โโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Claude Agent SDK โ โ MCP Servers (via Claude SDK) โ
โ (Haiku 4.5 Model) โโโโโโค โโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโ โ
โ โ โ โ Postman โ โ Custom VAPT โ โ
โ โข Reasoning โ โ โ MCP Server โ โ MCP Tools โ โ
โ โข Test Planning โ โ โ (SSE) โ โ (Local Server) โ โ
โ โข Report Gen โ โ โโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโ
โผ โผ
โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโ
โ Postman API โ โ Target API Endpoint โ
โ โข Discovery โ โ โข Security Testing โ
โ โข Schema Gen โ โ โข Vuln Detection โ
โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ AI Security Tutor (RAG) โ
โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Nebius LLM โ โ Chroma DB โ โ Nebius Embeddings โ โ
โ โ (gpt-oss-20b)โโโโค Vector Store โโโโค (Qwen3-Embed-8B) โ โ
โ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโ โ
โ โฒ โฒ โ
โ โ โ โ
โ โโโโโโโโโโโโโโโโโโโโโดโโโ VAPT Report Context โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ How It Works
- User Input โ User provides API endpoint via Gradio interface
- Discovery โ Claude agent uses Postman MCP to discover endpoints and generate OpenAPI spec
- Testing โ Agent invokes Custom VAPT MCP tools to test for vulnerabilities
- Reasoning โ Claude Haiku 4.5 through AWS Bedrock analyzes results and generates comprehensive security report
- Visualization โ Gradio dashboard displays risk scores and severity charts
- Education โ User asks questions โ AI Tutor uses RAG (Chroma + Nebius embeddings) to retrieve relevant report sections โ Nebius LLM generates educational explanations
โจ Key Features
๐ Comprehensive Security Testing
Automated vulnerability detection powered by Claude's reasoning and custom MCP tools:
- Injection Attacks: SQL injection, XSS, path traversal
- Authentication & Authorization: Broken auth detection, token validation
- Rate Limiting: DoS vulnerability assessment, burst testing (50 requests)
- CORS Policy: Origin validation, wildcard detection
- Security Headers: HSTS, CSP, X-Frame-Options, X-Content-Type-Options, etc.
๐จ Modern Gradio Web Interface
Beautiful, responsive UI built with Gradio featuring:
- Real-time Progress Streaming from Claude agent
- Downloadable Markdown Reports for audit trails
- Visual Risk Dashboard with interactive charts (risk gauge + severity pie chart)
- Tabbed Interface for organized information flow
- Custom CSS Styling for professional appearance
๐ง RAG-Powered AI Security Tutor
Context Engineering & Retrieval-Augmented Generation (RAG) implementation:
How RAG Works in VAPT Agent:
Document Chunking (
ai_tutor.py):- Report split into logical sections based on markdown headers (
##) - Large sections auto-chunked to ~2000 characters for optimal retrieval
- Preserves context boundaries for coherent answers
- Report split into logical sections based on markdown headers (
Vector Embedding (Nebius + Chroma):
- Each chunk embedded using Qwen3-Embedding-8B (Nebius)
- Vectors stored in Chroma ephemeral in-memory database
- Index automatically rebuilt when report changes (SHA-256 content hashing)
- Never reuses old vectors for new reports
Semantic Search:
- User question embedded with same model
- Top-K (default: 4) relevant chunks retrieved via cosine similarity
- Context passed to LLM for grounded responses
Context Engineering:
- System prompt instructs LLM to prioritize retrieved VAPT report context
- Combines report snippets + optional web search (Tavily)
- Prevents hallucination by grounding answers in actual findings
Benefits:
- โ Accurate answers specific to YOUR security report
- โ No generic security advice - tailored to actual findings
- โ Efficient: Only relevant context sent to LLM (cost-effective)
- โ Educational: Explains vulnerabilities in your specific API
๐ฎ Postman MCP Integration
Leverages Postman's official MCP server (SSE protocol):
- Automatic API endpoint discovery
- OpenAPI/Swagger specification generation
- Request/response schema analysis
- Collection management for organized testing
- Seamless integration via Claude Agent SDK
๐ค Anthropic Claude SDK
Core agent powered by Claude Agent SDK:
- Model: Claude Haiku 4.5 (fast, cost-efficient, high-quality reasoning)
- Multi-turn Reasoning: Agent conversations up to 100 turns
- Tool Orchestration: Coordinates Postman MCP + Custom VAPT MCP tools
- Flexible Deployment: Anthropic API or AWS Bedrock
- Permission Mode: Bypass permissions for automated testing
๐ Benefits & Impact
For Security Professionals
- โก Save Time: Automate repetitive VAPT tasks
- ๐ Visual Insights: Instantly understand risk posture with charts
- ๐ Learn On-the-Go: AI tutor explains findings while you work
- ๐ Audit-Ready Reports: Comprehensive markdown reports with evidence
For Developers
- ๐ก๏ธ Shift-Left Security: Test APIs during development
- ๐ Security Education: Learn secure coding through AI tutor
- ๐ง Easy Integration: Simple API endpoint input
- ๐ Fast Feedback: Get results in minutes, not days
For Organizations
- ๐ฐ Cost-Effective: Reduce manual penetration testing costs
- ๐ Scalable: Test multiple APIs rapidly
- ๐ Compliance: Generate audit-ready security reports
- ๐ Continuous Testing: Integrate into CI/CD pipelines
Technical Innovation
- ๐งฉ MCP Showcase: Demonstrates multiple MCP server integration
- ๐ฌ RAG Best Practices: Production-ready context engineering
- ๐จ UX Excellence: Beautiful, intuitive Gradio interface
- ๐ Open Source: Extensible architecture for custom tools
๐ Prerequisites
- Python 3.10+
- Postman API Key - For MCP server access
- Anthropic API Key OR AWS Bedrock - For Claude Haiku 4.5
- Nebius API Key - For AI Tutor (optional but recommended)
๐ฆ Installation
Clone the repository:
git clone <repository-url> cd vapt-agentCreate virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activateInstall dependencies:
pip install -r requirements.txtConfigure environment:
cp .env.template .env # Edit .env with your credentials
โ๏ธ Configuration
Create a .env file with the following variables:
# --- Core VAPT Agent Configuration ---
# AWS Bedrock (set to 1 to use Bedrock, 0 for Anthropic API)
CLAUDE_CODE_USE_BEDROCK=1
# AWS Credentials (if using Bedrock)
AWS_ACCESS_KEY_ID=your_access_key
AWS_SECRET_ACCESS_KEY=your_secret_key
AWS_REGION=us-east-1
# Model selection for VAPT Agent (Haiku 4.5 recommended)
ANTHROPIC_MODEL=global.anthropic.claude-haiku-4-5-20251001-v1:0
# If using Anthropic API directly:
# ANTHROPIC_API_KEY=sk-ant-...
# Postman API key (get from https://postman.com/settings/api-keys)
POSTMAN_API_KEY=your_postman_api_key
# --- AI Tutor Configuration (Nebius) ---
# Nebius API Key for Tutor and Embeddings
NEBIUS_API_KEY=your_nebius_api_key
# Nebius Base URL (optional, defaults to standard endpoint)
# NEBIUS_BASE_URL=https://api.tokenfactory.nebius.com/v1
# AI Tutor Chat Model
NEBIUS_TUTOR_MODEL=gpt-oss-20b
# Embedding Model for Vector Search (REQUIRED for RAG)
NEBIUS_EMBEDDING_MODEL=Qwen3-Embedding-8B
# --- Optional Web Search ---
# TAVILY_API_KEY=tvly-...
๐ฎ Usage
1. Web Interface (Recommended)
Launch the Gradio dashboard for an interactive experience:
python app.py
- Open your browser at
http://localhost:7861 - Enter the API endpoint and HTTP method
- Watch the real-time progress log
- View the generated report, risk dashboard, and chat with the AI Security Tutor
2. Command Line Interface
Run the agent directly from the terminal:
python vapt_agent.py
(Ensure TEST_API_ENDPOINT and TEST_API_METHOD are set in your .env file for CLI usage)
๐ Security Tests Performed
The agent uses custom MCP tools (vapt_tools.py) to perform:
1. Injection Testing
- SQL Injection with various payloads (e.g.,
' OR '1'='1) - XSS (Cross-Site Scripting) detection
- Path traversal attempts (
../../../etc/passwd)
2. Authentication Testing
- Endpoint access without credentials
- Authentication bypass attempts
- Token validation and expiration checks
3. Rate Limiting
- Burst request testing (50 rapid requests)
- 429 status code detection
- DoS vulnerability assessment
4. CORS Policy
- Origin validation testing
- Wildcard (
*) detection - Cross-origin request testing
5. Security Headers
Strict-Transport-Security(HSTS)X-Content-Type-OptionsX-Frame-OptionsContent-Security-PolicyX-XSS-Protection
๐ Output
The agent generates a comprehensive Markdown report saved as vapt_report_YYYYMMDD_HHMMSS.md containing:
- Executive Summary with risk score
- Vulnerability Details (Severity, Description, Evidence, Remediation)
- Security Headers Analysis
- CORS Policy Review
- Rate Limiting Assessment
- Recommendations for fixes
๐ ๏ธ Troubleshooting
Postman API Key Issues
- Get your API key from: https://postman.com/settings/api-keys
- Ensure the key has necessary permissions for collections and environments
AWS Bedrock Issues
- Verify AWS credentials are correct
- Ensure you have access to Claude models in your region
- Check IAM permissions for Bedrock
AI Tutor Not Working
- Check
NEBIUS_API_KEYis set - Ensure
NEBIUS_EMBEDDING_MODELis set toQwen3-Embedding-8Bfor vector search to work - Verify
chromadbis installed:pip install chromadb
Gradio Interface Issues
- Ensure port 7861 is not blocked
- Try clearing browser cache
- Check console logs for errors
๐ค Contributing
Contributions are welcome! Please follow the existing code structure:
- Keep tools modular in
vapt_tools.py - Add configuration in
config.py - Update
.env.templatefor new variables - Follow Python best practices (PEP 8)
- Add docstrings for new functions
๐ License
MIT License
โ ๏ธ Disclaimer
This tool is for authorized security testing only. Always obtain proper authorization before testing any API endpoints. Unauthorized testing may be illegal and unethical.
๐ Acknowledgments
Built for MCP's 1st Birthday Hackathon hosted by Anthropic and Gradio.
Technologies Used:
VAPT Agent MCP Server
This Gradio application has been integrated with Model Context Protocol (MCP) to enable AI assistants and other MCP clients to interact with the VAPT (Vulnerability Assessment and Penetration Testing) agent programmatically.
MCP Server Overview
The MCP server exposes the VAPT agent's functionality through a standardized interface, allowing AI assistants like Claude to perform security testing and receive guidance directly.
MCP Server URL: http://<ip>:<port>/gradio_api/mcp/
Available MCP Tools
The server provides 4 MCP tools:
run_security_test- Execute a security test on an API endpoint- Parameters:
api_endpoint(string): The target API endpoint URLhttp_method(string): HTTP method (GET, POST, PUT, DELETE, etc.)api_key(string): API authentication key
- Returns: Progress updates, vulnerability report markdown, report file path, and button state
- Parameters:
update_dashboard- Update the security dashboard- Parameters:
report_md(string): Report markdown content
- Parameters:
tutor_respond- Get security guidance from the AI tutor- Parameters:
question(string): Security-related questionhistory(array): Conversation historyreport_md(string): Current report markdown for context
- Note: If passing a file as input, use the
upload_file_to_gradiotool first
- Parameters:
Configuration
Streamable HTTP Transport
For MCP clients that support Streamable HTTP, add this configuration:
{
"mcpServers": {
"gradio": {
"url": "http://<ip>:<port>/gradio_api/mcp/"
},
"upload_files_to_gradio": {
"command": "uvx",
"args": [
"--from",
"gradio[mcp]",
"gradio",
"upload-mcp",
"http://<ip>:<port>/",
"<UPLOAD_DIRECTORY>"
]
}
}
}
STDIO Transport
For clients like Claude Desktop that only support STDIO, first install Node.js, then use:
{
"mcpServers": {
"gradio": {
"command": "npx",
"args": [
"mcp-remote",
"http://<ip>:<port>/gradio_api/mcp/",
"--transport",
"streamable-http"
]
},
"upload_files_to_gradio": {
"command": "uvx",
"args": [
"--from",
"gradio[mcp]",
"gradio",
"upload-mcp",
"http://<ip>:<port>/",
"<UPLOAD_DIRECTORY>"
]
}
}
}
File Upload Support
The upload_files_to_gradio tool uploads files from your local <UPLOAD_DIRECTORY> (or any subdirectories) to the Gradio app. This is required because MCP servers need files as URLs. You can omit this tool if you prefer manual file uploads.
Requirements: uv must be installed.