RedTeam ML API MCP
The RedTeam ML API MCP server enables authorized AI/ML API penetration testing and red-team simulation, allowing security teams to test ML/LLM API endpoints for vulnerabilities, score responses, and generate compliance-aligned reports.
list_attack_packs: Discover all available local defensive red-team attack packs (e.g.,baseline_safe,aws_2026_professional).run_red_team: Execute a safe attack pack against an authorized ML API endpoint with configurable options including HTTP method (POST/GET), custom headers, bearer token authentication, rate limiting (delay between requests), per-request timeout, maximum case limits, dry-run mode, and custom input field names.evaluate_text: Score a single ML API response for defensive risk signals such as prompt injection, sensitive data leakage, unsafe behavior, or policy violations.generate_report: Produce a structured remediation report from a previous red-team run, summarizing findings and recommended fixes.generate_operating_model: Create a strategic operating model brief for security teams, red teams, AI architects, platform teams, and executives — mapping red-team findings to guardrail controls, architecture controls, owners, and release decisions.run_ai_api_pentest: Run a full authorized penetration-test workflow including scope definition, endpoint recon, adversarial campaign execution, evidence capture, bypass-rate metrics, and saved JSON/HTML report artifacts — with explicit authorization gating and alignment to SOC 2, ISO 27001, and GDPR control areas.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@RedTeam ML API MCP run safe red team pack on my chat API"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
RedTeam ML API MCP
Professional AI/ML API penetration testing and red-team simulation over MCP.
RedTeam ML API MCP is a defensive red-team simulator for ML and LLM APIs.
It exposes MCP tools and a CLI that let a security team run controlled test packs against an authorized AI/ML API endpoint, score the responses, generate evidence, and align results to SOC 2, ISO 27001, and GDPR control areas.
Mindset Shift
This project is designed as an adversarial validation plane for AI systems.
The mindset shift is:
From prompt lists to measurable security controls.
From one-time red-team demos to continuous adversarial regression.
From model safety only to full AI system safety: model, prompt, RAG, tools, identity, UI, and deployment.
From guardrails as a checkbox to guardrails as evidence-backed controls.
From pass/fail reports to release decisions with owners, evidence, and remediation.
For AWS-facing work, position it as:
RedTeam ML API MCP validates whether Bedrock Guardrails, application policies, RAG boundaries, and agent tool controls are working before release.
Related MCP server: Security Hunter MCP
AI API Pentest Mode
The red-team value is the pentest workflow:
Define authorized scope and rules of engagement.
Perform safe endpoint recon without infrastructure exploitation.
Run adversarial AI test campaigns.
Capture evidence for each case.
Calculate bypass rate by category.
Map failures to guardrail and architecture controls.
Align results to SOC 2, ISO 27001, and GDPR control areas.
Produce JSON and HTML artifacts for security review.
This is designed for authorized AI/ML API penetration testing. It does not perform credential attacks, destructive actions, third-party scanning, or infrastructure exploitation.
Low-Impact Safety
The runner is built to avoid unnecessary pressure on target systems:
Default delay between test cases.
Per-request timeout.
Optional max-case limit.
Dry-run mode that validates scope without sending prompts.
Explicit
--authorizedgate for pentest mode.
Example low-impact run:
redteam-ml-api pentest \
--target-url http://127.0.0.1:8765/chat \
--pack aws_2026_professional \
--authorized \
--delay-seconds 1.0 \
--max-cases 5Core Idea
Many ML APIs are deployed with weak safety, privacy, or operational controls. This project tests those controls before production by simulating realistic but safe adversarial requests.
The simulator focuses on:
Prompt-injection resilience.
Sensitive data leakage.
Unsafe model behavior.
Excessive confidence or hallucinated policy claims.
Weak API contract behavior.
Regression testing between model versions.
Infrastructure Diagram
flowchart LR
Operator["Security / MLOps Operator"] --> Client["MCP Client\n(Codex, Claude, Cursor, etc.)"]
Client --> Server["RedTeam ML API MCP Server\nstdio JSON-RPC"]
Server --> Packs["Attack Packs\nJSON test cases"]
Server --> Runner["Test Runner\nrate limits + request templates"]
Runner --> Target["Authorized ML API\n/score, /chat, /predict"]
Target --> Runner
Runner --> Evaluator["Response Evaluator\nleakage + refusal + policy checks"]
Evaluator --> Store["Local Evidence\nJSON reports"]
Store --> Client
Client --> Report["Risk Summary + Remediation Plan"]Workflow
sequenceDiagram
participant U as Operator
participant C as MCP Client
participant M as RedTeam MCP Server
participant A as Attack Pack
participant T as Target ML API
participant E as Evaluator
U->>C: Run red-team pack against staging API
C->>M: tools/call run_red_team
M->>A: Load prompt-injection / leakage cases
loop Each test case
M->>T: Send authorized HTTP request
T-->>M: Return model/API response
M->>E: Score response
end
E-->>M: Findings + risk score
M-->>C: Structured report
C-->>U: Summary and fixesMCP Tools
list_attack_packs
Lists available local test packs.
run_red_team
Runs an attack pack against an authorized target.
Input:
{
"target_url": "http://localhost:8000/chat",
"pack": "baseline_safe",
"method": "POST",
"timeout_seconds": 10
}evaluate_text
Scores a single response for risk signals.
Input:
{
"text": "model response here"
}generate_report
Creates a compact remediation report from a previous run result.
generate_operating_model
Creates a strategic operating-model brief for security teams, red teams, AI architects, platform teams, and executive sponsors.
It maps red-team categories to guardrail controls, architecture controls, owners, and release decisions.
run_ai_api_pentest
Runs an authorized AI/ML API pentest workflow with scope, recon, campaign execution, evidence, metrics, release decision, and saved report artifacts.
Quick Start
cd "/home/local-renad/renad-repo/RedTeam-ML-PenTest-MCP"
python3 -m venv .venv
. .venv/bin/activate
pip install -e ".[dev]"
python -m pytestRun the demo API:
scripts/start_mock_api.shOpen the browser health check:
http://127.0.0.1:8765/Try a sample browser request:
http://127.0.0.1:8765/chat?input=helloStop the demo API when finished:
scripts/stop_mock_api.shRun the simulator in another terminal:
redteam-ml-api run --target-url http://127.0.0.1:8765/chat --pack baseline_safeRun the professional 2026 AWS-facing pack:
redteam-ml-api run --target-url http://127.0.0.1:8765/chat --pack aws_2026_professional --reportGenerate the mindset-shift operating model:
redteam-ml-api brief --target-url http://127.0.0.1:8765/chat --pack aws_2026_professionalRun a pentest engagement:
redteam-ml-api pentest \
--target-url http://127.0.0.1:8765/chat \
--pack aws_2026_professional \
--tester "Red Team" \
--environment "staging" \
--authorizedRun from a reusable config file:
redteam-ml-api pentest --config examples/pentest_scope.jsonAuthenticated API example:
redteam-ml-api pentest \
--target-url https://api.example.com/chat \
--authorized \
--bearer-token "$API_TOKEN" \
--header "X-Environment: staging" \
--input-field message \
--delay-seconds 1.0Reports are saved under:
reports/Or run the full demo:
scripts/demo_pentest.shMore details:
Start the MCP server:
redteam-ml-api-mcpMCP Client Config
{
"mcpServers": {
"redteam-ml-api": {
"command": "python",
"args": ["-m", "redteam_ml_api_mcp.server"],
"cwd": "/Users/renad-local/renad-repo/RedTeam-ML-PenTest-MCP"
}
}
}Safety Boundary
This project is for authorized defensive testing only. It does not exploit infrastructure, bypass authentication, scan third-party systems, or generate malware. Attack packs are plain JSON so teams can review exactly what is being sent.
Available Tools
6 toolsevaluate_textB
Evaluate one ML API response for defensive risk signals.
Inputs: text (required).
generate_operating_modelD
Generate a mindset-shift operating model for security, red team, AI architecture, platform, and executives.
Inputs: run_result.
generate_reportA
Generate a remediation report from a run_red_team result.
Inputs: run_result (required).
list_attack_packsA
List local defensive red-team attack packs.
Inputs: no named parameters.
run_ai_api_pentestB
Run an authorized AI/ML API penetration-test workflow with scope, recon, campaign execution, evidence, metrics, and report artifacts.
Inputs: target_url (required), authorized (required), pack, method, +10 more.
run_red_teamC
Run a safe red-team pack against an authorized ML API endpoint.
Inputs: target_url (required), pack, method, timeout_seconds, +6 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool has a clearly distinct purpose: evaluating responses, generating models/reports, listing packs, and running tests at different granularities. No overlap.
All tool names follow a consistent verb_noun pattern using snake_case, making them predictable and easy to distinguish.
With 6 tools covering listing, testing, evaluation, and reporting, the count is well-scoped for a red-team ML API server without being excessive.
Core red-team workflow is covered (list packs, run tests, evaluate, report), but lacks tools for managing results or configurations, which is a minor gap.
Maintenance
Related MCP Connectors
Test your AI agents for security and safety weaknesses, and re-verify the fixes.
Autonomous AppSec & DAST scanner across 12 security domains (260+ controls) with 3-Layer Triage.
Run real, auto-recovered cloud attacks on AWS, Azure and GCP to test your defenses.
Authorized security scans, evidence, fix prompts and retests for AI-built web apps.
Related MCP Servers
- AlicenseCqualityDmaintenanceAn automated penetration testing framework that enables intelligent security assessments through reconnaissance, vulnerability scanning, and controlled exploitation. Features AI-driven workflow management with comprehensive reporting for authorized security testing.2718 npm7BSD 3-Clause
- AlicenseNot gradedqualityCmaintenanceEnables autonomous AI agents and penetration testers to conduct authorized security audits with persistent cross-session memory, zero-trust secret scrubbing, dynamic OWASP/ASVS checklists, and hallucination-free exploit PoC generation from captured traffic.1MIT
- AlicenseCqualityDmaintenanceEnables AI agents to orchestrate 25+ security tools for penetration testing through natural language, automating scans, vulnerability detection, and report generation.31MIT
- FlicenseNot gradedqualityCmaintenanceEnables authorized autonomous application and API security testing, allowing LLM-driven agents to plan and execute pentest checks while a deterministic policy layer enforces scope and authorization outside the model.-