Contributing to OpenSIPS MCP Server
April 28, 2026 ยท View on GitHub
Thank you for considering a contribution to the OpenSIPS MCP Server. This guide covers the development workflow, coding standards, and pull request process.
Development Setup
- Clone the repository and create a virtual environment:
git clone https://github.com/your-org/opensips-mcp-server.git
cd opensips-mcp-server
python -m venv .venv
source .venv/bin/activate
- Install in development mode with all extras:
pip install -e ".[dev]"
- Copy the example environment file and adjust values as needed:
cp .env.example .env
Running Tests
Run the full test suite:
make test
Run only unit tests (no external dependencies required):
make test-unit
Run integration tests (requires a running OpenSIPS and database):
make test-int
Code Style
This project enforces consistent style through tooling:
- Linter: Ruff with rules E, F, I, N, W, UP, B, SIM enabled.
- Formatter: Ruff formatter with a 100-character line length.
- Type checking: mypy in strict mode with the Pydantic plugin.
- Target version: Python 3.10+.
Run the linter and formatter before submitting:
make lint
make format
make type-check
Guidelines
- Add type hints to all function signatures and return types.
- Write docstrings for all public functions, classes, and modules.
- Keep imports organized: standard library, third-party, then local (ruff handles this via
isortrules). - Use
async/awaitfor all I/O-bound operations.
Adding New MCP Tools
- Create a new file in
src/opensips_mcp/tools/or add to an existing module. - Import and use the shared
mcpinstance fromopensips_mcp.server. - Decorate with
@mcp.tool()and apply RBAC via@require_permission("scope"). - Register the import in
src/opensips_mcp/server.py. - Add unit tests in
tests/unit/.
Adding New Templates
- Add the
.cfg.j2file undersrc/opensips_mcp/cfg/templates/scenarios/(for full scenarios) orpartials/(for reusable fragments). - Register the scenario metadata in
src/opensips_mcp/cfg/builder.pyin theSCENARIOSdict. - Add default parameters in
scripts/validate_all_templates.py. - Run
python scripts/validate_all_templates.pyto verify rendering.
Pull Request Process
-
Create a feature branch from
main:git checkout -b feature/my-feature -
Make your changes, ensuring tests pass and linting is clean.
-
Write a clear PR description explaining what changed and why.
-
PRs require at least one approval before merging.
-
Squash-merge is preferred for a clean commit history.
Reporting Issues
Open an issue on GitHub with:
- A clear description of the problem or feature request.
- Steps to reproduce (for bugs).
- OpenSIPS version and MCP server version.
- Relevant logs or error messages.
License
By contributing, you agree that your contributions will be licensed under the Apache License 2.0.