Attack Surface Mcp Server

io.github.cyanheads由 GitHub 帳號 cyanheads 發布v0.5.0更新於 Oct 30, 2026

Passive external attack-surface mapping: CT subdomains, DNS, TLS, HTTP posture, RDAP/WHOIS, Shodan.

概覽

AI 產生的概覽

被動式外部攻擊面測繪:從憑證透明度日誌找出子網域,並檢查 DNS、TLS、HTTP 安全設定、RDAP/WHOIS 及選用的 Shodan 資料。

可以做什麼
  • 端對端測繪網域的外部攻擊面,支援快速、標準、深入三種深度並提供防禦性評估
  • 從憑證透明度日誌找出子網域,並解析標示哪些主機仍在線
  • 透過多個公共解析器查詢 DNS 記錄,可選用反向 DNS
  • 檢查 TLS 設定:協定、加密套件、憑證鏈、SAN、到期時間與驗證狀態
  • 對單一 URL 發出一次 GET 探測,回傳狀態、重新導向、安全標頭與技術指紋
  • 透過 RDAP/WHOIS 查詢網域或 IP 註冊資訊,設定金鑰後可用 Shodan 主機與搜尋資料
適用情境
適合需要快速、非侵入式了解某網域公開暴露面(子網域、DNS、憑證、標頭、註冊資訊)的防禦性檢視或資產盤點。適用於自有或已獲明確授權的資產,而非滲透測試。
執行需求
透過 npx 以 stdio 在本機執行(需 Node.js),也可使用 Docker 映像或 HTTP 方式;原始碼建置需 Bun v1.4.0+ 或 Node.js v24+。核心工具不需 API 金鑰。SHODAN_API_KEY 可啟用主機查詢與搜尋;CERTSPOTTER_API_KEY 可提高 CT 備援的速率限制。需要連線至公共解析器、CT 日誌、RDAP/WHOIS 及目標主機的網路。
安裝前請注意
僅供自有或已獲明確授權的資產使用。它會對使用者指定的目標建立對外連線,因此目標名稱與 URL 會傳送給 CT 日誌、RDAP/WHOIS、Shodan 與公共 DNS 解析器等第三方服務。Shodan 搜尋模式可能消耗查詢額度。ATTACKSURFACE_ALLOW_PRIVATE_TARGETS 會關閉對私有網段的 SSRF 防護,公開部署時應保持 false。選用金鑰屬於敏感憑證。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Attack Surface Mcp Server,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

@cyanheads/attack-surface-mcp-server

Passive external attack-surface mapping: CT subdomains, DNS, TLS, HTTP posture, RDAP/WHOIS, Shodan via MCP. STDIO or Streamable HTTP.

8 Tools • 1 Resource


[!IMPORTANT] Authorized, defensive use only. Point this server only at assets you own or are explicitly authorized to assess. It performs passive, non-intrusive reconnaissance — it reads public records (Certificate Transparency logs, DNS, RDAP/WHOIS) and each target's own published surface (one TLS handshake and one HTTP GET per host). It does not port-scan, exploit, brute-force, fuzz, or probe for vulnerabilities; that capability is excluded from the surface by design, not gated behind a flag. Output is descriptive — what exists and what the security posture is — never an exploitation plan. Every outbound connection passes an SSRF guard that refuses private, loopback, link-local, and cloud-metadata targets.


Overview

Passive external attack-surface mapping (EASM) over Certificate Transparency logs, DNS, TLS, HTTP, and RDAP/WHOIS registries, with optional Shodan host intelligence. Discover subdomains, resolve DNS records, and inspect TLS and HTTP security posture across a domain's live hosts.

The attack-surface guide covers assessment coverage and evidence-preserving triage. It ships with plugin, npm, MCPB and Docker distributions and is served through the MCP Skills extension for supporting clients.

Tools

