|
1 | 1 | # Contributing
|
2 | 2 |
|
3 |
| -We welcome contributions to mcp-agent framework! |
| 3 | +We welcome **all** kinds of contributions - bug fixes, big features, docs, examples and more. _You don't need to be an AI expert |
| 4 | +or even a Python developer to help out._ |
4 | 5 |
|
5 |
| -## Guidelines |
| 6 | +## Checklist |
6 | 7 |
|
7 |
| -- **Pull Requests**: Fork the repo, create a feature branch, and submit a PR. Please add tests for new features in `tests/`. |
8 |
| -- **Code Style**: Use `ruff` for formatting Python code. Follow PEP 8 conventions. |
9 |
| -- **Plugins & Recipes**: Implement as separate packages and expose them via entry points. See `plugins_loader.py` for how we discover plugins. |
10 |
| -- **Testing**: Run `pytest` in the `tests/` directory. Ensure all tests pass before submitting a PR. |
11 |
| -- **Documentation**: Add docstrings and comments where appropriate. Keep code clear and modular. |
| 8 | +Contributions are made through |
| 9 | +[pull requests](https://help.github.com/articles/using-pull-requests/). |
12 | 10 |
|
13 |
| -Thank you for contributing! |
| 11 | +Before sending a pull request, make sure to do the following: |
| 12 | + |
| 13 | +- Fork the repo, and create a feature branch prefixed with `feature/` |
| 14 | +- [Lint, typecheck, and format](#lint-typecheck-format) your code |
| 15 | +- [Add examples](#examples) |
| 16 | + |
| 17 | +_Please reach out to the mcp-agent maintainers before starting work on a large |
| 18 | +contribution._ Get in touch at |
| 19 | +[GitHub issues](https://github.com/lastmile-ai/mcp-agent/issues) |
| 20 | +or [on Discord](https://lmai.link/discord/mcp-agent). |
| 21 | + |
| 22 | +## Prerequisites |
| 23 | + |
| 24 | +To build mcp-agent, you'll need the following installed: |
| 25 | + |
| 26 | +- Install [uv](https://docs.astral.sh/uv/), which we use for Python package management |
| 27 | +- Install [Python](https://www.python.org/) >= 3.10. (You may already it installed. To see your version, use `python -V` at the command line.) |
| 28 | + |
| 29 | + If you don't, install it using `uv python install 3.10` |
| 30 | + |
| 31 | +- Install dev dependencies using `uv sync --dev` |
| 32 | + |
| 33 | +## Scripts |
| 34 | + |
| 35 | +There are several useful scripts in the `scripts/` directory that can be invoked via `uv run scripts/<script>.py [ARGS]` |
| 36 | + |
| 37 | +### promptify.py |
| 38 | + |
| 39 | +Bundles the mcp-agent repo into a single `project_contents.md` so you can use it as a prompt for LLMs to help you develop. |
| 40 | +Use `-i REGEX` to include only specific files, and `-x REGEX` to exclude certain files. |
| 41 | + |
| 42 | +Example: |
| 43 | + |
| 44 | +```bash |
| 45 | +uv run scripts/promptify.py -i "**/agents/**" -i "**/context.py" -x "**/app.py" |
| 46 | +``` |
| 47 | + |
| 48 | +### example.py |
| 49 | + |
| 50 | +This script lets you run any example in the `examples/` directory in debug mode. It configures the venv for the example, |
| 51 | +installs its dependencies from `requirements.txt`, and runs the example. |
| 52 | + |
| 53 | +To run: |
| 54 | + |
| 55 | +```bash |
| 56 | +uv run scripts/example.py run <example_name> --debug |
| 57 | +``` |
| 58 | + |
| 59 | +To clean: |
| 60 | + |
| 61 | +```bash |
| 62 | +uv run scripts/example.py clean <example_name> |
| 63 | +``` |
| 64 | + |
| 65 | +Example usage to run `examples/workflow_orchestrator_worker`: |
| 66 | + |
| 67 | +```bash |
| 68 | +uv run scripts/example.py run workflow_orchestrator_worker --debug |
| 69 | +``` |
| 70 | + |
| 71 | +## Lint, Typecheck, Format |
| 72 | + |
| 73 | +Lint and format is run as part of the precommit hook defined in [.pre-commit-config.yaml](./.pre-commit-config.yaml). |
| 74 | + |
| 75 | +**Lint** |
| 76 | + |
| 77 | +```bash |
| 78 | +uv run scripts/lint.py --fix |
| 79 | +``` |
| 80 | + |
| 81 | +**Format** |
| 82 | + |
| 83 | +```bash |
| 84 | +uv run scripts/format.py |
| 85 | +``` |
| 86 | + |
| 87 | +## Examples |
| 88 | + |
| 89 | +We use the examples for end-to-end testing. We'd love for you to add Python unit tests for new functionality going forward. |
| 90 | + |
| 91 | +At minimum, for any new feature or provider integration (e.g. additional LLM support), you should add example usage in the [`examples`](./examples/) directory. |
| 92 | + |
| 93 | +## Editor settings |
| 94 | + |
| 95 | +If you use vscode, you might find the following `settings.json` useful. We've added them to the [.vscode](./.vscode) directory along with recommended extensions |
| 96 | + |
| 97 | +```json |
| 98 | +{ |
| 99 | + "editor.formatOnSave": true, |
| 100 | + "editor.defaultFormatter": "esbenp.prettier-vscode", |
| 101 | + "[python]": { |
| 102 | + "editor.defaultFormatter": "charliermarsh.ruff", |
| 103 | + "editor.formatOnSave": true, |
| 104 | + "editor.rulers": [] |
| 105 | + }, |
| 106 | + "yaml.schemas": { |
| 107 | + "https://raw.githubusercontent.com/lastmile-ai/mcp-agent/main/schema/mcp-agent.config.schema.json": [ |
| 108 | + "mcp-agent.config.yaml", |
| 109 | + "mcp_agent.config.yaml", |
| 110 | + "mcp-agent.secrets.yaml", |
| 111 | + "mcp_agent.secrets.yaml" |
| 112 | + ] |
| 113 | + } |
| 114 | +} |
| 115 | +``` |
| 116 | + |
| 117 | +## Thank you |
| 118 | + |
| 119 | +If you are considering contributing, or have already done so, **thank you**. This project is meant to streamline AI application development, and we need all the help we can get! Happy building. |
0 commit comments