automataIA/python-project-analyzer-mcp
If you are the rightful owner of python-project-analyzer-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
A Model Context Protocol (MCP) server that provides tools for analyzing Python projects, extracting library signatures, and retrieving project information.
Get Project Dependencies
Extracts dependencies from a project's pyproject.toml file.
Get File Information
Returns detailed information about a specified file.
Extract Library Signatures
Searches for and extracts function or class signatures from a specified library.
Python Project Analyzer MCP Server
A Model Context Protocol (MCP) server that provides tools for analyzing Python projects, extracting library signatures, and retrieving project information.
Overview
This MCP server provides tools to help AI assistants analyze Python projects, extract information about libraries, and understand project dependencies. It's designed to be used with MCP-compatible clients like Claude.
Features
- Project Dependencies Analysis: Extract dependencies from
pyproject.toml
files - File Information Retrieval: Get detailed information about files in a project
- Library Signature Extraction: Extract function and class signatures from Python libraries with search capabilities
Requirements
- Python 3.11+
- Dependencies:
mcp>=0.9.1
pydantic>=2.0.0
fastapi>=0.90.0
uvicorn[standard]
httpx>=0.27.0
toml>=0.10.2
requests>=2.32.3
Installation
-
Clone the repository:
git clone https://github.com/yourusername/python-project-analyzer-mcp.git cd python-project-analyzer-mcp
-
Install dependencies with uv:
uv sync
-
Install additional dependencies if needed:
# Install a development dependency uv add pytest --dev # Install a regular dependency uv add requests # Install dependencies from a specific group uv add ruff --group lint # Sync all dependencies including development ones uv sync # Sync only development dependencies uv sync --only-dev # Sync with specific groups uv sync --group lint # Sync all groups uv sync --all-groups
Usage
Running the Server
You can run the server directly:
python mcp_server_sdk.py
Connecting to Claude or Other MCP Clients
To use this server with Claude Desktop:
-
Install the MCP server:
mcp install /path/to/mcp_server_sdk.py --name "Python Project Analyzer"
-
The server will appear in Claude's available tools list.
Available Tools
1. Get Project Dependencies
Extracts dependencies from a project's pyproject.toml
file.
{
"jsonrpc": "2.0",
"method": "get_project_dependencies",
"params": {
"project_path": "/path/to/project"
},
"id": "request-id"
}
2. Get File Information
Returns detailed information about a specified file.
{
"jsonrpc": "2.0",
"method": "get_file_info",
"params": {
"file_path": "/path/to/file.py"
},
"id": "request-id"
}
3. Extract Library Signatures
Searches for and extracts function or class signatures from a specified library.
{
"jsonrpc": "2.0",
"method": "extract_library_signatures",
"params": {
"library_name": "json",
"project_path": "/path/to/project",
"search_term": "dump",
"max_results": 5,
"exact_match": false
},
"id": "request-id"
}
Testing
Run the tests to verify the server is working correctly:
pytest test_mcp_client.py
Project Structure
mcp_server_sdk.py
: Main MCP server implementationhelper_script.py
: Helper functions for library inspectiontest_mcp_client.py
: Client tests for the MCP servertest_mcp_server.py
: Server unit testspyproject.toml
: Project dependencies and metadata
Understanding MCP
The Model Context Protocol (MCP) is a standardized way for AI models to interact with external tools and resources. Key concepts include:
- Tools: Functions that models can call to perform actions or retrieve information
- Resources: External data sources that models can reference
- Transports: Communication channels between clients and MCP servers
This server implements the MCP specification to provide Python project analysis tools to AI assistants.
Learning Resources
Installation on Windsurf
To install and use this MCP server in the Windsurf environment, follow these steps:
-
Clone the repository into your MCP servers directory:
git clone https://github.com/yourusername/python-project-analyzer-mcp.git ~/mcp-servers/mcp-python cd ~/mcp-servers/mcp-python
-
Install dependencies using uv:
uv sync
-
Configure Windsurf to use this MCP server by updating your MCP configuration file:
mkdir -p ~/.codeium/windsurf
-
Create or update the MCP configuration file:
cat > ~/.codeium/windsurf/mcp_config.json << EOF { "mcp_servers": [ { "name": "python-analyzer", "command": ["python", "$HOME/mcp-servers/mcp-python/mcp_server_sdk.py"] } ] } EOF
-
Restart Windsurf to apply the changes.
-
Verify the installation by checking if the MCP server appears in the available tools list in Windsurf.
For more detailed information, refer to the Windsurf documentation at @web https://docs.windsurf.com
License
This project is licensed under the MIT License - see the file for details.
MIT License
Copyright (c) 2025 [Your Name]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.