ToolDescription
attacksurface_map_domainFlagship workflow. Maps a domain's external surface end to end: CT-log subdomain discovery → DNS liveness → (standard+) DNS records, TLS posture, HTTP headers/tech → optional RDAP/WHOIS → (thorough + key) per-IP Shodan enrichment. Returns a structured surface map and a defensive assessment of observable facts.
attacksurface_enumerate_subdomainsPassive subdomain discovery from Certificate Transparency logs (crt.sh → Certspotter → TLS-SAN fallback chain), with DNS resolution to mark which names are live. Per-source provenance; no DNS brute-forcing.
attacksurface_resolve_dnsResolve and enumerate DNS records (A/AAAA/CNAME/MX/NS/TXT/CAA) for one or more hosts across multiple public resolvers, with optional reverse DNS (PTR). Per-resolver values surface propagation gaps.
attacksurface_inspect_tlsInspect TLS/SSL posture via a real read-only handshake: protocol, cipher, leaf certificate and chain depth, SANs, validity window, days-to-expiry, issuer, validation status. Reports invalid/expired/self-signed certs instead of failing.
attacksurface_probe_httpPassive HTTP(S) probe: one GET following redirects. Returns status, redirect chain, headers, a security-header audit (HSTS/CSP/X-Frame-Options/cookie flags/CORS reflection), and an evidence-bound technology fingerprint.
attacksurface_lookup_registrationRegistration and ownership lookup via RDAP (JSON; WHOIS fallback). A domain returns registrar, status, lifecycle events, nameservers, DNSSEC; an IP/CIDR returns netblock, allocation CIDRs, origin ASN, country.
attacksurface_lookup_hostInfrastructure intelligence for a single IP (open ports, banners, software versions, ASN, geo) or a faceted internet-wide search, via Shodan. Requires SHODAN_API_KEY — returns a typed source_unavailable error when unset; the rest of the server is unaffected.
attacksurface_recon_guidanceOffline defensive review with topic selection, bounded priority/suggestion pages, local follow-up calls and product/version advisory-check guidance. No external calls.

Resources

ResourceDescription
attacksurface://surface/{domain}Read-once snapshot of a domain's mapped external surface (subdomains, live hosts, per-host DNS/TLS/HTTP posture summary), with separate candidate and 50-host detail coverage.

All resource data is also reachable via tools — tool-only clients lose nothing, since attacksurface_map_domain covers the same ground.

Capability reference

attacksurface_map_domain tool

  • depth: quick discovers subdomains and liveness; standard adds DNS records, TLS, and HTTP posture; thorough adds per-IP Shodan data when a key is present, otherwise a note.
  • Returns a structured surface map and a defensive assessment of observable facts. Failed sources and unreachable hosts become notes, and subdomain resolution is capped by ATTACKSURFACE_MAX_SUBDOMAINS (default 200), with truncation disclosed.
  • includeRegistration adds RDAP/WHOIS data for the apex at standard or thorough depth. Standard and thorough also return DNS records from the first configured resolver plus propagation mismatches for live hosts; null posture at quick depth means the work was skipped.
  • coverage lists what was left unexamined or without host detail (unexamined, detailOmitted), and retrieval gives up to three ready-to-run follow-up calls (DNS/TLS batches of at most 50 hosts, one HTTP URL). nextToolSuggestions prefills an attacksurface_recon_guidance call for up to 50 hosts, with guidanceCoverage naming any omitted.

attacksurface_enumerate_subdomains tool

  • Discovers names through crt.sh → Certspotter → the apex TLS certificate SANs, then resolves DNS liveness. includeUnresolved: false keeps only live hosts; filteredAddressErrors retains DNS failures for excluded names.
  • Returns each name's source provenance and per-source status. complete, pagesFetched, and incompleteReason disclose partial coverage, and addressError separates DNS failures from ENODATA/ENOTFOUND absence.
  • offset and limit (default 50, larger requests clamped) page through candidates, bounded by min(50, ATTACKSURFACE_MAX_SUBDOMAINS). Use nextOffset or the prefilled continuation for the next page, and remainingCount to see what is left. CT logs are re-read per page, so changes can shift offsets.

