Skip to content

MCP Server for AccuKnox

This guide provides step-by-step instructions for setting up and using the AccuKnox MCP Server with your favorite AI tools.

Quick Start

1. Prerequisites

Before you begin

Ensure you have the following ready:

  • Python 3.10 or higher installed.
  • An AccuKnox API Token (retrieve this from your CSPM dashboard).

2. Installation

Setup Instructions

Clone the repository and install the necessary dependencies:

git clone https://github.com/accuknox/mcp_server/
cd mcp_server # move into the project directory
python3 -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate
pip install -r requirements.txt

3. Configuration

Important: Environment Variables

Currently, the server relies on a .env file for configuration. Do not configure environment variables directly in mcp.json at this time.

Create a .env file in the project root:

.env
ACCUKNOX_BASE_URL=[https://cspm.demo.accuknox.com](https://cspm.demo.accuknox.com)
ACCUKNOX_API_TOKEN=your_token_here

🛠️ Client Configuration

1. VS Code (GitHub Copilot)

Prerequisite

You must have the GitHub Copilot Extension installed.

  1. Create a folder named .vscode in your project root (if it doesn't exist).
  2. Create a file named mcp.json inside .vscode/.
  3. Add the following configuration (replace /absolute/path/to with your actual path):

    .vscode/mcp.json
    {
      "mcpServers": {
        "accuknox": {
          "command": "/absolute/path/to/MCP_server_Poc/venv/bin/python",
          "args": ["/absolute/path/to/MCP_server_Poc/MCP_server.py"]
        }
      }
    }
    
  4. Restart VS Code or reload the window.

  5. Open Copilot Chat and look for the "Tools" icon to verify accuknox is enabled.

2. Cursor

Cursor supports MCP servers via a configuration file similar to VS Code, but in a different directory.

  1. Create a folder named .cursor in your project root (if it doesn't exist).
  2. Create a file named mcp.json inside .cursor/.
  3. Add the following configuration:

    .cursor/mcp.json
    {
      "mcpServers": {
        "accuknox": {
          "command": "/absolute/path/to/MCP_server_Poc/venv/bin/python",
          "args": ["/absolute/path/to/MCP_server_Poc/MCP_server.py"]
        }
      }
    }
    

Path Resolution Issues

Important: Ensure the .env file is in the project root. Cursor should pick up the environment variables from the .env file if opened in the project root.

If you encounter issues, use the wrapper script approach below.

Optional: Wrapper Script Approach

If Cursor fails to load the environment variables, create a start_server.sh script:

start_server.sh
#!/bin/bash
# Navigate to the project directory to ensure .env is loaded
cd /absolute/path/to/MCP_server_Poc
source .env
./venv/bin/python MCP_server.py

Make it executable (chmod +x start_server.sh) and update mcp.json to point to this script.

3. Claude Desktop App

  1. Locate your Claude Desktop configuration file:
    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Windows: %APPDATA%\Claude\claude_desktop_config.json
  2. Edit the file to include the AccuKnox server:

    claude_desktop_config.json
    {
      "mcpServers": {
        "accuknox": {
          "command": "/absolute/path/to/MCP_server_Poc/venv/bin/python",
          "args": ["/absolute/path/to/MCP_server_Poc/MCP_server.py"]
        }
      }
    }
    
  3. Restart the Claude Desktop App.

  4. Look for the 🔌 icon to verify the server is connected.

4. Gemini CLI

  1. Install the Gemini CLI tools (if not already installed).
  2. Add the MCP server using the gemini command:

    gemini mcp add accuknox \
      /absolute/path/to/MCP_server_Poc/venv/bin/python \
      /absolute/path/to/MCP_server_Poc/MCP_server.py
    

Note

Ensure you run the gemini command from the project directory where .env is located, or that the environment variables are exported in your shell.

5. HTTP Server Configuration (Advanced)

To use the fastmcp server in HTTP mode (SSE):

  1. Activate Virtual Environment:

    cd /absolute/path/to/MCP_server_Poc
    source venv/bin/activate
    
  2. Start the Server:

    python3 fastmcp_server.py
    

    The server will start on http://0.0.0.0:8000.

  3. Configure Client (e.g., VS Code/Cursor): Update your mcp.json to use the SSE endpoint:

    {
      "mcpServers": {
        "accuknox-http": {
          "url": "http://localhost:8000/mcp",
          "type": "sse"
        }
      }
    }
    

Usage Examples

Try these prompts

Once connected, you can ask questions like:

  • "How many cloud assets do I have?"
  • "Show me all AWS S3 buckets in us-east-1."
  • "What are the critical vulnerabilities in my AI models?"
  • "List deployed AI models discovered in the last 24 hours."

Troubleshooting

Common Issues

  • Server not starting? Check the logs or try running the command manually in your terminal to see errors.
  • Authentication failed? Verify your ACCUKNOX_API_TOKEN is correct in the .env file.
  • Path issues? Always use absolute paths in configuration files.