OWASP Pentest Guide Knowledge Base
Read-only MCP server for precise lookup, search, and versioned retrieval of OWASP testing guides (WSTG, MASTG, ISTG, AITG) with full provenance on every result.
README
pentest-guide-kb
A read-only, versioned knowledge base for OWASP testing guides, served over the Model Context Protocol (MCP) so AI agents and IDEs can query them precisely instead of relying on training-data memory.
This project is not an official OWASP project and is not endorsed by OWASP. It compiles and re-serves content from independent OWASP testing guides under their own licenses -- see Licensing.
1. Purpose
- Precise lookup of a specific OWASP test by id (versioned or canonical).
- Natural-language search across test procedures (full-text + semantic).
- Browsing a guide by version, category, platform, or feature keyword.
- Cross-guide relationship traversal, with provenance on every edge.
- Version comparison for a test across two compiled guide releases.
- Candidate-test generation for a target system profile -- explicitly labeled as unverified candidates, never a completed test plan.
- Full provenance (repository, commit, path, content hash, license) on every result, so a citation can always be traced back to the exact upstream source it came from.
2. Non-goals
This repository does not contain, and will not accept, any of:
- Execution of Nmap, sqlmap, Nuclei, Frida, ADB, or any other scanning/ exploitation tool.
- An arbitrary shell-execution MCP tool.
- Automated vulnerability exploitation, or network access to a caller- specified target.
- An autonomous pentest agent.
- MCP tools that sync sources, run ingestion, or otherwise mutate data -- those are offline CLI-only operations (see Security).
This is a knowledge retrieval service, not an offensive security execution platform.
3. Architecture
Official OWASP Git Repositories (wstg, mastg, owasp-istg, www-project-ai-testing-guide)
|
v
Source Mirror and Version Lock sources/sources.lock.yaml, sources/.cache/
|
v
Deterministic Guide Compilers src/pentest_guide_kb/ingestion/*
|
v
Canonical Registry (PostgreSQL) src/pentest_guide_kb/storage/*
|
+-- metadata + JSONB (test_cases, test_case_sections, ...)
+-- full-text search (tsvector + GIN)
+-- pgvector semantic search (embeddings)
+-- Generated Markdown Wiki src/pentest_guide_kb/wiki/*
+-- Optional Neo4j projection src/pentest_guide_kb/graph/* (--profile graph)
|
v
Read-only MCP Server src/pentest_guide_kb/mcp/*
|
v
AI Agents and IDE Clients
The PostgreSQL registry is the single source of truth. The Wiki, the
vector index, and the Neo4j graph are derived views compiled from it --
none of them independently store content that could drift out of sync.
See docs/architecture.md for the full write-up, and docs/data-model.md
for the schema.
4. Supported guides
| Guide | Short name | Upstream repository | Pinned in this repo |
|---|---|---|---|
| OWASP Web Security Testing Guide | WSTG | OWASP/wstg |
tag v4.2 |
| OWASP Mobile App Security Testing Guide | MASTG | OWASP/mastg |
tag v2.0.0 |
| OWASP IoT Security Testing Guide | ISTG | OWASP/owasp-istg |
tag v1.0.1 |
| OWASP AI Testing Guide | AITG | OWASP/www-project-ai-testing-guide |
commit on main (no tagged release yet -- status: draft) |
Exact pins live in sources/sources.lock.yaml; see Versioning.
5. Installation
Requires Python 3.12+, uv, and Docker.
uv sync --all-extras
6. Running with Docker Compose
docker compose up -d postgres # PostgreSQL + pgvector
uv run alembic upgrade head # apply the schema
docker compose --profile graph up -d neo4j # optional -- Neo4j graph projection
docker compose up mcp # MCP server over streamable-http, :8000
docker compose up wiki # builds + serves the wiki, :8001
mcp/wiki build from the repo root Dockerfile; postgres/neo4j build
from docker/postgres/ and docker/neo4j/ (both are thin FROM pins of
pgvector/pgvector:pg16 and neo4j:5-community -- no :latest). No
password or API key is baked into any image; all come from .env /
docker-compose.yml environment variables (copy .env.example to .env
first, or rely on the compose file's local-dev defaults).
Health checks gate startup: mcp/wiki wait for postgres's
pg_isready check before starting.
7. Source pinning
sources/sources.lock.yaml pins each guide's repository, tag/branch, and
exact commit -- never latest. Nothing under src/pentest_guide_kb/mcp/
touches the network; source sync is an explicit, offline CLI step:
uv run pentest-guide source list # show current pins
uv run pentest-guide source sync --guide wstg --tag v4.2 # fetch, don't pin yet
uv run pentest-guide validate # check what was fetched
uv run pentest-guide source sync --guide wstg --tag v4.2 --pin # now pin it
uv run pentest-guide source verify # confirm local checkout == lock file
uv run pentest-guide source diff --guide wstg # has upstream moved since the pin?
See sources/README.md for the full workflow, including why AITG's entry
looks different (pinned to a main-branch commit, status: draft, since
it has no tagged release).
8. Ingestion
uv run pentest-guide ingest --guide wstg
uv run pentest-guide ingest --all
uv run pentest-guide validate
Each guide has its own GuideParser (src/pentest_guide_kb/ingestion/ {wstg,mastg,istg,aitg}.py) built on a shared Markdown-AST heading-tree
parser (ingestion/markdown_parser.py), not fragile regex scanning -- see
docs/ingestion.md for how each guide's real document structure differs
(WSTG's ID table, MASTG's YAML frontmatter, ISTG's multi-test-per-file
bold-label sections, AITG's ID - Title heading, including a real en-dash
variant that had to be handled explicitly). Ingestion is deterministic:
compiling the same pinned commit twice produces byte-identical content
hashes (verified in tests/unit/test_wstg_parser.py:: test_wstg_compile_is_deterministic). Unrecognized sections are preserved
in sections.extra_sections with a ValidationIssue, never silently
dropped.
9. Search
uv run pentest-guide query exact WSTG-v42-ATHN-01
uv run pentest-guide query search "credentials transported over http" --mode hybrid
uv run pentest-guide query related WSTG-v42-ATHN-01 --include-inferred
Pipeline: query classification -> exact id/alias resolution (always tried
first) -> full-text (PostgreSQL tsvector) and/or semantic (pgvector) ->
Reciprocal Rank Fusion -> lexical reranking -> provenance packaging. See
docs/retrieval.md.
10. MCP client configuration
{
"mcpServers": {
"pentest-guide-kb": {
"command": "uv",
"args": ["run", "pentest-guide", "mcp", "serve"],
"cwd": "/path/to/pentest-guide-kb",
"env": { "DATABASE_URL": "postgresql+psycopg://pentest_guide:pentest_guide@localhost:5432/pentest_guide_kb" }
}
}
}
Or point at the Dockerized streamable-http endpoint from docker compose up mcp (http://localhost:8000/mcp) if your client supports HTTP MCP
transports.
11. MCP tool example
{
"tool": "guide_search",
"input": {
"query": "OAuth redirect URI testing in Android WebView",
"guides": ["WSTG", "MASTG"],
"platforms": ["android"],
"search_mode": "hybrid",
"limit": 10
}
}
Every result carries guide: {name, version} and source: {repository, commit, path, content_hash, license} -- there is no "bare summary" return
path anywhere in this codebase. See docs/mcp-api.md for all eleven tools,
ten resource URI templates, and five prompts, and
skills/owasp-guide-research/references/mcp-tools.md for when to use each.
12. Generating the Wiki
uv run pentest-guide wiki build # writes wiki/docs/{guides,platforms,features,relationships,versions}/
uv run pentest-guide wiki validate # Error Book: dangling links, missing provenance, collisions, ...
uv run pentest-guide wiki validate --format sarif
uv run pentest-guide wiki serve # mkdocs serve (requires `uv sync --extra wiki`)
13. Neo4j (optional profile)
Neo4j is never required. With NEO4J_ENABLED=false (the default), every
CLI command, MCP tool, and test still works -- graph-only operations raise
a clear GraphNotConfiguredError instead of failing silently.
docker compose --profile graph up -d neo4j
# .env: NEO4J_ENABLED=true, NEO4J_URI=bolt://localhost:7687, ...
uv run pentest-guide graph project
uv run pentest-guide graph validate
uv run pentest-guide graph clear
14. Testing and CI
uv run pytest # unit + integration + contract + evals (149 tests)
uv run pytest tests/unit tests/contract # no database required
uv run pytest tests/integration -m integration # requires PostgreSQL
uv run ruff check . && uv run ruff format --check . && uv run mypy src
Integration/contract/eval tests auto-skip when PostgreSQL (or, for the
graph tests, Neo4j) isn't reachable -- see tests/conftest.py. CI
(.github/workflows/ci.yml) starts a real pgvector/pgvector:pg16 service
container and runs everything, including a wiki build+validate pass,
against it; nothing in CI depends on a paid API (the default mock
embedding provider is a deterministic hash, not a real model).
source-validation.yml is a separate, non-blocking workflow that checks
upstream drift on the pinned commits.
15. Versioning
- Every exported test id is versioned by default (
WSTG-v42-ATHN-01); canonical ids (WSTG-ATHN-01) track the same logical test across versions. - Relationships key on canonical ids, not versioned ones -- this
matters concretely for AITG, whose "version" is a commit-derived string
(
unreleased-<sha>) that changes on every re-pin (seedocs/data-model.md). latestis never a valid value anywhere a version is expected -- rejected by a Pydantic validator onGuideVersion.version.sources.lock.yamlis the only place a source's tag/commit is pinned, and onlysource sync --pin(run aftervalidate) may change it.
16. Licensing
- This project's own code: Apache-2.0 (
LICENSE). - Each upstream guide's content: CC BY-SA 4.0, per
sources/licenses/. Every compiledTestCase.source.licensefield carries this through. - See
NOTICEanddocs/licensing.mdfor the full attribution chain. This repository does not bulk-copy OWASP guide text -- source sync + local compilation + provenance reference is the model; committed test fixtures undertests/fixtures/are short, attributed excerpts (see each fixture directory'sATTRIBUTION.md), not full guide dumps.
17. Roadmap
See IMPLEMENTATION_STATUS.md for exactly what's implemented vs. known
limitations today. Near-term candidates: a real Feature/Technique/
Tool domain entity (currently guide_find_by_feature is keyword-
heuristic, and the Neo4j ontology's Technique/Tool/Weakness/
Component/VerificationControl node types are unpopulated for the same
reason); a real embedding provider wired into CI-optional eval runs to
exercise true semantic (non-lexical) recall; multi-value platform/category
filters for semantic search (currently full-text only); a single
cross-guide SQL query for multi-guide search instead of one query per
guide merged by score.
18. Security
- The MCP server is read-only: no shell execution, no arbitrary URL fetch,
no network scanning, no source sync, no ingestion, no database mutation
-- see
SECURITY.mdfor the full threat model. - Every tool input is a bounded Pydantic model (
max_query_length,max_result_limit,max_graph_traversal_depth). SourceReference.pathrejects path traversal at ingestion time.include_inferreddefaults toFalseeverywhere anllm_inferredrelationship could appear.- Report vulnerabilities per
SECURITY.md(GitHub private vulnerability reporting), not a public issue.
19. Not an official OWASP project
This project is not an official OWASP project and is not endorsed by OWASP. It is an independent, unofficial tool that compiles publicly available OWASP guide content (under each guide's own CC BY-SA 4.0 license) into a queryable knowledge base. No content generated by this project's retrieval, ranking, or candidate-recommendation logic should be presented as official OWASP guidance -- always cite the guide name, version, and source commit that a result actually traces back to.
Key file paths
| What | Where |
|---|---|
| Domain models | src/pentest_guide_kb/domain/models.py |
| Guide parsers | src/pentest_guide_kb/ingestion/{wstg,mastg,istg,aitg}.py |
| Storage / repositories | src/pentest_guide_kb/storage/ |
| Retrieval pipeline | src/pentest_guide_kb/retrieval/ |
| MCP server | src/pentest_guide_kb/mcp/{server,resources,tools,prompts}.py |
| CLI | src/pentest_guide_kb/cli.py |
| Wiki generator + Error Book | src/pentest_guide_kb/wiki/ |
| Neo4j projection (optional) | src/pentest_guide_kb/graph/ |
| Source lock | sources/sources.lock.yaml |
| Curated relationships | registry/relationships/cross-guide.yaml |
| Agent Skill | skills/owasp-guide-research/SKILL.md |
| Docs | docs/*.md |
| Tests | tests/{unit,integration,contract,evals}/ |
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。