attacksurface_resolve_dns tool

  • Accepts 1–1000 hosts and processes the first 50 in input order; processedCount and remainingHosts show what to resubmit. Queries A, AAAA, CNAME, MX, NS, TXT, and CAA across public resolvers (default 8.8.8.8, 1.1.1.1, 9.9.9.9); reverse DNS (PTR) is optional.
  • Returns per-resolver answers to expose propagation gaps, with canonical records from the first configured resolver. Resolver failures (including SERVFAIL) appear in queryError and hostError next to any successful records.
  • Private or loopback resolver IPs produce blocked_resolver; an individual host failure becomes a per-host error.

attacksurface_inspect_tls tool

  • Accepts 1–1000 hosts and processes the first 50 in input order; processedCount and remainingHosts show what to resubmit. Port defaults to 443 and handshake timeout to 8000ms (1000–30000ms).
  • Returns negotiated protocol, cipher, leaf certificate and chain depth, SANs, issuer, validity window, days to expiry, and validation status. Invalid, expired, and self-signed certificates are reported; one host failure becomes a per-host error.
  • Chain trust (validationAuthorized/validationError) and hostname match (identityAuthorized/identityError) are separate checks. daysUntilExpiry is null only when the expiry date cannot be parsed.

attacksurface_probe_http tool

  • Accepts one HTTP(S) URL; timeout defaults to 10000ms (1000–30000ms) and covers the whole probe. Follows up to ten redirects with an SSRF check at every hop; a refused target produces blocked_target, and exceeding the redirect limit returns finalStatus: 0 and a transportError.
  • Returns status, redirect chain, raw headers, security-header findings (HSTS, CSP, X-Frame-Options, X-Content-Type-Options, Referrer-Policy, Permissions-Policy, cookie flags, CORS reflection), and technology detections with their triggering evidence. CSP analysis covers frame-ancestors only.
  • bodyInspection reports complete, limited (64,000-byte prefix cap), failed, or not_read; a body failure keeps the status and headers.

attacksurface_lookup_registration tool

  • Accepts a domain, IP, or CIDR (prefix IPv4 0–32, IPv6 0–128); type (auto / domain / ip) controls interpretation. Uses RDAP first, then WHOIS when needed.
  • Domain results include registrar, EPP statuses, lifecycle events, nameservers, and DNSSEC; IP/CIDR results include netblock, allocation CIDRs, ASN, and country. Sparse or redacted fields stay unknown, and the raw WHOIS response is kept in rawWhois.
  • An explicit WHOIS no-match returns no_match; a failed referral or an empty or unrecognized WHOIS response returns source_unavailable.

attacksurface_lookup_host tool

  • mode: "host" (default) looks up one bare IPv4/IPv6 address and returns invalid_target for anything else; mode: "search" takes an internet-wide query with optional facets and may consume Shodan query credits. Requires SHODAN_API_KEY.
  • Search returns one 100-match page per call (page defaults to 1, ignored in host mode), with hasMore, nextPage, and a prefilled continuation. Later pages are opt-in and may consume credits.
  • Returns ports, banners, software versions, hostnames, ASN, and geography from Shodan's last scan. Missing credentials produce source_unavailable; no host data produces no_data. The server performs no port scans.

attacksurface_recon_guidance tool

  • Takes prior findings (hosts, certificates, missing headers, software versions, ports). Topic triage covers all findings ordered by urgency, posture covers TLS/header hardening, and coverage covers inspection and version gaps. Open ports are inventory evidence, never proof of a vulnerability.
  • Returns priorities plus suggestions as {toolName, reason, args} that target local tools only; no external calls or active scans are emitted.
  • priorityOffset and suggestionOffset page independently with limit (default 50, max 50). Resubmit the original findings and topic with the next offsets.

attacksurface://surface/{domain} resource

  • Takes a domain and returns an application/json posture snapshot; use attacksurface_map_domain for registration and a guidance handoff.
  • Includes subdomain and live-host counts plus per-host DNS/TLS/HTTP posture and errors. Resolution uses the same cap as mapping, and posture detail covers at most 50 live hosts; coverage lists what was omitted with follow-up calls.

Features

Built on @cyanheads/mcp-ts-core: stdio and Streamable HTTP transports, pluggable auth (none / jwt / oauth), swappable storage (in-memory, filesystem, Supabase, Cloudflare KV/R2/D1), structured logging with optional OpenTelemetry tracing.

Attack-surface-specific:

  • Passive and non-intrusive by mandate — public records plus each target's own single published response; active scanning, exploitation, and brute-forcing are excluded from the surface, not toggled by a flag
  • Keyless core — CT subdomain enumeration, DNS, TLS, HTTP/tech, and RDAP/WHOIS all work with zero API keys; Shodan is strictly additive depth
  • SSRF guard on every outbound connection — rejects private, loopback, link-local, cloud-metadata, and reserved IPv4/IPv6 ranges before connecting (opt out for trusted internal assessment via ATTACKSURFACE_ALLOW_PRIVATE_TARGETS)
  • Multi-source aggregation with fallback chains — CT discovery falls through crt.sh → Certspotter → TLS-SAN; registration falls through RDAP → WHOIS

Agent-friendly output:

  • Provenance on every result — source labels (source: crt.sh | certspotter | tls-san, source: rdap | whois) and per-source status so agents can assess completeness and trust
  • Graceful partial failure — multi-target and multi-source tools return per-item/per-source error fields and operational notes instead of failing the whole call; only malformed input throws
  • Discriminated, typed contracts — typed error reasons (source_unavailable, blocked_target, all_sources_failed) and union output (kind: domain | ip) let callers branch on data, not string parsing
  • No fabricated signal — technology detections carry their triggering evidence; absent CT/DNS/RDAP fields are reported as unknown, never inferred

Getting started

Add it to Claude Code:

sh
claude mcp add attack-surface-mcp-server -- npx -y @cyanheads/attack-surface-mcp-server

For other clients, add this to the MCP config file:

json
{  "mcpServers": {    "attack-surface-mcp-server": {      "command": "npx",      "args": ["-y", "@cyanheads/attack-surface-mcp-server"]    }  }}

Every tool except attacksurface_lookup_host works without an API key. To enable Shodan host intelligence, set SHODAN_API_KEY; an optional CERTSPOTTER_API_KEY raises CT-fallback rate limits. For Docker or a source build, see Running the server.

Configuration

All variables are optional — the server boots and delivers its keyless core with an empty environment.

