Skip to main content
Free
Open Source
Runs Offline
CI/CD
DevOps
AppSec

AI Surface

Find the AI attack surface your code is about to ship.

ai-surface finds the AI your team is shipping (agents, MCP servers, RAG stores, LLM calls, and APIs), flags the risky ones, and gates net-new risk in your pull requests before it ships. It runs locally and offline, so your source never leaves the host.

terminal

uvx --from apisec-ai-surface ai-surface scan .
⭐ Star on GitHubRead the State of AI Surface report↗

MIT · Python 3.9+ · No telemetry · Runs offline

Detection

Eight categories of AI attack surface, mapped from source

Configuration, keys, manifests, and specs are detected across stacks. Deep code-level detection is strongest today for Python and TypeScript / JavaScript.

10 Python + 6 JS/TS frameworks

Agent frameworks

LangChain, LangGraph, CrewAI, LlamaIndex, AutoGen, Haystack, Semantic Kernel, Pydantic AI, AWS Strands, Vercel AI SDK, Mastra, OpenAI Agents, and more. Extracts agent tool inventories and flags financial, destructive, and high-blast-radius authority.

Discovery + deep-dive audit

MCP servers

Configured and in-house MCP servers. Audited findings include risk flags, remediation, detected secrets by name and type only, and registry / trust signals.

13 stores + 2 frameworks

Vector stores / RAG

Pinecone, Weaviate, Chroma, Qdrant, Milvus, FAISS, LanceDB, pgvector, and more, plus LangChain and LlamaIndex retrieval. Flags managed-store egress, RAG data flow, and external ingestion (the poisoning surface).

13 providers

LLM SDK call sites

Anthropic, OpenAI, Azure OpenAI, AWS Bedrock, Google Gen AI, Vertex AI, Together, Mistral, Cohere, Groq, LiteLLM, and Vercel AI SDK. Extracts models and flags non-literal prompt flow.

HTTP / REST + OpenAPI

API endpoints

OpenAPI / Swagger specs and framework routes (FastAPI, Starlette, Flask, Express, Spring, Django). Captures method, path, auth style, and object-id segments that may need BOLA review.

Configs + source

Model gateways

LiteLLM proxy, Portkey, Helicone, Cloudflare AI Gateway, and OpenRouter. Captures routed-model inventories where visible.

Manifests + IaC

AI infrastructure

Kubernetes, Helm, Docker Compose, Dockerfiles, and Terraform for AI runtimes and managed services: Ollama, vLLM, TGI, Triton, llama.cpp, Bedrock, SageMaker, and Vertex.

Names only, values redacted

AI provider keys

Provider key names such as OPENAI_API_KEY, ANTHROPIC_API_KEY, and AZURE_OPENAI_* across env files and config. Values are never read or printed.

The output

See exactly what a PR is about to ship

Every audited finding carries an assessed severity, the OWASP LLM mapping, the governance clause it evidences, and a fix. Run --ui for an interactive, loopback-only map of the same surfaces.

terminal
JSON
markdown
CycloneDX AI-BOM
SARIF 2.1.0

ai-surface scan .

AI Attack Surface Report ──────────────────────────────────────────────── Project: lumora Repository: apisec-inc/lumora 19 production AI surfaces · 25 risk indicators · 8 detectors Severity: 6 high · 2 medium AGENT FRAMEWORKS • LangChain Agent: support_agent.py [HIGH] Tools: process_refund, lookup_order, send_email ⚑ [HIGH] financial-action OWASP: LLM06 EU AI Act Art. 9 Agent can invoke financial tools (process_refund) Fix: gate financial tools behind human approval. ⚑ [HIGH] no-human-oversight OWASP: LLM06 EU AI Act Art. 14 ⚑ [MED] pii-to-llm OWASP: LLM02 ISO 42001 A.7 MCP SERVERS • payments-mcp [HIGH] Trust: verified (90/100) ⚑ [HIGH] secrets-in-env OWASP: LLM02/07 EU AI Act Art. 15 ⚑ [HIGH] financial-action OWASP: LLM06 EU AI Act Art. 9 VECTOR-STORE / RAG • pgvector · LangChain (knowledge.py) ⚠ retrieved content reaches the model ⚠ ingests external content (RAG poisoning surface) API ENDPOINTS • GET /customers/{customer_id} ⚠ object-id in path (BOLA)
CI / CD

