chsubhasis commited on
Commit
772a578
ยท
verified ยท
1 Parent(s): 7f06d4e

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +139 -36
README.md CHANGED
@@ -420,47 +420,115 @@ Built for **MCP's 1st Birthday Hackathon** hosted by **Anthropic** and **Gradio*
420
 
421
  # VAPT Agent MCP Server
422
 
423
- 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.
424
 
425
- ## MCP Server Overview
426
 
427
- 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.
428
 
429
- **MCP Server URL**: `http://<ip>:<port>/gradio_api/mcp/`
 
 
 
430
 
431
- ### Available MCP Tools
432
 
433
- The server provides **4 MCP tools**:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
434
 
435
- 1. **`run_security_test`** - Execute a security test on an API endpoint
436
- - Parameters:
437
- - `api_endpoint` (string): The target API endpoint URL
438
- - `http_method` (string): HTTP method (GET, POST, PUT, DELETE, etc.)
439
- - `api_key` (string): API authentication key
440
- - Returns: Progress updates, vulnerability report markdown, report file path, and button state
441
 
442
- 2. **`update_dashboard`** - Update the security dashboard
443
- - Parameters:
444
- - `report_md` (string): Report markdown content
445
-
446
- 3. **`tutor_respond`** - Get security guidance from the AI tutor
447
- - Parameters:
448
- - `question` (string): Security-related question
449
- - `history` (array): Conversation history
450
- - `report_md` (string): Current report markdown for context
451
- - Note: If passing a file as input, use the `upload_file_to_gradio` tool first
452
 
453
- ## Configuration
 
 
 
 
 
 
 
 
454
 
455
  ### Streamable HTTP Transport
456
 
457
- For MCP clients that support Streamable HTTP, add this configuration:
458
 
459
  ```json
460
  {
461
  "mcpServers": {
462
- "gradio": {
463
- "url": "http://<ip>:<port>/gradio_api/mcp/"
464
  },
465
  "upload_files_to_gradio": {
466
  "command": "uvx",
@@ -469,7 +537,7 @@ For MCP clients that support Streamable HTTP, add this configuration:
469
  "gradio[mcp]",
470
  "gradio",
471
  "upload-mcp",
472
- "http://<ip>:<port>/",
473
  "<UPLOAD_DIRECTORY>"
474
  ]
475
  }
@@ -479,16 +547,16 @@ For MCP clients that support Streamable HTTP, add this configuration:
479
 
480
  ### STDIO Transport
481
 
482
- For clients like Claude Desktop that only support STDIO, first [install Node.js](https://nodejs.org/en/download/), then use:
483
 
484
  ```json
485
  {
486
  "mcpServers": {
487
- "gradio": {
488
  "command": "npx",
489
  "args": [
490
  "mcp-remote",
491
- "http://<ip>:<port>/gradio_api/mcp/",
492
  "--transport",
493
  "streamable-http"
494
  ]
@@ -500,7 +568,7 @@ For clients like Claude Desktop that only support STDIO, first [install Node.js]
500
  "gradio[mcp]",
501
  "gradio",
502
  "upload-mcp",
503
- "http://<ip>:<port>/",
504
  "<UPLOAD_DIRECTORY>"
505
  ]
506
  }
@@ -508,15 +576,50 @@ For clients like Claude Desktop that only support STDIO, first [install Node.js]
508
  }
509
  ```
510
 
511
- ### File Upload Support
512
 
513
- 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.
514
 
515
  **Requirements**: [uv](https://docs.astral.sh/uv/getting-started/installation/) must be installed.
516
 
517
- ## Resources
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
518
 
519
- - [Gradio MCP Documentation](https://www.gradio.app/guides/building-mcp-server-with-gradio)
520
- - [Hugging Face Spaces Configuration](https://huggingface.co/docs/hub/spaces-config-reference)
 
 
521
 
522
  ---
 
420
 
421
  # VAPT Agent MCP Server
422
 
423
+ ## ๐Ÿ”Œ From Gradio App to MCP Server
424
 
425
+ This VAPT Agent started as an **interactive Gradio web application** designed to provide an intuitive UI for vulnerability assessment and penetration testing. To extend its capabilities and make it accessible to AI assistants and automation tools, **we additionally converted it into a Model Context Protocol (MCP) server** using Gradio's built-in MCP support.
426
 
427
+ Following the guidelines from the **[Hugging Face blog on building MCP servers with Gradio](https://huggingface.co/blog/gradio-mcp)**, we transformed our application to support both web-based and programmatic access. This conversion allows the same powerful security testing features to be available through:
428
 
429
+ - โœ… AI assistants like Claude Desktop
430
+ - โœ… Automation scripts and CI/CD pipelines
431
+ - โœ… Other MCP-compatible tools and workflows
432
+ - โœ… Remote clients via both Streamable HTTP and STDIO transports
433
 
434
+ **MCP Server URL**: `https://mcp-1st-birthday-vapt-agent.hf.space/gradio_api/mcp/`
435
 
