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
SecMCPclass 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
- Install the package:
pip install sec-mcp
- Check a single URL/domain/IP:
sec-mcp check https://example.com
- Batch check from a file:
sec-mcp batch urls.txt
- View blacklist status:
sec-mcp status - Manually trigger an update:
sec-mcp update
Usage via API (Python)
- Install in your project:
pip install sec-mcp
- Import and initialize:
from sec_mcp import SecMCP client = SecMCP()
- Single check:
result = client.check("https://example.com") print(result.to_json())
- Batch check:
urls = ["https://example.com", "https://test.com"] results = client.check_batch(urls) for r in results: print(r.to_json())
- 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):
- Install in editable mode (for development):
pip install -e .
- Start the MCP server:
sec-mcp-server
- 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
--directoryargument ensures the working directory is set to your project root, so Python treatssec_mcpas 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
--directoryif 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.
- The
Clients will then use the built-in check_blacklist tool over JSON/STDIO for real-time security checks.
New MCP Server Tools
The following RPC endpoints are now available:
- check_batch(values: List[str]): Bulk check multiple domains/URLs/IPs in one call. Returns a list of
{ value, is_safe, explanation }. - sample_blacklist(count: int): Return a random sample of blacklist entries for quick inspection.
- get_source_stats(): Retrieve detailed stats: total entries, per-source counts, and last update timestamps. Returns
{ total_entries, per_source, last_updates }. - get_update_history(source?: str, start?: str, end?: str): Fetch update history records, optionally filtered by source and time range.
- flush_cache(): Clear the in-memory URL/IP cache. Returns
{ cleared: bool }. - health_check(): Perform a health check of the database and scheduler. Returns
{ db_ok: bool, scheduler_alive: bool, last_update: timestamp }. - add_entry(url: str, ip?: str, date?: str, score?: float, source?: str): Manually add a blacklist entry. Returns
{ success: bool }. - remove_entry(value: str): Remove a blacklist entry by URL or IP address. Returns
{ success: bool }.
Configuration
The client can be configured via config.json:
blacklist_sources: URLs for blacklist feedsupdate_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-mcpin a virtual environment, set thecommandpath to your.venvPython as shown above. If you installed it globally or viapip(system-wide), use your system Python executable (e.g.,python3or 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(orpython) if installed system-wide via pip.
- Ensure you have installed all dependencies in your virtual environment (
.venv). - The
commandshould point to your Python executable inside.venvfor best isolation. - The
argsarray 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sec_mcp-0.1.7.tar.gz.
File metadata
- Download URL: sec_mcp-0.1.7.tar.gz
- Upload date:
- Size: 18.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad9e8cc870abfeec2185ae852f3ea08f461b6f8d709ced849cec1492b6c55659
|
|
| MD5 |
ad04379d09b5288c022dafd4afb3eb3e
|
|
| BLAKE2b-256 |
2454aa174440f067bea6b65c330de4108a28a14d494f9af72e772c24a313d699
|
File details
Details for the file sec_mcp-0.1.7-py3-none-any.whl.
File metadata
- Download URL: sec_mcp-0.1.7-py3-none-any.whl
- Upload date:
- Size: 19.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d9cd7c1e58c536ed5241f37dc827ebae6346b6be90c4b43f5dcd19f0cc51f85
|
|
| MD5 |
2182f33a974c8f6f6efddb9a4757a0c1
|
|
| BLAKE2b-256 |
21f0e55a3bccbee13a2dd5cc5427f6134d03facbde1d2468a82dce83ff44315a
|