Shodan MCP server

Integrates with Shodan's database to enable host information lookup, vulnerability scanning, and DNS resolution for security research and network exposure analysis
Back to servers
Provider
X3r0K
Release date
Mar 25, 2025
Language
TypeScript
Stats
1 star

This MCP server provides a WebSocket interface for interacting with the Shodan API, allowing you to query information about internet-connected devices, vulnerabilities, and perform related tasks like DNS lookups and CVE information retrieval.

Prerequisites

  • Node.js >= 20.0.0
  • Docker (optional)
  • Shodan API Key

Installation

First, clone the repository and install the dependencies:

# Clone the repository
git clone https://github.com/yourusername/shodan-mcp-server.git
cd shodan-mcp-server

# Install dependencies
npm install

Configuration

Before running the server, you need to set your Shodan API key as an environment variable:

export SHODAN_API_KEY=your_api_key_here  # Unix/Linux/macOS
$env:SHODAN_API_KEY="your_api_key_here"  # Windows PowerShell

Running the Server

Standard Method (Node.js)

Start the server using npm:

npm start

Docker Method

If you prefer Docker, you can build and run the container:

# Build the image
npm run build

# Run the container
docker run -e SHODAN_API_KEY=your_api_key_here -p 3000:3000 shodan-mcp-server

By default, the server starts on port 3000. To use a different port, set the PORT environment variable.

Using the API

The server implements the Model Context Protocol (MCP) over WebSocket. You can use the following tools:

Host Information

Retrieve detailed information about an IP address:

{
  "tool": "host_info",
  "params": {
    "ip": "8.8.8.8"
  }
}

Search Shodan

Search the Shodan database using their query syntax:

{
  "tool": "search",
  "params": {
    "query": "nginx country:\"US\"",
    "page": 1,
    "limit": 10
  }
}

DNS Lookup

Resolve domain names to IP addresses:

{
  "tool": "dns_lookup",
  "params": {
    "domain": "example.com"
  }
}

CVE Information

Get details about specific CVE vulnerabilities:

{
  "tool": "cve_info",
  "params": {
    "cveId": "CVE-2021-44228"
  }
}

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later