agents/mcp/README.md
This directory contains Model Context Protocol (MCP) servers that expose Salt development tools to AI agents.
Model Context Protocol (MCP) is a standard for connecting AI assistants to external tools and data sources. MCP servers expose functionality that AI agents can discover and use.
Testing tools for Salt development:
See salt_test/README.md for details.
REQUIRED: The Salt repository needs two virtual environments:
cd /path/to/salt/repo
# Setup venv310
python3.10 -m venv venv310
source venv310/bin/activate
pip install --upgrade pip setuptools wheel
pip install -r requirements/static/pkg/py3.10/linux.txt # or darwin.txt / windows.txt
pip install -r requirements/pytest.txt
pip install -r requirements/static/ci/py3.10/tools.txt
pip install pre-commit python-tools-scripts
pip install -e .
deactivate
# Setup venv311 (for master branch testing + pre-commit)
python3.11 -m venv venv311
source venv311/bin/activate
pip install --upgrade pip setuptools wheel
pip install -r requirements/static/pkg/py3.11/linux.txt # or darwin.txt / windows.txt
pip install -r requirements/pytest.txt
pip install -r requirements/static/ci/py3.11/tools.txt
pip install pre-commit python-tools-scripts
pip install -e .
pre-commit install
deactivate
# Verify
./venv310/bin/python -m tools --help
See salt_test/README.md for detailed setup instructions.
pip install mcp
Add the servers to your Claude Code MCP configuration. The location depends on your setup:
For this repository (relative paths):
Create or edit ~/.config/claude-code/mcp_config.json:
{
"mcpServers": {
"salt-test": {
"command": "python3",
"args": ["-m", "agents.mcp.salt_test.server"],
"cwd": "/absolute/path/to/salt/repo",
"env": {
"PYTHONPATH": "/absolute/path/to/salt/repo"
}
}
}
}
Alternative (using absolute path to server):
{
"mcpServers": {
"salt-test": {
"command": "python3",
"args": ["/absolute/path/to/salt/repo/agents/mcp/salt_test/server.py"],
"cwd": "/absolute/path/to/salt/repo",
"env": {}
}
}
}
For accessing GitHub API to discover CI failures:
# Option 1: Set environment variable
export GITHUB_TOKEN="your_github_token"
# Option 2: Configure gh CLI
gh auth login
After configuration, restart Claude Code to load the MCP servers.
Once configured, you can verify the servers are loaded by asking Claude:
"What MCP tools are available?"
You should see the salt-test tools listed.
"Run tests/pytests/unit/test_loader.py with verbose output"
Claude will use pytest_run to execute the test locally.
"What tests are failing in PR #68562?"
Claude will use ci_pr_failures to analyze the PR's CI runs.
"Reproduce the test_version.py failure from PR #68562 on debian-11"
Claude will:
tools/testsuite/ (following existing patterns)tools/__init__.pysalt_test/server.py:
list_tools()call_tool()salt_test/README.md# Test the server directly
cd /path/to/salt/repo
python3 -m agents.mcp.salt_test.server
# Test with MCP inspector (if available)
mcp-inspector agents.mcp.salt_test.server
mcp package is installed: pip install mcptools/ infrastructure is working: python3 -m tools --helpdocker infoecho $GITHUB_TOKENdocker ps -a | grep salt-testls artifacts/agents/mcp/
├── salt_test/
│ ├── server.py # MCP server implementation
│ ├── README.md # Tool documentation
│ └── __init__.py
└── README.md # This file
tools/testsuite/ # Underlying CLI tools
├── pytest.py # Direct pytest execution
├── ci_failure.py # CI failure discovery
└── container_test.py # Container testing
The MCP servers are thin wrappers around the existing tools/ CLI infrastructure, ensuring consistency between CLI and AI agent usage.
When adding new testing capabilities:
tools/testsuite/ first (can be used standalone)