Skip to main content

Python toolkit providing security checks for domains, URLs, IPs, and more.

Project description

sec-mcp: Security Checking Toolkit

A Python toolkit providing security checks for domains, URLs, IPs, and more. Integrate easily into any Python application, use via terminal CLI, or run as an MCP server to enrich LLM context with real-time threat insights.

Features

  • Comprehensive security checks for domains, URLs, IP addresses, and more against multiple blacklist feeds
  • On-demand updates from OpenPhish, PhishStats, URLhaus and custom sources
  • High-performance, thread-safe SQLite storage with in-memory caching for fast lookups
  • Python API via SecMCP class for easy integration into your applications
  • Intuitive Click-based CLI for interactive single or batch scans
  • Built-in MCP server support for LLM/AI integrations over JSON/STDIO

Environment Variable: MCP_DB_PATH

By default, sec-mcp stores its SQLite database (mcp.db) in a shared, cross-platform location:

  • macOS: ~/Library/Application Support/sec-mcp/mcp.db
  • Linux: ~/.local/share/sec-mcp/mcp.db
  • Windows: %APPDATA%\sec-mcp\mcp.db

You can override this location by setting the MCP_DB_PATH environment variable:

export MCP_DB_PATH=/path/to/your/custom/location/mcp.db

Set this variable before running any sec-mcp commands or starting the server. The directory will be created if it does not exist.

Installation

pip install sec-mcp

Usage via CLI

  1. Install the package:
    pip install sec-mcp
    
  2. Check a single URL/domain/IP:
    sec-mcp check https://example.com
    
  3. Batch check from a file:
    sec-mcp batch urls.txt
    
  4. View blacklist status:
    sec-mcp status
    
  5. Manually trigger an update:
    sec-mcp update
    

Usage via API (Python)

  1. Install in your project:
    pip install sec-mcp
    
  2. Import and initialize:
    from sec_mcp import SecMCP
    
    client = SecMCP()
    
  3. Single check:
    result = client.check("https://example.com")
    print(result.to_json())
    
  4. Batch check:
    urls = ["https://example.com", "https://test.com"]
    results = client.check_batch(urls)
    for r in results:
        print(r.to_json())
    
  5. Get status and update:
    status = client.get_status()
    print(status.to_json())
    
    client.update()
    

Usage via MCP Client

To run sec-mcp as an MCP server for AI-driven clients (e.g., Claude):

  1. Install in editable mode (for development):
    pip install -e .
    
  2. Start the MCP server:
    sec-mcp-server
    
  3. Configure your MCP client (e.g., Claude, Windsurf, Cursor) to point at the command:
    {
      "mcpServers": {
        "sec-mcp": {
          "command": "uv",
          "args": ["--directory","/Users/montimage/workspace/montimage/sec-mcp","run", "-m", "sec_mcp.start_server"]
        }
      }
    }
    

    Note:

    • The --directory argument ensures the working directory is set to your project root, so Python treats sec_mcp as a package and all relative imports work correctly. This is essential for correct module resolution when running as a module (-m).
    • Update the path in --directory if your project is in a different location.
    • Ensure all dependencies are installed in your virtual environment (.venv).
    • This is the recommended configuration for integration with AI-driven clients.

Clients will then use the built-in check_blacklist tool over JSON/STDIO for real-time security checks.

Configuration

The client can be configured via config.json:

  • blacklist_sources: URLs for blacklist feeds
  • update_time: Daily update schedule (default: "00:00")
  • cache_size: In-memory cache size (default: 10000)
  • log_level: Logging verbosity (default: "INFO")

Configuring sec-mcp with Claude (MCP Client)

To use your MCP Server for security checking (sec-mcp) with an MCP client such as Claude, add it to your Claude configuration as follows:

{
  "mcpServers": {
    "sec-mcp": {
      "command": "/[ABSOLUTE_PATH_TO_VENV]/.venv/bin/python3",
      "args": ["-m", "sec_mcp.start_server"]
    }
  }
}

Note: If you installed sec-mcp in a virtual environment, set the command path to your .venv Python as shown above. If you installed it globally or via pip (system-wide), use your system Python executable (e.g., python3 or the full path to your Python):

{
  "mcpServers": {
    "sec-mcp": {
      "command": "python3",
      "args": ["-m", "sec_mcp.start_server"]
    }
  }
}

Tip:

  • Use the absolute path to the Python executable for virtual environments for isolation.
  • Use python3 (or python) if installed system-wide via pip.
  • Ensure you have installed all dependencies in your virtual environment (.venv).
  • The command should point to your Python executable inside .venv for best isolation.
  • The args array should launch your MCP server using the provided script.
  • You can add other MCP servers in the same configuration if needed.

This setup allows Claude (or any compatible MCP client) to connect to your sec-mcp server and use its check_blacklist tool for real-time security checks on URLs, domains, or IP addresses.

For more details and advanced configuration, see the Model Context Protocol examples.

Development

Clone the repository and install in development mode:

git clone <repository-url>
cd sec-mcp
pip install -e .

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sec_mcp-0.1.6.tar.gz (16.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sec_mcp-0.1.6-py3-none-any.whl (17.8 kB view details)

Uploaded Python 3

File details

Details for the file sec_mcp-0.1.6.tar.gz.

File metadata

  • Download URL: sec_mcp-0.1.6.tar.gz
  • Upload date:
  • Size: 16.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for sec_mcp-0.1.6.tar.gz
Algorithm Hash digest
SHA256 2095f54bf01260733d80eec1a202aa08efb68317305c0ec77994000b30be8d54
MD5 6800f068026e7e006f04e356854d7281
BLAKE2b-256 8bef3b8ebdda8cf47e069490d38da9750b903610ee8d5219c12f15cfc1bba33e

See more details on using hashes here.

File details

Details for the file sec_mcp-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: sec_mcp-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 17.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for sec_mcp-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 e99042926263ded54e58c03fd5a70a91739dfa9056621f0426fccfd13d741059
MD5 975b81232f0079d177b8f89da6a19b47
BLAKE2b-256 5651334883bb4100e4593ba6456ac0be97b9a4fe71cd38e84844bf786b044149

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page