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.
Before installing the server, ensure you have access to a Shodan API key. You'll need to set up environment variables for authentication.
Install the required dependencies using uv:
uv add "mcp[cli]"
uv add "sseclient-py"
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.
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.
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 the server to query Shodan for:
The streaming API gives you access to:
Leverage the Trends API to analyze:
The server provides comprehensive access to Shodan's capabilities:
All functionality is available through the MCP interface, making it compatible with Claude Desktop, CLI tools, and other MCP-compatible clients.
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.
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.
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"
]
}
}
}
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.
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.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.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