MCP server for source code analysis
Project description
optix-mcp-server-ravn
MCP server for source code analysis.
Installation
Option 1: Quick Install with Wizard (Recommended)
The easiest way to install Optix MCP Server is using the installation wizard.
Prerequisites
- macOS 12+ or Ubuntu 20.04+
- curl (pre-installed on most systems)
One-Command Install
# Install uv if not already installed
curl -LsSf https://astral.sh/uv/install.sh | sh
# Run the installation wizard
uvx --from optix-mcp-server-ravn optix install
The wizard will guide you through:
- Selecting AI agents to configure (Claude Code, Cursor, VS Code, Codex CLI, OpenCode)
- Choosing installation scope (global or local/project)
- Optional expert analysis setup (requires OpenAI API key)
- Optional dashboard configuration
- Optional Slack notifications setup (requires Slack Bot Token)
Wizard Options
| Flag | Description |
|---|---|
--agents <list> |
Comma-separated agents: claude,cursor,codex,vscode,opencode |
--scope <scope> |
Installation scope: global or local |
--expert |
Enable expert analysis feature |
--no-expert |
Disable expert analysis feature |
--quiet, -q |
Suppress non-essential output |
--verbose, -v |
Enable detailed output |
Examples
# Interactive mode (recommended for first-time users)
uvx --from optix-mcp-server-ravn optix install
# Non-interactive: Install for Claude Code only, global scope
uvx --from optix-mcp-server-ravn optix install --agents claude --scope global
# Enable expert analysis during installation
uvx --from optix-mcp-server-ravn optix install --expert
Verify Installation
# Check configuration status
uvx --from optix-mcp-server-ravn optix health
Option 2: Development Setup
For contributors or those who need to modify the source code.
Prerequisites
- Python 3.10 or higher (3.13.11 recommended via pyenv)
- pip or uv package manager
- Git
Clone and Setup Environment
# Clone repository
git clone <repository-url>
cd optix-mcp-server-ravn
# Setup Python version (if using pyenv)
pyenv install 3.13.11
pyenv local 3.13.11
# Create virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
Install Dependencies
# Install package with dev dependencies
pip install -e ".[dev]"
# Or with uv (recommended)
uv pip install -e ".[dev]"
Configure Environment (Optional)
For features requiring API keys (like security_audit tool with LLM expert analysis):
# Copy the example environment file
cp .env.example .env
# Edit .env and add your OpenAI API key
# Example:
# OPENAI_API_KEY=sk-...
The server automatically loads variables from .env file using python-dotenv.
Start Server
# Start with default settings (stdio transport)
python server.py
# Start with custom settings via environment variables
export SERVER_NAME=my-server
export LOG_LEVEL=DEBUG
python server.py
Quick Verification (Development)
Run this to verify your development setup is correct:
# 1. Check Python
python --version
# 2. Check dependencies
python -c "from mcp.server.fastmcp import FastMCP; print('MCP OK')"
# 3. Check tools
python -c "import server; from tools import get_available_tools; print(get_available_tools())"
# 4. Run tests
pytest tests/ -v --tb=short
Expected output: All tests pass, health_check in available tools list.
Environment Variables
Server Configuration
| Variable | Default | Description |
|---|---|---|
SERVER_NAME |
optix-mcp-server | Server name for MCP |
OPTIX_LOG_LEVEL |
INFO | Logging level (DEBUG, INFO, WARN) |
LOG_LEVEL |
INFO | Fallback logging level if OPTIX_LOG_LEVEL not set |
TRANSPORT |
stdio | Transport type (stdio, sse, http) |
DISABLED_TOOLS |
(empty) | Comma-separated list of tools to disable |
API Keys (Optional)
Required for specific features like LLM expert analysis in audit tools (security_audit, devops_audit, a11y_audit, principal_audit):
| Variable | Description |
|---|---|
OPENAI_API_KEY |
OpenAI API key for GPT models |
Expert Analysis Configuration
Optional settings for LLM-based expert validation of audit findings:
| Variable | Default | Description |
|---|---|---|
EXPERT_ANALYSIS_ENABLED |
false | Enable expert LLM analysis of audit findings |
EXPERT_ANALYSIS_TIMEOUT |
30 | Timeout for expert analysis in seconds |
EXPERT_ANALYSIS_MAX_FINDINGS |
50 | Maximum number of findings to analyze |
Note: Expert analysis requires EXPERT_ANALYSIS_ENABLED=true and a valid OPENAI_API_KEY. The expert analysis feature works with all audit tools (security_audit, devops_audit, a11y_audit, principal_audit) to provide LLM-validated assessments of findings, identify additional concerns, and prioritize remediation efforts.
Configuration via .env file (recommended):
- Copy
.env.exampleto.env - Add your API keys
- The server automatically loads
.envusingpython-dotenv
Slack Notifications Configuration
Optional settings for automatically sending audit findings to Slack channels:
| Variable | Default | Description |
|---|---|---|
SLACK_ENABLED |
false | Enable automatic Slack notifications for audit findings |
SLACK_BOT_TOKEN |
(empty) | Slack Bot User OAuth Token (starts with xoxb-) |
SLACK_CHANNEL_ID |
(empty) | Target Slack channel ID (e.g., C01ABCDEF23) |
SLACK_SEVERITY_FILTER |
all | Comma-separated severity levels: critical,high,medium,low,info |
Note: Slack notifications require:
- A Slack App created at https://api.slack.com/apps with
chat:writeandchat:write.publicscopes - Bot installed to your workspace with token generated
- Channel ID obtained from Slack (for private channels, bot must be invited)
When enabled, audit findings matching the severity filter are automatically sent to the configured Slack channel as formatted messages.
๐ For detailed setup instructions, see docs/SLACK_NOTIFICATIONS.md
Logging Configuration
Setting Log Level
Control logging verbosity via the OPTIX_LOG_LEVEL environment variable:
# In .env file or shell
export OPTIX_LOG_LEVEL=DEBUG # Most verbose - detailed execution info
export OPTIX_LOG_LEVEL=INFO # Default - summary info
export OPTIX_LOG_LEVEL=WARN # Warnings only
Log Output
Logs are written to:
- File:
logs/optix.log(for real-time monitoring) - Stderr: Always enabled for immediate feedback
Log format:
2026-01-18 10:30:45 - INFO - [security_audit] Step 1 completed: 3 findings
Real-Time Log Monitoring
Monitor logs in real-time while the server is running:
# All logs from all tools
./watch-logs.sh all
# Filter by specific tool
./watch-logs.sh security # security_audit only
./watch-logs.sh a11y # a11y_audit only
./watch-logs.sh devops # devops_audit only
./watch-logs.sh health # health_check only
Development Workflow
Running Tests
Note: Ensure the virtual environment is activated before running tests. If you see
ModuleNotFoundError: No module named 'mcp', runsource .venv/bin/activatefirst.
# Activate venv (if not already active)
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Full test suite
pytest tests/ -v
# Unit tests only (fast)
pytest tests/unit/ -v
# Integration tests only
pytest tests/integration/ -v
# Specific test file
pytest tests/unit/tools/test_health_check.py -v
Adding a New Tool
Tools in optix-mcp-server-ravn are MCP-agnostic, meaning they can be tested independently without MCP context.
-
Create tool directory:
tools/ โโโ my_tool/ โโโ __init__.py โโโ core.py # Business logic (no MCP imports) โโโ spec.md # Documentation -
Implement in
core.py(no MCP imports):def my_tool_impl(param: str) -> dict: """Pure business logic.""" return {"result": param.upper()}
-
Register in
server.py:from tools.my_tool.core import my_tool_impl from tools import register_tool @mcp.tool() def my_tool(param: str) -> str: return json.dumps(my_tool_impl(param)) register_tool("my_tool", impl=my_tool_impl, description="My tool description")
-
Add unit test in
tests/unit/tools/test_my_tool.py:from tools.my_tool.core import my_tool_impl def test_my_tool_impl(): result = my_tool_impl("hello") assert result["result"] == "HELLO"
Troubleshooting
Server won't start
- Check Python version:
python --version(needs 3.10+) - Verify dependencies:
pip list | grep mcp - Check configuration:
python -c "from config.defaults import ServerConfiguration; print(ServerConfiguration.from_env())"
Tests failing
- Ensure dev dependencies installed:
pip install -e ".[dev]"oruv pip install -e ".[dev]" - Check pytest version:
pytest --version(needs 7.0+) - Run single test for details:
pytest tests/unit/tools/test_health_check.py -v
Import errors
ModuleNotFoundError: No module named 'mcp'
- Virtual environment not activated. Run:
source .venv/bin/activate - Dependencies not installed. Run:
pip install -e ".[dev]"
Other import errors
- Ensure package is installed in editable mode:
pip install -e . - Check PYTHONPATH includes project root
- Verify
__init__.pyfiles exist in all packages
Configuration errors
If you see "server_name must be alphanumeric with hyphens allowed":
- Ensure
SERVER_NAMEenvironment variable uses only letters, numbers, and hyphens - Example valid names:
my-server,optix-mcp-server-ravn,server123
Project Structure
optix-mcp-server-ravn/
โโโ server.py # MCP server entry point
โโโ config/
โ โโโ defaults.py # Configuration classes
โโโ tools/
โ โโโ __init__.py # Tool registry
โ โโโ base.py # Tool Protocol interface
โ โโโ health_check/ # health_check tool
โ โโโ __init__.py
โ โโโ core.py # Business logic (MCP-agnostic)
โ โโโ spec.md # Tool specification
โโโ tests/
โโโ integration/ # Integration tests
โ โโโ conftest.py # Test fixtures
โ โโโ test_server_startup.py
โโโ unit/ # Unit tests
โโโ tools/
โโโ test_health_check.py
โโโ test_registry.py
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 optix_mcp_server_ravn-1.0.12.tar.gz.
File metadata
- Download URL: optix_mcp_server_ravn-1.0.12.tar.gz
- Upload date:
- Size: 433.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a535331f6b28a0633ccaae5f53c76070fd3e4f457050f5008c8e0a93cb020e00
|
|
| MD5 |
d43df914e69342430ab5fb02d89855b7
|
|
| BLAKE2b-256 |
14cfaca50d246cab5e87405117bd6344dfaaf0683836c01be1aed5334c923bec
|
Provenance
The following attestation bundles were made for optix_mcp_server_ravn-1.0.12.tar.gz:
Publisher:
publish.yml on ravnhq/ravn-labs-optix-2
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
optix_mcp_server_ravn-1.0.12.tar.gz -
Subject digest:
a535331f6b28a0633ccaae5f53c76070fd3e4f457050f5008c8e0a93cb020e00 - Sigstore transparency entry: 973362145
- Sigstore integration time:
-
Permalink:
ravnhq/ravn-labs-optix-2@7ada6cdc16d18055cb18b61fb0e0092c975f394e -
Branch / Tag:
refs/heads/release - Owner: https://github.com/ravnhq
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7ada6cdc16d18055cb18b61fb0e0092c975f394e -
Trigger Event:
push
-
Statement type:
File details
Details for the file optix_mcp_server_ravn-1.0.12-py3-none-any.whl.
File metadata
- Download URL: optix_mcp_server_ravn-1.0.12-py3-none-any.whl
- Upload date:
- Size: 425.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7628009323de0fb0e4bab3d1d71a7269c4c4856fa3c8eff7942f4a1581d945c9
|
|
| MD5 |
6c7bf826f3a71a26ace42c3627cf0b81
|
|
| BLAKE2b-256 |
7900e110f51cd0ded9aa3e9c227f1601c9a5d1d55d1f2fdd01c011c4faf16878
|
Provenance
The following attestation bundles were made for optix_mcp_server_ravn-1.0.12-py3-none-any.whl:
Publisher:
publish.yml on ravnhq/ravn-labs-optix-2
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
optix_mcp_server_ravn-1.0.12-py3-none-any.whl -
Subject digest:
7628009323de0fb0e4bab3d1d71a7269c4c4856fa3c8eff7942f4a1581d945c9 - Sigstore transparency entry: 973362149
- Sigstore integration time:
-
Permalink:
ravnhq/ravn-labs-optix-2@7ada6cdc16d18055cb18b61fb0e0092c975f394e -
Branch / Tag:
refs/heads/release - Owner: https://github.com/ravnhq
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@7ada6cdc16d18055cb18b61fb0e0092c975f394e -
Trigger Event:
push
-
Statement type: