• Security
  • Search
  • Databases
JavaScript
MIT
496
1
  • Apple
A
security – no known vulnerabilities (report Issue)
A
license - permissive license (MIT)
A
quality - confirmed to work

MCP server for querying the Shodan API and Shodan CVEDB. This server provides tools for IP lookups, device searches, DNS lookups, vulnerability queries, CPE lookups, and more.

  1. Tools
  2. Prompts
  3. Resources
  4. Server Configuration
  5. README.md

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

Tools

Functions exposed to the LLM to take actions

NameDescription
ip_lookupRetrieve information about an IP address.
searchSearch for devices on Shodan.
cve_lookupRetrieve vulnerability information for a CVE. Use format: CVE-YYYY-NNNNN (e.g., CVE-2021-44228)
dns_lookupPerform DNS lookups using Shodan.
cpe_lookupSearch for Common Platform Enumeration (CPE) entries by product name.
cves_by_productSearch for CVEs affecting a specific product or CPE. Provide either product name or CPE 2.3 identifier.

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
SHODAN_API_KEYYesYour Shodan API key
README.md

Shodan MCP Server

A Model Context Protocol (MCP) server for querying the Shodan API and Shodan CVEDB. This server provides tools for IP lookups, device searches, DNS lookups, vulnerability queries, CPE lookups, and more. It is designed to integrate seamlessly with MCP-compatible applications like Claude Desktop.

Quick Start (Recommended)

  1. Install the server globally via npm:
npm install -g @burtthecoder/mcp-shodan
  1. Add to your Claude Desktop configuration file:
{ "mcpServers": { "shodan": { "command": "mcp-shodan", "env": { "SHODAN_API_KEY": "your-shodan-api-key" } } } }

Configuration file location:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  1. Restart Claude Desktop

Alternative Setup (From Source)

If you prefer to run from source or need to modify the code:

  1. Clone and build:
git clone https://github.com/BurtTheCoder/mcp-shodan.git cd mcp-shodan npm install npm run build
  1. Add to your Claude Desktop configuration:
{ "mcpServers": { "shodan": { "command": "node", "args": ["/absolute/path/to/mcp-shodan/build/index.js"], "env": { "SHODAN_API_KEY": "your-shodan-api-key" } } } }

Features

  • IP Lookup: Retrieve detailed information about an IP address
  • Search: Search for devices on Shodan matching specific queries
  • Ports: Get a list of ports that Shodan is scanning
  • CVE Lookup: Fetch detailed information about specific CVEs using Shodan's CVEDB
  • CPE Lookup: Search for Common Platform Enumeration (CPE) entries by product name
  • CVEs by Product: Search for all CVEs affecting a specific product or CPE
  • DNS Lookup: Resolve hostnames to IP addresses

Tools

1. IP Lookup Tool

  • Name: ip_lookup
  • Description: Retrieve detailed information about an IP address
  • Parameters:
    • ip (required): IP address to lookup

2. Search Tool

  • Name: search
  • Description: Search for devices on Shodan
  • Parameters:
    • query (required): Shodan search query
    • max_results (optional, default: 10): Number of results to return

3. CVE Lookup Tool

  • Name: cve_lookup
  • Description: Fetch detailed information about CVEs using Shodan's CVEDB
  • Parameters:
    • cve (required): CVE identifier in format CVE-YYYY-NNNNN (e.g., CVE-2021-44228)
  • Returns:
    • CVE details including:
      • CVSS v2 and v3 scores
      • EPSS score and ranking
      • KEV status
      • Proposed action
      • Ransomware campaign information
      • Affected products (CPEs)
      • References

4. CPE Lookup Tool

  • Name: cpe_lookup
  • Description: Search for Common Platform Enumeration (CPE) entries by product name
  • Parameters:
    • product (required): Name of the product to search for
    • count (optional, default: false): If true, returns only the count of matching CPEs
    • skip (optional, default: 0): Number of CPEs to skip (for pagination)
    • limit (optional, default: 1000): Maximum number of CPEs to return
  • Returns:
    • When count is true: Total number of matching CPEs
    • When count is false: List of CPEs with pagination details

