Shodan MCP server

A fully async implementation that exposes the complete Shodan API (REST, Streaming, and Trends) as MCP tools. Use Shodan's internet intelligence tools in your automation, research, and security workflows.
Back to servers
Setup instructions
Provider
mohdhaji87
Release date
Jul 21, 2025

The Shodan MCP Server enables seamless integration of Shodan's internet intelligence capabilities into your workflows through the Model Context Protocol. It provides access to Shodan's REST, Streaming, and Trends APIs, allowing you to query device information, search the internet, and monitor real-time data.

Installation

Prerequisites

Before installing the server, ensure you have access to a Shodan API key. You'll need to set up environment variables for authentication.

Installing Dependencies

Install the required dependencies using uv:

uv add "mcp[cli]"
uv add "sseclient-py"

Setting Environment Variables

Configure your Shodan API credentials as environment variables:

export SHODAN_API_KEY=your_main_shodan_api_key
# Optionally:
export SHODAN_STREAM_API_KEY=your_streaming_key
export SHODAN_TRENDS_API_KEY=your_trends_key

If you don't set the specific keys for streaming or trends, the server will use the main SHODAN_API_KEY as a fallback.

Starting the Server

Start the server using uvicorn or uv:

uv --directory /path/to/shodan-mcp run server.py

Replace /path/to/shodan-mcp with the actual path to your server directory.

Integration with Claude Desktop

To use the Shodan MCP Server with Claude Desktop or Cursor, create a configuration file with the following JSON:

{
  "mcpServers": {
    "ShodanMCP": {
      "command": "uv",
      "args": [
        "--directory", "/path/to/shodan-mcp",
        "run", "server.py"
      ]
    }
  }
}

Ensure you update the directory path to match your actual installation location.

Use Cases

Security Research

Use the server to query Shodan for:

  • Host information
  • Internet-wide device searches
  • DNS data
  • Vulnerability identification

Real-Time Monitoring

The streaming API gives you access to:

  • Real-time firehose data
  • Port-specific monitoring
  • Alert event streams

Data Analysis

Leverage the Trends API to analyze:

  • Top ports across the internet
  • Leading organizations
  • Country-specific trends
  • Custom query trends

Features Overview

The server provides comprehensive access to Shodan's capabilities:

  • REST API: Access host information, search functionality, DNS data, datasets, account information, and tools
  • Streaming API: Connect to real-time data streams including the firehose, port-specific streams, and alert events
  • Trends API: Analyze top ports, organizations, and countries for any search query

All functionality is available through the MCP interface, making it compatible with Claude Desktop, CLI tools, and other MCP-compatible clients.

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "ShodanMCP" '{"command":"uv","args":["--directory","/Users/haji/mcp-servers/shodan-mcp","run","server.py"]}'

See the official Claude Code MCP documentation for more details.

For 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 > Tools & Integrations and click "New MCP Server".

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

{
    "mcpServers": {
        "ShodanMCP": {
            "command": "uv",
            "args": [
                "--directory",
                "/Users/haji/mcp-servers/shodan-mcp",
                "run",
                "server.py"
            ]
        }
    }
}

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 explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "ShodanMCP": {
            "command": "uv",
            "args": [
                "--directory",
                "/Users/haji/mcp-servers/shodan-mcp",
                "run",
                "server.py"
            ]
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

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