Skip to content

[15] Dynamic plugin architecture #44

Description

@rfunix

Problem

Adding new tools requires modifying core Tengu code. There is no way for the community to distribute tools as independent pip packages.

Implementation Steps

  1. Create `src/tengu/plugins/`:
    • `interface.py` — `TenguPlugin` Protocol with `name`, `version`, `tools`, `register(mcp)`
    • `loader.py` — Discovers plugins via `importlib.metadata.entry_points(group="tengu.plugins")` and local paths
    • `validator.py` — Validates plugin safety (no `shell=True`, required metadata present)
  2. Add `[plugins]` section to `tengu.toml` config
  3. Add `PluginsConfig` to `src/tengu/config.py`
  4. Update `src/tengu/tools/registry.py` to also discover plugin tools
  5. Create example plugin in `examples/tengu-plugin-example/` with proper `pyproject.toml` `[project.entry-points]`
  6. Write tests

Plugin Interface

```python
class TenguPlugin(Protocol):
name: str
version: str
tools: list[callable] # List of @tengu_tool decorated functions

def register(self, mcp) -> None: ...

```

Files to Modify

  • New: `src/tengu/plugins/init.py`, `interface.py`, `loader.py`, `validator.py`
  • `src/tengu/tools/registry.py`
  • `src/tengu/config.py`
  • New: `examples/tengu-plugin-example/`

Dependencies

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:infraInfrastructure and Dockerarea:toolsPentesting tools wrapperseffort:XLExtra-large effort (> 4 weeks)priority:P1High priority

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions