Environment:0x4m4 Hexstrike ai FastMCP Server
| Knowledge Sources | |
|---|---|
| Domains | Infrastructure, MCP, AI_Agents |
| Last Updated | 2026-10-10 00:00 GMT |
Overview
FastMCP framework environment providing the Model Context Protocol server that bridges AI agents to the HexStrike security tool ecosystem.
Description
This environment provides the FastMCP Python package which implements the Model Context Protocol server. The setup_mcp_server function creates a FastMCP("hexstrike-ai-mcp") instance and registers 80+ security tool functions as MCP-callable methods via the @mcp.tool() decorator. FastMCP auto-generates JSON schemas from Python type hints and docstrings, allowing AI agents (Claude, GPT, Cursor, VS Code Copilot) to discover and invoke tools. The MCP client config is defined in hexstrike-ai-mcp.json.
Usage
Use this environment when setting up the MCP server that exposes HexStrike tools to AI agents. Required by the setup_mcp_server implementation. The MCP server runs as a separate process from the Flask server, communicating via HTTP.
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| OS | Linux (Ubuntu/Debian preferred) | Same as base Python environment |
| Hardware | 1+ CPU core, 512MB RAM | Lightweight; main workload is on the Flask server |
| Disk | 100MB | For fastmcp package and dependencies |
| Network | TCP localhost | MCP server listens on stdio; connects to Flask server over HTTP |
Dependencies
System Packages
- `python3` >= 3.8
Python Packages
- `fastmcp` >= 0.2.0, < 1.0.0
- `mcp` (transitive dependency of fastmcp)
- `requests` >= 2.31.0, < 3.0.0 (for HexStrikeClient HTTP calls)
Credentials
No credentials required. The MCP server connects to the HexStrike Flask server via HTTP on localhost. Configuration is done via hexstrike-ai-mcp.json.
Quick Install
pip install fastmcp>=0.2.0,<1.0.0 requests>=2.31.0,<3.0.0
Code Evidence
FastMCP import from `hexstrike_mcp.py:29`:
from mcp.server.fastmcp import FastMCP
FastMCP server instantiation from `hexstrike_mcp.py:267-270`:
def setup_mcp_server(hexstrike_client: HexStrikeClient) -> FastMCP:
"""Set up the MCP server with all enhanced tool functions."""
mcp = FastMCP("hexstrike-ai-mcp")
@mcp.tool()
def nmap_scan(target: str, scan_type: str = "-sV", ...) -> Dict[str, Any]:
"""Execute an enhanced Nmap scan against a target with real-time logging."""
MCP client config from `hexstrike-ai-mcp.json`:
{
"mcpServers": {
"hexstrike-ai-mcp": {
"command": "python3",
"args": ["/path/to/hexstrike_mcp.py"],
"env": {
"HEXSTRIKE_SERVER_URL": "http://localhost:5000"
},
"alwaysAllow": ["nmap_scan", "gobuster_scan", "nuclei_scan"]
}
}
}
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| `ImportError: No module named 'mcp.server.fastmcp'` | fastmcp not installed | `pip install fastmcp>=0.2.0` |
| `Connection refused to http://127.0.0.1:8888` | Flask server not running | Start `hexstrike_server.py` first |
| MCP tool not found by AI agent | alwaysAllow not configured | Add tool names to `alwaysAllow` in hexstrike-ai-mcp.json |
Compatibility Notes
- Claude Desktop: Fully supported via MCP config.
- Cursor: Supported; add the MCP server config in Cursor settings.
- VS Code Copilot: Supported; configure MCP in VS Code settings.
- 5ire v0.14.0: Not currently supported (per README).