Skip to content
shlokbainee23Public

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

MCP Shield

Enterprise MCP Security Scanner + AI Security Copilot

MCP Shield helps teams detect prompt injection, tool poisoning, secret leakage, dangerous permissions, scope creep, and tool shadowing in Model Context Protocol (MCP) tool/server JSON — before AI agents trust those tools.

Upload a config → get a deterministic risk score, OWASP-mapped findings, attack-path simulation, deployment recommendation, and an AI copilot that explains the results.
Advisory only — your config is never modified.

Next.js TypeScript GitHub License


Problem statement

MCP lets AI agents call external tools. Tool descriptions and permissions are trusted inputs. Attackers can hide instructions in descriptions, request over-broad permissions, or embed secrets — turning a helpful integration into a credential-leak or command-injection path.

Most teams still install MCP tools the same way they install npm packages: fast, and with little security review.

Why MCP security matters

Without review With MCP Shield
Developer downloads MCP Developer uploads MCP
Agent executes untrusted description AI + rule scan runs
Prompt injection / secret exfil Threats flagged with evidence
Business impact Risk report + trust decision

Solution

MCP Shield is a production-style security workflow for MCP configs:

  1. Scan — deterministic detectors + scoring engine
  2. Enrich — explanations / suggested fixes (templated or LLM-assisted)
  3. Decide — AI trust decision + deployment recommendation
  4. Explain — AI Security Copilot chat grounded in the scan result
  5. Harden (advisory) — suggested safer description + real re-scan of a clone

Architecture

flowchart LR
  A[MCP JSON Upload / Sample] --> B[POST /api/scan]
  B --> C[String Extraction]
  C --> D[Detectors]
  D --> E[Scoring + Combos]
  E --> F[Attack Simulation]
  F --> G[Trust Decision]
  G --> H[Enrichment]
  H --> I[Copilot Insights]
  I --> J[Results Dashboard]
  J --> K[POST /api/copilot/chat]
  J --> L[POST /api/copilot/harden]
Loading

AI pipeline

  • Deterministic core — findings, scores, combinations, attack simulation, trust decision always come from the scanner.
  • Optional LLM — when LLM_PROVIDER is featherless (or groq) with the matching API key, enrichment / insights / harden / chat use a real model. On any failure, engines fall back to templated logic.
  • Hackathon default path — Featherless.ai via OpenAI-compatible https://api.featherless.ai/v1 (docs).
  • Offline demo — LLM_PROVIDER=mock runs with zero API keys.

Security workflow

  1. Parse & validate MCP config
  2. Extract strings / fields
  3. Run detectors (injection, secrets, permissions, scope, command, shadowing)
  4. Score + grade + combination risks
  5. Simulate attack path
  6. Produce trust decision & recommendations
  7. Generate copilot insights / executive review
  8. Present dashboard (export JSON, chat, advisory harden)

Features

  • AI Trust Decision (Trusted / Review Required / Not Trusted)
  • Deterministic risk score & security grade
  • Prompt injection & tool poisoning detection
  • Secret / credential leakage detection
  • Permission & combination-risk analysis
  • Scope creep & command-injection signals
  • Tool shadowing detection
  • OWASP MCP category mapping
  • Attack-path simulation
  • Business impact categories
  • Executive summary & deployment recommendation
  • AI Security Copilot chat (scan-grounded)
  • Advisory hardened rewrite + re-scan
  • JSON export; browser print for PDF-like output
  • Five Acme DevTools samples with verifyable ground truth

Technology stack

Layer Tech
App Next.js 16 (App Router), React 19, TypeScript
UI Tailwind CSS 4, shadcn/ui, Framer Motion, Lucide
Validation Zod
Scanner Custom TypeScript rule engines
AI Featherless.ai or Groq (optional), deterministic fallbacks
Samples samples/acme_devtools/*

Installation

git clone https://github.com/shlokbainee23/MCPshield.git
cd MCPshield
# if the app lives in a subdirectory:
# cd mcp-shield
npm install
cp .env.example .env.local
npm run dev

Open http://localhost:3000.

Scripts

npm run dev             # local development
npm run build           # production build
npm run start           # serve production build
npm run verify:samples  # assert sample score/trust ground truth
npm run lint            # eslint

Environment variables

Copy .env.example → .env.local:

Variable Required Description
LLM_PROVIDER No mock, featherless (hackathon), or groq
FEATHERLESS_API_KEY For featherless Key from Featherless API keys
FEATHERLESS_MODEL No Default meta-llama/Meta-Llama-3.1-8B-Instruct
GROQ_API_KEY For groq Groq API key
GROQ_MODEL No Defaults to llama-3.3-70b-versatile

Never commit .env.local.


API reference

Method Path Purpose
POST /api/scan Full scan + copilot insights
POST /api/copilot/chat Chat grounded in a ScanResult
POST /api/copilot/harden Advisory harden + re-scan of a clone
GET /api/samples/[name] Load a sample MCP JSON

All advisory responses include "copilot_mode": "advisory_only".


Project structure

src/
  app/                 # App Router pages + API routes
  scanner/             # Detectors, scoring, trust, attack simulation
  aiCopilot/           # Insights, chat, harden, forecast, LLM client
  enrichment/          # Finding explanations / suggested fixes
  components/
    landing/           # Enterprise landing experience
    dashboard/         # Scan results dashboard
    aiCopilot/         # Copilot UI
    scan/              # Shared ScanPanel
  types/contract.ts    # Contract v1 — single source of truth
  lib/                 # Schemas, helpers
samples/acme_devtools/ # Demo MCP configs
scripts/verify-samples.ts

Sample ground truth

File OWASP Score Grade Trust
doc_lookup — 8–15 A+ Trusted
code_assistant MCP03 82–92 F Not Trusted
file_manager MCP02 55–68 C Review Required
deploy_runner MCP05 70–80 D Review Required
env_configurator MCP01 75–88 D–F Not Trusted

npm run verify:samples asserts every sample lands in its documented range.


Demo flow (≈3 minutes)

  1. Problem — landing “Why MCP Security Matters” attack timeline
  2. Attack example — select code_assistant (MCP03 poisoning)
  3. Upload / scan — watch the scan progress stages
  4. AI analysis — trust decision, score, grade
  5. Threat detection — findings table + evidence spans
  6. Executive report — summary, business impact, deployment call
  7. Copilot — ask “What’s the highest risk?”
  8. Harden (advisory) — generate safer description + compare re-scan
  9. Conclusion — export JSON; emphasize advisory-only guarantee

Screenshots

Add deployed screenshots here before submission:

  • Landing hero
  • Attack timeline
  • Results dashboard (Not Trusted example)
  • AI Copilot chat
  • Hardened rewrite panel

Hard rules (never violated)

  • Never modifies the uploaded config — advisory only
  • Every finding carries an evidence_span from the actual config text
  • API responses include "copilot_mode": "advisory_only"
  • No “Apply Fix” that mutates the user’s file
  • Finding IDs are per-scan: {scan_id}_F001, …
  • Contract v1 snake_case field names

Future roadmap

  • Dedicated PDF report pipeline (browser print available today)
  • CI / GitHub Action for MCP config scanning
  • Multi-tool suite comparison view
  • Optional MITRE / CVE enrichment providers (architecture-ready; not wired without credentials)
  • Team workspaces & audit history

Contributors

Built for an AI-first hackathon focused on real MCP security risk.

License

Private / hackathon submission unless otherwise specified by the authors.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages