mcp-shodan is an MCP (Model Context Protocol) server that provides AI agents with access to the Shodan API and Shodan CVEDB. It is not an official Shodan project, and users need to provide their own Shodan API key.
Purpose
This tool is aimed at security analysis and network reconnaissance scenarios, enabling AI agents to view information about internet-connected devices like an analyst. Users only need to provide the agent with an IP, hostname, search query, product, or CVE to obtain data such as open ports and banners, TLS certificates, DNS records, and vulnerability severity (including EPSS and KEV status).
Main capabilities
- Host reconnaissance: For any IPv4 or IPv6 address, returns open ports, products and versions, known CVEs, TLS certificate details (fingerprint, JARM, JA3S), cloud provider, and banner history.
- Device search: Supports Shodan query syntax, provides pagination and facet statistics (country, organization, port, vulnerability, etc.), and has a free count-only mode for assessing query scale.
- Vulnerability intelligence: Provides CVE details, including CVSS v4/v3/v2, EPSS, and KEV; can query CVEs by product or CPE, and sort by EPSS. CVEDB is free and does not consume query credits.
- DNS queries: Query subdomains and DNS records for a domain, and support forward and reverse queries for multiple names or IPs in a single call.
- Credit awareness: Free tools are marked as free, and api_info can show the remaining credits for the current plan.
- Two transport methods: stdio for desktop clients, HTTP streaming for shared services.
- Test coverage: Unit tests using a mock Shodan API, run in CI against Node 20, 22, and 24.
Usage
Environment requirements: Node.js 20 or higher, and a Shodan API key.
For Claude Desktop, VS Code, Smithery, and running from source, see the "Connect a client" documentation.
Uses stdio transport by default. Setting MCP_TRANSPORT=httpStream runs a standalone HTTP service, with health check at /health.
After installation and configuration, you can ask the agent questions such as: "What is exposed on 8.8.8.8, and is CVE-2021-44228 in the KEV catalog?" For more prompt examples, see example workflows.
The server provides 11 read-only tools; see the tool reference documentation for full parameters.
Credit notes
- shodan_search queries with filters consume 1 query credit (each additional page consumes 1 more), and domain_info consumes 1 per call.
- shodan_count, ip_lookup, dns_lookup, reverse_dns_lookup, search_filters, api_info, and the CVEDB tools are all free.
Security and limitations
- The HTTP transport has no authentication. Keep the port on localhost or behind an authenticated reverse proxy, otherwise anyone who can access the port may consume your query credits.
- Tool parameters are validated via zod schema before building requests: IPs must be valid IPv4 or IPv6, domains must be valid hostnames, facets must be a name[:count] list, and CVE IDs must match CVE-YYYY-NNNN.
- The API key is read from an environment variable and is sent only to api.shodan.io. CVEDB calls do not carry the key.
- What you query is sent to Shodan.
- Report vulnerabilities privately; see SECURITY.md.
Troubleshooting
- 401 / invalid key: Check whether there are spaces or quotes around the key, then restart the client. You can use curl "https://api.shodan.io/api-info?key=$SHODAN_API_KEY" to view the plan and credits.
- shodan_search returns 403: Search filters require a membership or paid API plan. Run api_info to view the plan and credits.
- 429: Shodan allows about one request per second; retry later.
For more, see the troubleshooting guide.
License
MIT license, see LICENSE for details.