VariableDescriptionDefault
SHODAN_API_KEYEnables attacksurface_lookup_host. Absent → that tool returns source_unavailable; every other tool keeps working.—
CERTSPOTTER_API_KEYRaises Certspotter rate limits for the CT-log subdomain fallback. Absent → free unauthenticated tier (rate-limited but functional).—
ATTACKSURFACE_DEFAULT_RESOLVERSComma-separated public DNS resolver IPs for attacksurface_resolve_dns and standard+ map/snapshot posture.8.8.8.8,1.1.1.1,9.9.9.9
ATTACKSURFACE_HTTP_USER_AGENTDefault User-Agent for attacksurface_probe_http (overridable per call).attack-surface-mcp-server/passive-recon (+https://github.com/cyanheads/attack-surface-mcp-server)
ATTACKSURFACE_MAX_SUBDOMAINSMap/snapshot resolution cap; enumeration also caps each page at 50 candidates.200
ATTACKSURFACE_RDAP_BOOTSTRAP_URLRDAP bootstrap base URL; override for a private/mirrored RDAP.https://rdap.org
ATTACKSURFACE_ALLOW_PRIVATE_TARGETSSet true to permit non-public target ranges for trusted internal assessment. Leave false on any public deployment.false
MCP_TRANSPORT_TYPETransport: stdio or http.stdio
MCP_HTTP_PORTPort for HTTP server.3010
MCP_SESSION_MODEHTTP session mode: stateless, stateful, or auto. The server declares stateless; a value set here overrides it. Ignored under stdio.stateless
MCP_AUTH_MODEAuth mode: none, jwt, or oauth.none
MCP_LOG_LEVELLog level (RFC 5424).info
OTEL_ENABLEDEnable OpenTelemetry instrumentation.false

See .env.example for the full list of optional overrides.

Running the server

Requires Bun v1.4.0 or higher (or Node.js v24+).

Clone and install:

sh
git clone https://github.com/cyanheads/attack-surface-mcp-server.gitcd attack-surface-mcp-server && bun installcp .env.example .env

All configuration is optional; edit .env for Shodan, a Certspotter key, or non-default behavior.

Local development

  • Build and run:

    sh
    # One-time buildbun run rebuild
    # Run the built serverbun run start:stdio# orbun run start:http
  • Run checks and tests:

    sh
    bun run devcheck   # Lint, format, typecheck, securitybun run test       # Vitest test suitebun run lint:mcp   # Validate MCP definitions against spec

Docker

sh
docker run --rm -p 3010:3010 ghcr.io/cyanheads/attack-surface-mcp-server:latest

The image defaults to HTTP transport, stateless session mode, and logs to /var/log/attack-surface-mcp-server. To run it over stdio from an MCP client, use "command": "docker" with "args": ["run", "-i", "--rm", "-e", "MCP_TRANSPORT_TYPE=stdio", "ghcr.io/cyanheads/attack-surface-mcp-server:latest"]. To build locally, docker build -t attack-surface-mcp-server .; OpenTelemetry peer dependencies are installed by default — build with --build-arg OTEL_ENABLED=false to omit them.

Project structure

DirectoryPurpose
src/index.tscreateApp() entry point — registers tools/resources and inits the six services.
src/configServer-specific environment variable parsing and validation with Zod.
src/mcp-server/toolsTool definitions (*.tool.ts).
src/mcp-server/resourcesResource definitions (*.resource.ts).
src/servicesDomain service integrations (ct, dns, tls, http, registration, shodan).
src/utilsSSRF guard and input validation.
tests/Unit and integration tests mirroring src/.

Development guide

See CLAUDE.md/AGENTS.md for development guidelines and architectural rules. The short version:

  • Handlers throw, framework catches — no try/catch in tool logic
  • Use ctx.log for request-scoped logging, ctx.state for tenant-scoped storage
  • Register new tools and resources via the barrels in src/mcp-server/*/definitions/index.ts
  • Every outbound connection to a user-supplied target must pass the SSRF guard (assertSafeDomain / assertSafeUrl / assertSafeResolverIp) before connecting
  • Wrap external API calls: validate raw → normalize to domain type → return output schema; never fabricate missing fields

Contributing

Issues are welcome. Run checks and tests before submitting:

sh
bun run devcheckbun run test

License

Apache-2.0 — see LICENSE for details.

來源:README.md,提交 3744e4e

工具

8

attacksurface_map_domain

Flagship workflow: map a domain's external attack surface end to end. Discovers subdomains from Certificate Transparency logs, resolves each to find live hosts, and (at standard+ depth) characterizes each live host's DNS records, TLS posture, and HTTP security headers and technology stack, plus optional RDAP/WHOIS registration. At thorough depth with a Shodan key it adds per-IP Shodan enrichment. Returns a structured surface map and a defensive assessment of observable facts (expiring certs, missing security headers, weak TLS) — never an exploitation plan. All work is passive (public records and the target's own published responses) and SSRF-guarded. Assess only assets you own or are explicitly authorized to test.

輸入參數depthdomain必填includeRegistration

attacksurface_enumerate_subdomains

Discover subdomains passively from Certificate Transparency logs, then resolve each candidate via DNS to mark which are live. crt.sh is the primary source, Certspotter the fallback (crt.sh is frequently overloaded), and the apex domain's own TLS certificate SAN list a third always-available source. Every discovered name carries its source provenance. No DNS brute-forcing — this reads public logs, it does not probe the target's resolvers. Use only on domains you own or are authorized to assess.

輸入參數limitdomain必填offsetsourcesincludeUnresolved

attacksurface_resolve_dns

Resolve and enumerate DNS records (A, AAAA, CNAME, MX, NS, TXT, CAA) for one or more hosts across multiple public resolvers, with optional reverse DNS (PTR) for resolved IPs. Reports per-resolver values so propagation gaps and split-horizon DNS are visible. Each host is checked against an SSRF guard; one failing host degrades to a per-host error rather than failing the whole call.

輸入參數hosts必填reverseresolversrecordTypes

attacksurface_inspect_tls

Inspect TLS/SSL posture for one or more hosts via a real read-only handshake: negotiated protocol and cipher, leaf certificate and chain depth, SANs, validity window, days-to-expiry, issuer, chain trust, and requested-host identity. Identity is checked independently of chain trust; mismatches and unverifiable identity add findings. Invalid, expired, and self-signed certificates are inspected and reported. Unparseable validity bounds retain their raw values and add findings; an unknown expiry returns null days-to-expiry. One handshake per host; no application data is sent. SSRF-guarded; per-host failures degrade to a per-host error.

輸入參數porthosts必填timeoutMs

attacksurface_probe_http

Passively probe a single URL with one HTTP(S) GET, following redirects. Returns the final status, the full redirect chain, response headers, a security-header audit (HSTS, CSP, X-Frame-Options, cookie Secure/HttpOnly/SameSite flags, and CORS origin-reflection), and an evidence-bound technology fingerprint (server, framework, CDN, WAF, CMS) drawn from headers and lightweight body markers. Strictly one request per host — no path traversal, parameter injection, or multi-method probing. Each redirect hop is validated against an SSRF guard. Use only on assets you own or are authorized to assess.

輸入參數url必填timeoutMsuserAgent

attacksurface_lookup_registration

Look up registration and ownership via RDAP (structured JSON), with a WHOIS fallback for TLDs without RDAP or when RDAP is unresponsive. For a domain it returns registrar, status codes, creation/expiry/updated events, nameservers, and DNSSEC; for an IP or CIDR it returns the netblock name, allocation CIDRs, origin ASN, and country. Registry data is frequently redacted or sparse — absent fields are reported as unknown, never inferred. Use only on assets you own or are authorized to assess.

輸入參數typetarget必填

attacksurface_lookup_host

Get infrastructure intelligence for a single IP (open ports, service banners, software versions, hostnames, ASN, geo) via Shodan, or run a faceted internet-wide search (mode: "search") that may consume Shodan query credits. Requires SHODAN_API_KEY; without it this tool returns a typed source_unavailable error while the rest of the server keeps working. Shodan data reflects Shodan's last scan, not a live port state. Use only on assets you own or are authorized to assess.

輸入參數modepagefacetstarget必填

attacksurface_recon_guidance

Synthesize supplied findings into an offline defensive review plan and executable local follow-up calls. triage orders all findings by urgency; posture selects TLS/header hardening; coverage selects inspection/version gaps and observed-service review. Versioned products retain host/product/version advisory-check instructions without external executable calls. Stateless pages target 24,000 serialized bytes across both response surfaces, except one complete oversized record. Makes no external calls or active scans. For assets you own or are authorized to assess.

輸入參數limittopicfindings必填priorityOffsetsuggestionOffset

版本歷史

7
  1. v0.5.0最新Oct 30, 2026
  2. v0.4.0Oct 16, 2026
  3. v0.3.2Oct 14, 2026
  4. v0.3.1Oct 13, 2026
  5. v0.2.3Sep 30, 2026
  6. v0.2.2Sep 22, 2026
  7. v0.2.1Sep 16, 2026

評分

已滿足適用檢查項的 90%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分
  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分