Gate new AI risk at PR time

Drop in the GitHub Action and every pull request gets a sticky comment showing what AI surface changed, not just the current repo state. Baseline existing surfaces, then fail the build only on newly introduced high-or-critical findings. No API keys: the action uses the built-in GITHUB_TOKEN.

Sticky PR diff comments (base vs head)

--baseline: gate only what's new, not pre-existing debt

--fail-on high: severity-gated, non-blocking on inventory

100% local: no source, findings, or metadata sent to APIsec

.github/workflows/ai-surface.yml

name: AI Surface Check on: [pull_request] permissions: contents: read pull-requests: write jobs: ai-surface: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: apisec-inc/AI-Surface@v1 with: comment-on-pr: 'true' fail-on: 'high'
New in 1.1.0

Runs inside your AI coding assistant

ai-surface ships as an MCP server for Claude Code, Cursor, Windsurf and Cline, and as an automatic check in Claude Code that runs after every edit. When an assistant adds a new tool, agent or model call, the finding shows up in the same conversation, before the change is committed.

scan_ai_surface: inventory the AI surface of a project

check_new_ai_surface: report what changed since the last check

One command writes the hook and the MCP entry for a repo

State is kept outside the repository, per user

terminal

pip install "apisec-ai-surface[mcp]" ai-surface init --claude-code
Governance

The inventory doubles as your AI-BOM and governance evidence

Audited findings map to the OWASP LLM Top 10 and to evidence-relevant clauses in the EU AI Act, NIST AI RMF, and ISO/IEC 42001. Mappings ship as JSON fields, CycloneDX properties, and UI badges. AI Surface produces evidence; it does not certify or attest compliance.

OWASP LLM Top 10↗EU AI Act↗NIST AI RMF↗ISO/IEC 42001↗
Where it fits

The PR-time AI gap your other tools do not cover

SAST (Semgrep, CodeQL)

Code-pattern vulnerabilities

After commit; no AI surface inventory

DAST (Burp, ZAP)

Reachable web vulnerabilities

After deploy; not LLM / agent internals

SCA (Snyk, Dependabot)

Vulnerable dependencies

After commit; packages, not AI usage

Observability (LangSmith, Arize)

What LLM calls happened

After deploy; needs runtime traffic

AI-SPM / AI governance

Cloud / runtime AI posture

Runtime-first; not a PR-time gate

ai-surface

What AI surface is about to ship, mapped to governance

At PR time, before merge, offline

APIsec platform

Which AI / API surfaces are actually exploitable

Runtime validation, replayable evidence

AI Surface maps the attack surface statically, before merge. When you need to prove which of those surfaces an attacker can actually exploit against a running app, that is runtime validation on the APIsec platform.

The local UI

An interactive map of every AI surface it finds

Run ai-surface scan . --ui to open the attack-surface map, served on loopback. Nodes are grouped by category with risk indicators, governance badges, and AI-BOM download. Nothing runs in the browser and nothing leaves your machine.

The ai-surface interactive attack-surface map: detected agents, MCP servers, RAG stores, LLM SDKs, and APIs grouped by category with risk rings.
Proven on real code

Tested against 50 popular open-source AI projects

Each repo was shallow-cloned, analyzed locally, and deleted. No application was run. These are category-presence signals, a floor not a ceiling.

50

popular AI repos scanned

~2.6M

combined GitHub stars

7,615

AI surfaces mapped

50%

expose MCP servers

96%

trip a governance rule

95%

confirmable only at runtime

Read the full report→

Make your AI attack surface visible before attackers find it

install

pipx install apisec-ai-surface ai-surface scan .