5. CVEs by Product Tool

  • Name: cves_by_product
  • Description: Search for CVEs affecting a specific product or CPE
  • Parameters:
    • cpe23 (optional): CPE 2.3 identifier (format: cpe:2.3:part:vendor:product:version)
    • product (optional): Name of the product to search for CVEs
    • count (optional, default: false): If true, returns only the count of matching CVEs
    • is_kev (optional, default: false): If true, returns only CVEs with KEV flag set
    • sort_by_epss (optional, default: false): If true, sorts CVEs by EPSS score
    • skip (optional, default: 0): Number of CVEs to skip (for pagination)
    • limit (optional, default: 1000): Maximum number of CVEs to return
    • start_date (optional): Start date for filtering CVEs (format: YYYY-MM-DDTHH:MM:SS)
    • end_date (optional): End date for filtering CVEs (format: YYYY-MM-DDTHH:MM:SS)
  • Notes:
    • Must provide either cpe23 or product, but not both
    • Date filtering uses published time of CVEs
  • Returns:
    • When count is true: Total number of matching CVEs
    • When count is false: List of CVEs with pagination details and query parameters

6. DNS Lookup Tool

  • Name: dns_lookup
  • Description: Resolve hostnames to IP addresses
  • Parameters:
    • hostnames (required): Array of hostnames to resolve

Requirements

Troubleshooting

API Key Issues

If you see API key related errors:

  1. Verify your API key:
    • Should be a valid Shodan API key
    • No extra spaces or quotes around the key
    • Must be from your Shodan account settings
  2. After any configuration changes:
    • Save the config file
    • Restart Claude Desktop

Module Loading Issues

If you see module loading errors:

  1. For global installation: Use the simple configuration shown in Quick Start
  2. For source installation: Ensure you're using Node.js v18 or later

Development

To run in development mode with hot reloading:

npm run dev

Error Handling

The server includes comprehensive error handling for:

  • Invalid API keys
  • Rate limiting
  • Network errors
  • Invalid input parameters
  • Invalid CVE formats
  • Invalid CPE lookup parameters
  • Invalid date formats
  • Mutually exclusive parameter validation

Version History

  • v1.0.7: Added CVEs by Product search functionality and renamed vulnerabilities tool to cve_lookup
  • v1.0.6: Added CVEDB integration for enhanced CVE lookups and CPE search functionality
  • v1.0.0: Initial release with core functionality

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

GitHub Badge

Glama performs regular codebase and documentation scans to:

  • Confirm that the MCP server is working as expected.
  • Confirm that there are no obvious security issues with dependencies of the server.
  • Extract server characteristics such as tools, resources, prompts, and required parameters.

Our directory badge helps users to quickly asses that the MCP server is safe, server capabilities, and instructions for installing the server.

Copy the following code to your README.md file:

Alternative MCP servers

  • A
    security
    A
    license
    A
    quality
    A MCP server for querying the [VirusTotal](https://www.virustotal.com/gui/home/upload) API. This server provides tools for scanning URLs, analyzing file hashes, and retrieving IP address reports.
    MIT
    • Apple
  • A
    security
    A
    license
    A
    quality
    The ArXiv MCP Server bridges the gap between AI models and academic research by providing a sophisticated interface to arXiv's extensive research repository. This server enables AI assistants to perform precise paper searches and access full paper content, enhancing their ability to engage with scientific literature.
    Apache-2.0
  • A
    security
    A
    license
    A
    quality
    A Model Context Protocol (MCP) server implementation for DuckDB, providing database interaction capabilities through MCP tools. It would be interesting to have LLM analyze it. DuckDB is suitable for local analysis.
    MIT
    • Apple