Development GuideΒΆ
This guide covers how to set up a development environment and contribute to Shepherd MCP.
SetupΒΆ
Clone the repository:
git clone https://github.com/neuralis/shepherd-mcp
cd shepherd-mcp
Create a virtual environment and install dependencies:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -e ".[dev]"
Running TestsΒΆ
Run the test suite with pytest:
pytest
Run with coverage:
pytest --cov=shepherd_mcp
Running LocallyΒΆ
Set up your environment variables:
export AIOBS_API_KEY=aiobs_sk_xxxx
export LANGFUSE_PUBLIC_KEY=pk-lf-xxxx
export LANGFUSE_SECRET_KEY=sk-lf-xxxx
Run the MCP server:
python -m shepherd_mcp
Code StyleΒΆ
This project uses ruff for linting and formatting:
# Check for issues
ruff check .
# Auto-fix issues
ruff check --fix .
# Format code
ruff format .
Project StructureΒΆ
src/shepherd_mcp/
βββ __init__.py # Package exports
βββ __main__.py # Entry point
βββ server.py # MCP server with tool handlers
βββ models/ # Data models
β βββ __init__.py
β βββ aiobs.py # AIOBS-specific models
β βββ langfuse.py # Langfuse-specific models
βββ providers/ # Provider clients
βββ __init__.py
βββ base.py # Base provider interface
βββ aiobs.py # AIOBS client implementation
βββ langfuse.py # Langfuse client implementation
ArchitectureΒΆ
βββββββββββββββββββ stdio βββββββββββββββββββ
β Cursor/Claude β ββββββββββββββΊ β shepherd-mcp β
β (Client) β stdin/stdout β (subprocess) β
βββββββββββββββββββ ββββββββββ¬βββββββββ
β HTTPS
βββββββββββ΄ββββββββββ
β β
βΌ βΌ
βββββββββββββββ βββββββββββββββ
β Shepherd APIβ β Langfuse APIβ
β (AIOBS) β β (Cloud) β
βββββββββββββββ βββββββββββββββ
Building DocumentationΒΆ
Build the Sphinx documentation:
cd docs
make html
The built documentation will be in docs/_build/html/.
Publishing to PyPIΒΆ
Releases are automatically published to PyPI via GitHub Actions when a release is created.
To publish manually:
# Build the package
pip install build twine
python -m build
# Upload to PyPI
twine upload dist/*
Adding a New ProviderΒΆ
To add support for a new observability provider:
Create a new models file in
src/shepherd_mcp/models/with your data modelsCreate a new provider client in
src/shepherd_mcp/providers/inheriting fromBaseProviderAdd tool definitions in
server.pyunderlist_tools()Add tool handlers in
server.pyundercall_tool()Update the provider exports in
providers/__init__.pyAdd tests in
tests/
Example provider skeleton:
from shepherd_mcp.providers.base import BaseProvider, AuthenticationError
class MyProvider(BaseProvider):
def __init__(self, api_key: str | None = None):
self.api_key = api_key or os.environ.get("MY_PROVIDER_API_KEY")
if not self.api_key:
raise AuthenticationError("No API key provided")
# Initialize HTTP client, etc.
@property
def name(self) -> str:
return "my_provider"
def list_sessions(self):
# Implement session listing
pass
def close(self) -> None:
# Clean up resources
pass
ContributingΒΆ
Fork the repository
Create a feature branch:
git checkout -b feature/my-featureMake your changes
Run tests:
pytestRun linting:
ruff check .Commit your changes:
git commit -am 'Add my feature'Push to the branch:
git push origin feature/my-featureCreate a Pull Request