A Model Context Protocol server for cognitive complexity analysis using complexipy
Project description
Complexipy MCP Server
A Model Context Protocol (MCP) server that wraps complexipy to provide cognitive complexity analysis for Python codebases. This server uses the complexipy Python API for accurate and robust analysis.
Features
- Directory Scanning: Recursively analyze all
.pyfiles in a directory and filter by complexity threshold. - File Scanning: Analyze a single Python file.
- Data Processing: Uses
pandasfor efficient data filtering and sorting. - Clean Output: Returns JSON formatted results (list of objects).
- No Emojis: Pure data output suitable for machine consumption.
- Stdio Transport: Uses standard input/output for communication, making it compatible with most MCP clients.
Installation & Usage
Quick Start
You can run the server directly using uvx (no installation required):
uvx complexipy-mcp
Configuration for Claude Desktop
Add the following configuration to your MCP client settings (e.g., claude_desktop_config.json):
{
"mcpServers": {
"complexipy": {
"command": "uvx",
"args": [
"complexipy-mcp"
]
}
}
}
Local Development
- Clone the repository.
- Install dependencies:
uv sync - Run the server locally:
uv run complexipy-mcp
Local Configuration for Claude Desktop
If you are developing locally, point the configuration to your local setup:
{
"mcpServers": {
"complexipy": {
"command": "uv",
"args": [
"--directory",
"/ABSOLUTE/PATH/TO/complexipy-mcp",
"run",
"complexipy-mcp"
]
}
}
}
Tools
scan_directory
Scans a directory for files exceeding a cognitive complexity threshold.
- Arguments:
directory_path(string): Absolute path to the directory to scan.threshold(integer): Complexity limit (default: 15).
- Returns: JSON string containing a list of files that exceed the threshold.
[ { "file_path": "/abs/path/to/file.py", "complexity": 25, "functions": [ { "name": "function_name", "complexity": 10, "line_start": 5, "line_end": 15 } ], "status": "exceeds_threshold" } ]
scan_file
Scans a single file for cognitive complexity.
- Arguments:
file_path(string): Absolute path to the file.threshold(integer): Complexity limit (default: 15).
- Returns: JSON string containing the result if it exceeds the threshold.
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 complexipy_mcp-0.1.0.tar.gz.
File metadata
- Download URL: complexipy_mcp-0.1.0.tar.gz
- Upload date:
- Size: 96.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c01cdad486659093db25da8eb73e3a98df3b02c847c23ad33165bd599a6160c1
|
|
| MD5 |
a54ed05378e5112e65ab2d98c8be048b
|
|
| BLAKE2b-256 |
cc4af9977ce8981c4d2cd25da922125d5643aac1e95490db25daadb14f8af602
|
File details
Details for the file complexipy_mcp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: complexipy_mcp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8caa15a301c0c4d10e6b3e482af408548e42bae5604ac1f5c1786d857c4ae74a
|
|
| MD5 |
683b52083800eda7f7810963b3ad6ccb
|
|
| BLAKE2b-256 |
06a69c3dba74163dacb6c43f5b3cc25fa3c9983abf9db6cbec86c66aa640006f
|