Get the FREE Ultimate OpenClaw Setup Guide →

fofa

基于 MCP (Model Control Protocol)的 FOFA API 查询服务器,提供简单易用的 FOFA 数据查询接口。

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio intbjw-fofa-mcp-server python3 /path/to/fofa-mcp-server/main.py \
  --env FOFA_KEY="API KEY"

How to use

This FOFA MCP Server exposes a simple interface to query FOFA data via MCP, including basic FOFA searches, optional field expansion, and account information. It uses an asynchronous HTTP client to fetch results from FOFA and returns a structured response containing a summary and a list of result items. The main tools you’ll interact with are: fofa_search_tool(query, fields, size) which runs a FOFA query and returns a dictionary with summary and data, and fofa_userinfo_tool() which retrieves details about the configured FOFA account. To use the server, configure the FOFA API key in the environment (FOFA_KEY) and start the MCP server. Then send queries through the MCP framework and receive the structured results, including either the default basic fields or all available fields when fields is set to "all". The server is designed to be integrated with other MCP-enabled systems, enabling chained or automated workflows that leverage FOFA data.

How to install

Prerequisites:

  • Python 3.11 or newer
  • Access to FOFA API with a valid key
  • network access to FOFA API endpoints

Install steps:

  1. Clone the repository: git clone https://github.com/intbjw/fofa-mcp-server.git cd fofa-mcp-server

  2. Install dependencies: pip install -r requirements.txt

    or, if you prefer Poetry:

    poetry install

  3. Prepare configuration: Create a configuration file (as shown in the README) and place it where your MCP loader expects it. For example, /path/to/fofa-mcp-server/main.py should be accessible and executable by the server.

  4. Run the server via MCP configuration (as described in the mcp_config section) and verify that the MCP server reports it is connected.

Additional notes

Notes and tips:

  • Ensure FOFA_KEY is valid and has permissions for the required queries.
  • Respect FOFA API usage limits and quotas to avoid throttling or blocking.
  • When using fields="all", be aware that the response payload may be larger; adjust size accordingly.
  • If you deploy behind proxies or in restricted networks, ensure outbound access to FOFA APIs is permitted.
  • If you encounter authentication or rate-limit errors, double-check the API key and consult FOFA API documentation for quota details.
  • The server is designed to be easily injectable into larger MCP-based workflows, enabling automated queries and data pipelines.

Related MCP Servers

Sponsor this space

Reach thousands of developers