436
+ ---
437
+
438
+ ## ๐ŸŽฏ Primary Tool: `vapt_agent_run_security_test`
439
+
440
+ The core functionality of the VAPT Agent is exposed through the **`vapt_agent_run_security_test`** MCP tool, which allows external clients to programmatically trigger comprehensive security assessments.
441
+
442
+ ### ๐Ÿ“‹ Tool Details
443
+
444
+ **Name**: `vapt_agent_run_security_test`
445
+ **Type**: Tool
446
+ **Description**: Execute a complete VAPT security test on an API endpoint. The function validates inputs, starts the VAPT agent in a background thread, and streams real-time progress updates. The test button is disabled during execution and re-enabled when complete.
447
+
448
+ ### ๐Ÿ“ฅ Parameters
449
+
450
+ | Parameter | Type | Required | Description |
451
+ |-----------|------|----------|-------------|
452
+ | `api_endpoint` | string | โœ… Yes | The target API endpoint URL to test (e.g., `https://api.example.com/users`) |
453
+ | `http_method` | string | โœ… Yes | HTTP method for the endpoint (e.g., `GET`, `POST`, `PUT`, `DELETE`) |
454
+ | `api_key` | string | โœ… Yes | API authentication key/token for authorized testing |
455
+
456
+ ### ๐Ÿ“ค Returns
457
+
458
+ The tool yields progressive updates and final results:
459
+
460
+ 1. **Progress Updates**: Real-time streaming of agent activities (endpoint discovery, vulnerability testing, report generation)
461
+ 2. **Report Markdown**: Complete vulnerability assessment report in markdown format
462
+ 3. **Report File Path**: Path to the downloadable report file
463
+ 4. **Button State**: UI state management (disabled during test, enabled on completion)
464
+
465
+ ### ๐Ÿ” What the Tool Does
466
+
467
+ When invoked, `vapt_agent_run_security_test`:
468
+
469
+ 1. **Validates Inputs**: Ensures all required parameters are provided
470
+ 2. **Initiates VAPT Agent**: Starts the Claude-powered security testing agent in a background thread
471
+ 3. **Performs Discovery**: Uses Postman MCP to discover API endpoints and generate OpenAPI specs
472
+ 4. **Executes Security Tests**: Runs custom VAPT MCP tools for:
473
+ - Injection attacks (SQL, XSS, path traversal)
474
+ - Authentication/authorization bypass
475
+ - Rate limiting and DoS vulnerabilities
476
+ - CORS policy validation
477
+ - Security headers analysis
478
+ 5. **Streams Progress**: Yields real-time progress messages for client visibility
479
+ 6. **Generates Report**: Creates comprehensive markdown report with:
480
+ - Executive summary with risk score
481
+ - Detailed vulnerability findings with severity levels
482
+ - Evidence and remediation recommendations
483
+ - Security headers and CORS analysis
484
+ 7. **Updates Dashboard**: Automatically refreshes the visual risk dashboard with charts
485
+
486
+ ### ๐Ÿ’ก Example Usage
487
+
488
+ ```python
489
+ # Example MCP client call
490
+ result = client.call_tool(
491
+ "vapt_agent_run_security_test",
492
+ {
493
+ "api_endpoint": "https://api.example.com/v1/users",
494
+ "http_method": "GET",
495
+ "api_key": "Bearer your-api-key-here"
496
+ }
497
+ )
498
+
499
+ # The tool will stream progress like:
500
+ # "๐Ÿ” Starting API security assessment..."
501
+ # "๐Ÿ“ฎ Discovering endpoints using Postman MCP..."
502
+ # "๐Ÿ›ก๏ธ Testing for SQL injection vulnerabilities..."
503
+ # "๐Ÿ“Š Generating vulnerability report..."
504
+ # "โœ… Security test completed!"
505
+ ```
506
+
507
+ ---
508
 
509
+ ## ๐Ÿ› ๏ธ Additional Tools
 
 
 
 
 
510
 
511
+ While the primary focus is on `vapt_agent_run_security_test`, the MCP server also exposes supporting tools for enhanced functionality:
 
 
 
 
 
 
 
 
 
512
 
513
+ - **`vapt_agent_update_dashboard`**: Updates the visual security dashboard with new report data
514
+ - **`vapt_agent_tutor_respond`**: Provides AI-powered security guidance and answers questions about the generated report using RAG (Retrieval-Augmented Generation)
515
+ - **`vapt_agent__lambda_`**: Internal utility function
516
+
517
+ > **Note**: For most use cases, you'll primarily interact with `vapt_agent_run_security_test` to perform security assessments.
518
+
519
+ ---
520
+
521
+ ## โš™๏ธ MCP Configuration
522
 
523
  ### Streamable HTTP Transport
524
 
525
+ For MCP clients that support Streamable HTTP (recommended), add this configuration:
526
 
527
  ```json
528
  {
529
  "mcpServers": {
530
+ "vapt_agent": {
531
+ "url": "https://mcp-1st-birthday-vapt-agent.hf.space/gradio_api/mcp/"
532
  },
533
  "upload_files_to_gradio": {
534
  "command": "uvx",
 
537
  "gradio[mcp]",
538
  "gradio",
539
  "upload-mcp",
540
+ "https://mcp-1st-birthday-vapt-agent.hf.space/",
541
  "<UPLOAD_DIRECTORY>"
542
  ]
543
  }
 
547
 
548
  ### STDIO Transport
549
 
550
+ For clients like **Claude Desktop** that only support STDIO, first [install Node.js](https://nodejs.org/en/download/), then use:
551
 
552
  ```json
553
  {
554
  "mcpServers": {
555
+ "vapt_agent": {
556
  "command": "npx",
557
  "args": [
558
  "mcp-remote",
559
+ "https://mcp-1st-birthday-vapt-agent.hf.space/gradio_api/mcp/",
560
  "--transport",
561
  "streamable-http"
562
  ]
 
568
  "gradio[mcp]",
569
  "gradio",
570
  "upload-mcp",
571
+ "https://mcp-1st-birthday-vapt-agent.hf.space/",
572
  "<UPLOAD_DIRECTORY>"
573
  ]
574
  }
 
576
  }
577
  ```
578
 
579
+ ### ๐Ÿ“ File Upload Support
580
 
581
+ The `upload_files_to_gradio` tool uploads files from your local `<UPLOAD_DIRECTORY>` (or any subdirectories) to the Gradio app. This is needed because MCP servers require files to be provided as URLs. You can omit this tool if you prefer to upload files manually.
582
 
583
  **Requirements**: [uv](https://docs.astral.sh/uv/getting-started/installation/) must be installed.
584
 
585
+ ---
586
+
587
+ ## ๐ŸŽ“ Use Cases
588
+
589
+ ### For AI Assistants (Claude Desktop)
590
+ ```
591
+ User: "Test the API at https://api.myapp.com/v1/products (GET method)
592
+ with API key Bearer abc123"
593
+
594
+ Claude: *Invokes vapt_agent_run_security_test*
595
+ "I've initiated a security test. The VAPT agent is now scanning
596
+ for vulnerabilities including injection attacks, authentication
597
+ issues, and security misconfigurations..."
598
+ ```
599
+
600
+ ### For CI/CD Pipelines
601
+ ```bash
602
+ # Automated security testing in deployment pipeline
603
+ mcp-client call vapt_agent_run_security_test \
604
+ --api_endpoint "https://staging.api.com/auth/login" \
605
+ --http_method "POST" \
606
+ --api_key "$STAGING_API_KEY"
607
+ ```
608
+
609
+ ### For Security Teams
610
+ ```
611
+ # Remote security assessment without opening the web interface
612
+ # Get comprehensive reports programmatically
613
+ # Integrate with existing security workflow tools
614
+ ```
615
+
616
+ ---
617
+
618
+ ## ๐Ÿ“š Resources
619
 
620
+ - **[Building MCP Servers with Gradio](https://huggingface.co/blog/gradio-mcp)** - The guide we followed to convert our Gradio app to an MCP server
621
+ - **[Gradio MCP Documentation](https://www.gradio.app/guides/building-mcp-server-with-gradio)** - Official Gradio MCP documentation
622
+ - **[Model Context Protocol Specification](https://modelcontextprotocol.io/)** - Understanding MCP architecture
623
+ - **[Hugging Face Spaces Configuration](https://huggingface.co/docs/hub/spaces-config-reference)** - Deploy your own MCP-enabled Gradio apps
624
 
625
  ---