### Clone and setup project with uv sync --dev Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/CONTRIBUTING.md Initial setup commands to clone the repository and install development dependencies using uv. ```bash git clone https://github.com/Anselmoo/mcp-server-analyzer.git cd mcp-server-analyzer uv sync --dev ``` -------------------------------- ### Development Setup Commands Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/README.md Clone the repository, install dependencies, run tests, type checks, pre-commit hooks, and build the Docker image. ```bash # Clone repository git clone https://github.com/anselmoo/mcp-server-analyzer.git cd mcp-server-analyzer # Install Python dependencies uv sync --dev # Install Biome (JS/TS analyzer) npm ci # Run tests uv run pytest # Run type checks uv run ty check src tests # Run pre-commit hooks uv tool run pre-commit run --all-files # Build Docker image docker build -t mcp-server-analyzer . ``` -------------------------------- ### Install Biome via npm Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/docs/CICD_SETUP.md Install Biome dependencies locally using npm. Requires Node.js 22+. ```bash npm ci export PATH="$PWD/node_modules/.bin:$PATH" ``` -------------------------------- ### Clone and Setup Project with uv and npm Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/docs/development.md Clones the repository, installs Python dependencies with uv, and installs Biome for JS/TS analysis. Requires Python 3.13+, uv, Node.js 22+, and optional Docker. ```bash git clone https://github.com/Anselmoo/mcp-server-analyzer.git cd mcp-server-analyzer uv sync --dev # Install Biome (JS/TS analyzer) npm ci ``` -------------------------------- ### Create version tag for release Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/docs/CICD_SETUP.md Creates and pushes a version tag to trigger the full release pipeline. ```bash git tag v0.1.0 git push origin v0.1.0 ``` -------------------------------- ### Run with uvx (recommended) Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/docs/index.md Starts the MCP server using uvx, the recommended method. Requires uv to be installed. ```bash uvx mcp-server-analyzer ``` -------------------------------- ### Local Debug Commands Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/docs/CICD_SETUP.md Commands to test pre-commit, pytest, Docker build, package build, and package installation locally before pushing. ```bash # Test pre-commit uv tool run pre-commit run --all-files # Test pytest PYTHONPATH=src uv run pytest tests/ -v # Test Docker build docker build -t mcp-server-analyzer-test . # Test package build uv build # Test package installation pip install dist/*.whl ``` -------------------------------- ### Universal installation commands Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/README.md Install and run the MCP server analyzer using uvx, pip, Docker, or from source. The uvx method is recommended. For source installation, clone the repository, sync dependencies with uv, and run the server. ```bash # Install with uvx (recommended) uvx install mcp-server-analyzer # Install with pip pip install mcp-server-analyzer # Run with Docker docker run ghcr.io/anselmoo/mcp-server-analyzer:latest # Install from source git clone https://github.com/anselmoo/mcp-server-analyzer.git cd mcp-server-analyzer uv sync --dev uv run mcp-server-analyzer ``` -------------------------------- ### Activate CI/CD workflow Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/docs/CICD_SETUP.md Stages and commits the ci-cd.yml workflow file, then pushes to main to trigger the pipeline. ```bash # The ci-cd.yml workflow is already created and ready to use git add .github/workflows/ci-cd.yml git commit -m "feat: add comprehensive CI/CD pipeline" git push origin main ``` -------------------------------- ### pyproject.toml example Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/docs/configuration.md Example configuration for Ruff, ty, and Vulture in a single `pyproject.toml` file. ```toml [tool.ruff] target-version = "py313" line-length = 88 [tool.ruff.lint] select = ["ALL"] ignore = ["D100", "D101", "D102", "D103", "COM812"] [tool.ty.environment] python-version = "3.13" [tool.vulture] min_confidence = 80 sort_by_size = true ``` -------------------------------- ### Common Development Tasks Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/docs/development.md Runs tests, linting, formatting, type checking, pre-commit hooks, builds the package, and starts the server locally. Use these commands during development. ```bash # Tests uv run pytest uv run pytest --cov=src/mcp_server_analyzer --cov-report=html # Lint & format uv run ruff check src tests uv run ruff format src tests # Type check uv run ty check src tests # All pre-commit hooks uv run pre-commit run --all-files # Build package uv build # Run the server locally (via .mcp.json auto-config in Claude Code) uv run mcp-server-analyzer ``` -------------------------------- ### Conventional Commits examples Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/CONTRIBUTING.md Example commit messages following the Conventional Commits specification, validated by repo-release-tools in CI. ```text feat: add new analysis tool fix: handle empty ruff output docs: update tool reference test: add edge case for ty parser chore: bump dependencies ``` -------------------------------- ### Install and run with pip Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/docs/index.md Installs the package via pip and then runs the server directly. Requires Python and pip. ```bash pip install mcp-server-analyzer mcp-server-analyzer ``` -------------------------------- ### Test Complete Analysis Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/examples/README.md Command to run a complete analysis on all examples using the analyze_code tool through MCP. ```bash # All examples for comprehensive analysis # Use analyze_code tool through MCP ``` -------------------------------- ### Docker Build Failed Error Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/docs/CICD_SETUP.md Error message when Docker build fails. Check the Dockerfile and ensure required files exist. ```text Error: buildx failed with: ERROR: failed to solve ``` -------------------------------- ### Test RUFF Check with uv run Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/examples/README.md Command to run the RUFF check on the good example file. Expected to pass with minimal issues. ```bash # Good example (should pass) uv run python tests/test.py # Or test specific files through VS Code MCP integration ``` -------------------------------- ### Test VULTURE Scan Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/examples/README.md Command to run the VULTURE scan on the bad example file. Expected to find unused code. ```bash # Bad example (should find unused code) # Use the VS Code MCP integration or development server ``` -------------------------------- ### PyPI Trusted Publishing Error Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/docs/CICD_SETUP.md Error message shown when PyPI trusted publishing fails. Verify the trusted publisher configuration matches the repository name, workflow name, and environment name. ```text Error: Failed to authenticate with PyPI ``` -------------------------------- ### Run from source Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/docs/index.md Clones the repository, installs development dependencies with uv, and runs the server. Requires git and uv. ```bash git clone https://github.com/Anselmoo/mcp-server-analyzer.git cd mcp-server-analyzer uv sync --dev uv run mcp-server-analyzer ``` -------------------------------- ### SIM115 - Context Manager Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/examples/preview-ruff.md RUFF info about using open without 'with' on line 46, not fixable. ```python Line 46: f = open(self.config_file) # Should use 'with' statement ``` -------------------------------- ### Rename test workflow file Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/docs/CICD_SETUP.md Renames the existing test workflow file to a backup before activating the full CI/CD pipeline. ```bash mv .github/workflows/test-ci.yml .github/workflows/test-ci.yml.backup ``` -------------------------------- ### Dev commands Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/CLAUDE.md Commands for full setup, running all tests, and executing all pre-commit hooks. ```bash uv sync --dev && npm ci # full setup uv run pytest # all tests (100% coverage required) uv tool run pre-commit run --all-files # run all hooks ``` -------------------------------- ### Unused classes analysis Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/examples/preview-vulture.md List of unused classes detected at 60% confidence. ```python Line 139: UnusedClass # 60% confidence - Never instantiated ``` -------------------------------- ### Tests Failed Error Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/docs/CICD_SETUP.md Error message when tests fail due to PYTHONPATH issues or missing dependencies. Ensure the project structure is correct. ```text Error: PYTHONPATH issue or missing dependencies ``` -------------------------------- ### Project Structure Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/docs/development.md Shows the directory layout of the project, including configuration files, source modules, analyzers, and tests. ```text mcp-server-analyzer/ ├── biome.json # Biome JS/TS linter/formatter config ├── package.json # Node.js manifest (Biome dev dependency) src/mcp_server_analyzer/ ├── __init__.py # Package version ├── __main__.py # python -m entry point ├── server.py # FastMCP server, tool & resource definitions ├── models.py # Pydantic response models └── analyzers/ ├── __init__.py ├── ruff.py # Ruff linting & formatting ├── ty.py # ty type checking ├── vulture.py # Vulture dead code detection └── biome.py # Biome JS/TS linting & formatting tests/ conftest.py test_*.py ``` -------------------------------- ### Vulture scan command input Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/examples/preview-vulture.md User request to run vulture-scan on bad_code.py with 60% confidence for deeper insight. ```text > #vulture-scan of #file:bad_code.py with 60% confidence please to get a deeper insight ``` -------------------------------- ### E722 - Bare Except Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/examples/preview-ruff.md RUFF warning about bare except on line 50, not fixable. ```python Line 50: except: # Should specify exception type ``` -------------------------------- ### Unused functions analysis Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/examples/preview-vulture.md List of unused functions detected at 60% confidence. ```python Line 91: helper_function() # 60% confidence Line 96: another_unused_function() # 60% confidence Line 151: calculate_something() # 60% confidence ``` -------------------------------- ### biome-check JSON response example Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/docs/tools.md Example JSON response from the biome-check tool, showing a lint issue for using == instead of ===. ```json { "issues": [ { "rule": "lint/suspicious/noDoubleEquals", "severity": "error", "message": "Use === instead of ==", "file": "code.ts", "start_offset": 42, "end_offset": 44 } ], "total_issues": 1, "errors": 1, "warnings": 0 } ``` -------------------------------- ### RUFF check command input Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/examples/preview-ruff.md Command to run a comprehensive RUFF check on bad_code.py with all options for deeper insight. ```markdown > #ruff-check of #file:bad_code.py with all options please to get a deeper insight ``` -------------------------------- ### I001 - Import Formatting Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/examples/preview-ruff.md RUFF info about unsorted or unformatted import block on lines 8-22, fixable. ```python Line 8-22: Import block is un-sorted or un-formatted ``` -------------------------------- ### vulture-scan JSON response example Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/docs/tools.md Example JSON response from the vulture-scan tool, showing an unused function detection. ```json { "unused_items": [ { "name": "unused_helper", "type": "function", "line": 12, "column": 0, "confidence": 100, "message": "unused function 'unused_helper'" } ], "total_items": 1, "high_confidence_items": 1 } ``` -------------------------------- ### PIE790 - Unnecessary Pass Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/examples/preview-ruff.md RUFF info about unnecessary pass on line 40, fixable. ```python Line 40: pass # Unnecessary in __init__ ``` -------------------------------- ### Unused attributes analysis Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/examples/preview-vulture.md List of unused attributes detected at 60% confidence. ```python Line 38: self.temp_var = "unused" # 60% confidence Line 39: self.another_unused = 42 # 60% confidence ``` -------------------------------- ### F401 - Unused Imports Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/examples/preview-ruff.md List of unused imports detected by RUFF on lines 8-22, all fixable. ```python Lines 8-22: All completely unused imports - os, sys, datetime, re, math, random (standard library) - Any, Dict, List, Optional (typing) - subprocess, threading (standard library) - P (Path alias), dd (defaultdict), ET (ElementTree) ``` -------------------------------- ### PLW0602 - Unused Global Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/examples/preview-ruff.md RUFF info about unused global variables on line 106, not fixable. ```python Line 106: global GLOBAL_DATA, config # Used but never assigned ``` -------------------------------- ### Development workflow commands (test, lint, format, type check, pre-commit) Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/CONTRIBUTING.md Commands for running tests, coverage, linting, formatting, type checking, and all pre-commit hooks during development. ```bash # Run tests uv run pytest # Run with coverage uv run pytest --cov=src/mcp_server_analyzer --cov-report=html # Lint uv run ruff check src tests # Format uv run ruff format src tests # Type check uv run ty check src tests # Run all pre-commit hooks uv run pre-commit run --all-files ``` -------------------------------- ### ty-check JSON response example Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/docs/tools.md Example JSON response from the ty-check tool, showing a diagnostic for an invalid argument type. ```json { "diagnostics": [ { "line": 5, "column": 10, "rule": "invalid-argument-type", "message": "Argument of type 'int' cannot be assigned to parameter 'x' of type 'str'", "severity": "error" } ], "total_diagnostics": 1, "error_count": 1, "warning_count": 0 } ``` -------------------------------- ### UP035 - Deprecated Types Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/examples/preview-ruff.md RUFF info about deprecated typing.Dict/List on line 15, not fixable. ```python Line 15: typing.Dict/List deprecated, use dict/list instead ``` -------------------------------- ### F841 - Unused Variables Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/examples/preview-ruff.md RUFF errors for unused variables on lines 124-126, not fixable. ```python Line 124: unused_var = "this is never used" Line 125: another_unused = [1, 2, 3, 4, 5] Line 126: temp_dict = {"key": "value"} ``` -------------------------------- ### N817 - Import Naming Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/examples/preview-ruff.md RUFF warning about CamelCase 'Path' imported as acronym 'P' on line 20, not fixable. ```python Line 20: CamelCase 'Path' imported as acronym 'P' ``` -------------------------------- ### Unused imports analysis Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/examples/preview-vulture.md List of unused imports detected at 90% confidence, including standard library and typing imports. ```python Lines 8-22: Completely unused imports - os, datetime, re, math, random (standard library) - Any, Dict, List, Optional (typing) - subprocess, threading (standard library) - P (Path alias), dd (defaultdict alias), ET (ElementTree alias) ``` -------------------------------- ### SIM102 - Nested If Statements Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/examples/preview-ruff.md RUFF info about nested if statements on lines 77-79, not fixable. ```python Lines 77-79: Use single if statement instead of nested ``` -------------------------------- ### Unused variables analysis Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/examples/preview-vulture.md List of unused variables with confidence levels, including global variables and function parameters. ```python Line 25: GLOBAL_DATA = [] # 60% confidence Line 26: config = {} # 60% confidence Line 27: counter = 0 # 60% confidence Line 28: total_items = 0 # 60% confidence Line 124: unused_var = "..." # 60% confidence Line 125: another_unused = [...] # 60% confidence Line 126: temp_dict = {...} # 60% confidence Line 151: c (function parameter) # 100% confidence Line 157: MODULE_CONSTANT = "..." # 60% confidence Line 158: ANOTHER_CONSTANT = 42 # 60% confidence Line 159: unused_dict = {...} # 60% confidence ``` -------------------------------- ### E711 - None Comparisons Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/examples/preview-ruff.md RUFF warnings for using == None instead of 'is None' on lines 43 and 62, not fixable. ```python Line 43: if self.config_file == None # Should be 'is None' Line 62: item.get("name") != None # Should be 'is not None' ``` -------------------------------- ### RET504 - Unnecessary Assignment Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/examples/preview-ruff.md RUFF info about unnecessary assignments on lines 87 and 101, not fixable. ```python Line 87: temp2 = temp.upper(); return temp2 # Direct return Line 101: z = x + y; return z # Direct return ``` -------------------------------- ### Unused methods analysis Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/examples/preview-vulture.md List of unused methods detected at 60% confidence, including dead code and never-called methods. ```python Line 42: load_config() # 60% confidence - Never called Line 73: validate_item() # 60% confidence - Dead code Line 83: unused_method() # 60% confidence - Dead code Line 146: unused_method() in UnusedClass # 60% confidence ``` -------------------------------- ### W292 - Missing Newline Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/examples/preview-ruff.md RUFF warning about missing newline at end of file on line 163, fixable. ```python Line 163: No newline at end of file ``` -------------------------------- ### T201 - Print Statements Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/examples/preview-ruff.md RUFF info about print statements on lines 121 and 131, not fixable. ```python Line 121: print("Processed " + str(len(results)) + " items") Line 131: print("Item: " + item["name"] + " = " + item["value"]) ``` -------------------------------- ### ARG001 - Unused Argument Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/examples/preview-ruff.md RUFF warning about unused parameter 'c' in function on line 151, not fixable. ```python Line 151: def calculate_something(a, b, c) # Parameter 'c' unused ``` -------------------------------- ### N801 - Class Name Convention Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/examples/preview-ruff.md RUFF warning about class name 'badDataProcessor' on line 31, should use CapWords convention. ```python Line 31: Class name 'badDataProcessor' should use CapWords convention ``` -------------------------------- ### biome-check Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/docs/tools.md Lint JavaScript/TypeScript code using Biome. Requires Biome to be installed; accepts JS/TS source code and an optional virtual filename to control parser selection, returning a BiomeCheckResult with issues. ```APIDOC ## `biome-check` ### Description Lint JavaScript/TypeScript code using [Biome](https://biomejs.dev/). > **Requires Biome:** run `npm ci` (project local) or `npm install -g @biomejs/biome` (global). ### Parameters | Name | Type | Required | Default | Description | |------|------|----------|---------|-------------| | `code` | `string` | Yes | — | JS/TS source code to lint | | `filename` | `string` | No | `"code.ts"` | Virtual filename — controls parser selection (`.js`, `.ts`, `.jsx`, `.tsx`) | ### Returns `BiomeCheckResult` ```json { "issues": [ { "rule": "lint/suspicious/noDoubleEquals", "severity": "error", "message": "Use === instead of ==", "file": "code.ts", "start_offset": 42, "end_offset": 44 } ], "total_issues": 1, "errors": 1, "warnings": 0 } ``` ``` -------------------------------- ### Testing Commands Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/README.md Run all tests, generate coverage reports, and test specific functionality. ```bash # Run all tests uv run pytest tests/ -v # Run with coverage uv run pytest --cov=src/mcp_server_analyzer --cov-report=html # Test specific functionality uv run pytest tests/test_server.py::TestAnalyzers::test_ruff_with_sample_code ``` -------------------------------- ### Zed Configuration Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/README.md Add this JSON to your Zed settings.json to enable the analyzer as a context server. ```json "context_servers": { "analyzer": { "command": "uvx", "args": ["mcp-server-analyzer"] } } ``` -------------------------------- ### Useful rrt commands Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/CLAUDE.md Commands for branch creation, conventional commits, changelog linting, version bumping, health checks, and release validation using repo-release-tools. ```bash uv run rrt branch new "" # create conventional branch uv run rrt git commit "" # conventional commit (infers type from branch) uv run rrt changelog lint # lint [Unreleased] entries for style uv run rrt bump patch # bump patch version across all targets uv run rrt doctor # project health check uv run rrt release check # validate version targets and changelog ``` -------------------------------- ### Claude Desktop Configuration Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/README.md Add this JSON to your claude_desktop_config.json to register the analyzer MCP server with Claude Desktop. ```json { "mcpServers": { "analyzer": { "command": "uvx", "args": ["mcp-server-analyzer"] } } } ``` -------------------------------- ### Run with Docker Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/docs/index.md Runs the server in a Docker container. The -i flag keeps stdin open for MCP communication, and --rm removes the container after exit. ```bash docker run -i --rm ghcr.io/anselmoo/mcp-server-analyzer ``` -------------------------------- ### VS Code MCP configuration using uvx Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/README.md Add this JSON block to your VS Code User Settings (JSON) or to a .vscode/mcp.json file in your workspace. The 'mcp' key is required when using the mcp.json file. This configuration uses the recommended uvx command to run the analyzer. ```json { "mcp": { "servers": { "analyzer": { "command": "uvx", "args": ["mcp-server-analyzer"] } } } } ``` -------------------------------- ### VS Code MCP configuration using Docker Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/README.md Alternative JSON configuration for VS Code that runs the analyzer via Docker. Use this if you prefer containerized execution. The 'mcp' key is required when using the mcp.json file. ```json { "mcp": { "servers": { "analyzer": { "command": "docker", "args": ["run", "-i", "--rm", "ghcr.io/anselmoo/mcp-server-analyzer"] } } } } ``` -------------------------------- ### ty project_path via MCP tool call Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/docs/configuration.md Pass `project_path` to `ty-check` or `analyze-code` to point ty at your project root. ty reads `pyproject.toml` `[tool.ty]` or `ty.toml` from that directory. The `project_path` also controls import resolution. ```json { "name": "ty-check", "arguments": { "code": "...", "project_path": "/path/to/your/project" } } ``` -------------------------------- ### VS Code configuration Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/docs/index.md Add this JSON to .vscode/mcp.json to configure the analyzer as an MCP server in VS Code. ```json { "servers": { "analyzer": { "type": "stdio", "command": "uvx", "args": ["mcp-server-analyzer"] } } } ``` -------------------------------- ### ruff-check-ci Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/docs/tools.md Run Ruff with CI/CD-specific output formats (json, gitlab, github, sarif). Accepts Python source code and returns the output in the specified format. ```APIDOC ## `ruff-check-ci` ### Description Run Ruff with CI/CD-specific output formats (json, gitlab, github, sarif). ### Parameters | Name | Type | Required | Default | Description | |------|------|----------|---------|-------------| | `code` | `string` | Yes | — | Python source code | | `output_format` | `string` | No | `"json"` | `json`, `gitlab`, `github`, or `sarif` | | `config_path` | `string` | No | — | Path to Ruff configuration file | ### Returns `RuffCICheckResult` ```json { "output": "[{\"code\": \"F401\", ...}]", "format": "json", "success": true } ``` ``` -------------------------------- ### analyze-code Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/docs/tools.md Runs Ruff, ty, and Vulture together and returns a combined quality score. Accepts Python source code and optional configuration parameters. ```APIDOC ## `analyze-code` ### Description Runs Ruff, ty, and Vulture together and returns a combined quality score. Accepts Python source code and optional configuration parameters. ### Parameters | Name | Type | Required | Default | Description | |------|------|----------|---------|-------------| | `code` | `string` | Yes | — | Python source code | | `ruff_config_path` | `string` | No | — | Path to Ruff configuration file | | `min_confidence` | `integer` | No | `80` | Vulture minimum confidence | | `project_path` | `string` | No | — | ty project directory | ### Returns `AnalysisResult` ```json { "ruff_result": { ... }, "ty_result": { ... }, "vulture_result": { ... }, "summary": { "total_ruff_issues": 2, "fixable_ruff_issues": 1, "total_ty_diagnostics": 0, "ty_error_count": 0, "ty_warning_count": 0, "total_unused_items": 1, "high_confidence_unused": 1, "code_quality_score": 83 } } ``` ### Quality Score Formula | Deduction | Condition | |-----------|-----------| | -2 pts per Ruff issue | capped at -50 | | -10 pts per ty error | combined cap at -40 | | -5 pts per ty warning | combined cap at -40 | | -5 pts per high-confidence unused item | capped at -30 | | -2 pts per low-confidence unused item | capped at -20 | Score is clamped to `[0, 100]`. ``` -------------------------------- ### ruff-format Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/docs/tools.md Format Python code using Ruff's fast formatter (Black-compatible). Accepts Python source code and returns the formatted code. ```APIDOC ## `ruff-format` ### Description Format Python code using Ruff's fast formatter (Black-compatible). ### Parameters | Name | Type | Required | Description | |------|------|----------|-------------| | `code` | `string` | Yes | Python source code to format | | `config_path` | `string` | No | Path to Ruff configuration file | ### Returns `RuffFormatResult` ```json { "formatted_code": "def hello():\n print(\"world\")\n", "changed": true } ``` ``` -------------------------------- ### Ruff custom config via MCP tool call Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/docs/configuration.md Pass a `config_path` to any `ruff-*` tool to use a custom configuration. Ruff auto-discovers `pyproject.toml` / `ruff.toml` / `.ruff.toml` from the directory of the analyzed file upward, but since analysis runs against a temporary file the auto-discovery will typically use the server's working directory. ```json { "name": "ruff-check", "arguments": { "code": "...", "config_path": "/path/to/ruff.toml" } } ``` -------------------------------- ### Vulture min_confidence via MCP tool call Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/docs/configuration.md Confidence threshold is set per-call via `min_confidence` (default `80`). Vulture also reads `[tool.vulture]` from `pyproject.toml` if one exists in the server's working directory. ```json { "name": "vulture-scan", "arguments": { "code": "...", "min_confidence": 60 } } ``` -------------------------------- ### ty-check Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/docs/tools.md Type-check Python code using the ty tool. Accepts Python source code and an optional project path for configuration and import resolution, returning a TyCheckResult with diagnostics. ```APIDOC ## `ty-check` ### Description Type-check Python code using [ty](https://docs.astral.sh/ty/). ### Parameters | Name | Type | Required | Description | |------|------|----------|-------------| | `code` | `string` | Yes | Python source code to type-check | | `project_path` | `string` | No | Directory used for ty config and import resolution (defaults to cwd) | ### Returns `TyCheckResult` ```json { "diagnostics": [ { "line": 5, "column": 10, "rule": "invalid-argument-type", "message": "Argument of type 'int' cannot be assigned to parameter 'x' of type 'str'", "severity": "error" } ], "total_diagnostics": 1, "error_count": 1, "warning_count": 0 } ``` ``` -------------------------------- ### ruff-check Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/docs/tools.md Lint Python code using Ruff to identify style violations and potential errors. Accepts Python source code as a string and returns a structured result with issues. ```APIDOC ## `ruff-check` ### Description Lint Python code using Ruff to identify style violations and potential errors. ### Parameters | Name | Type | Required | Description | |------|------|----------|-------------| | `code` | `string` | Yes | Python source code to analyze | | `config_path` | `string` | No | Path to a `ruff.toml` or `pyproject.toml` with `[tool.ruff]` | ### Returns `RuffCheckResult` ```json { "issues": [ { "line": 3, "column": 1, "end_line": 3, "end_column": 7, "rule": "F401", "message": "'os' imported but unused", "severity": "error", "fixable": true } ], "total_issues": 1, "fixable_issues": 1 } ``` ``` -------------------------------- ### biome-format Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/docs/tools.md Formats JavaScript/TypeScript code using Biome. Accepts source code and an optional virtual filename to control parser selection. ```APIDOC ## `biome-format` ### Description Formats JavaScript/TypeScript code using Biome. Accepts source code and an optional virtual filename to control parser selection. ### Parameters | Name | Type | Required | Default | Description | |------|------|----------|---------|-------------| | `code` | `string` | Yes | — | JS/TS source code to format | | `filename` | `string` | No | `"code.ts"` | Virtual filename — controls parser selection | ### Returns `BiomeFormatResult` ```json { "formatted_code": "const x = 1;\n", "changed": true } ``` ``` -------------------------------- ### vulture-scan Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/docs/tools.md Detect unused/dead code using Vulture. Accepts Python source code and an optional minimum confidence threshold, returning a VultureScanResult with unused items. ```APIDOC ## `vulture-scan` ### Description Detect unused/dead code using [Vulture](https://github.com/jendrikseipp/vulture). ### Parameters | Name | Type | Required | Default | Description | |------|------|----------|---------|-------------| | `code` | `string` | Yes | — | Python source code | | `min_confidence` | `integer` | No | `80` | Minimum confidence threshold (0-100) | ### Returns `VultureScanResult` ```json { "unused_items": [ { "name": "unused_helper", "type": "function", "line": 12, "column": 0, "confidence": 100, "message": "unused function 'unused_helper'" } ], "total_items": 1, "high_confidence_items": 1 } ``` ``` -------------------------------- ### analyze-code return value (AnalysisResult) Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/docs/tools.md JSON structure returned by the analyze-code tool, combining results from Ruff, ty, and Vulture. Includes a summary with issue counts and a code quality score. ```json { "ruff_result": { ... }, "ty_result": { ... }, "vulture_result": { ... }, "summary": { "total_ruff_issues": 2, "fixable_ruff_issues": 1, "total_ty_diagnostics": 0, "ty_error_count": 0, "ty_warning_count": 0, "total_unused_items": 1, "high_confidence_unused": 1, "code_quality_score": 83 } } ``` -------------------------------- ### biome-format return value (BiomeFormatResult) Source: https://github.com/anselmoo/mcp-server-analyzer/blob/main/docs/tools.md JSON structure returned by the biome-format tool after formatting JavaScript/TypeScript code. Contains the formatted code and a boolean indicating whether changes were made. ```json { "formatted_code": "const x = 1;\n", "changed": true } ```