refactor: make gitea a self-contained Cline skill
Relocate the script into the skill (skills/gitea/scripts/gitea_mcp.py) and add a PEP 723 dependency block, so `uv run scripts/gitea_mcp.py` provisions deps with no install step and the skill folder is portable (drop into ~/.cline/skills/). Drop the non-standard `metadata` frontmatter — Cline only recognizes name + description. - .mcp.json points at the relocated script and runs with --no-project (PEP 723) - SKILL.md uses relative scripts/ paths; metadata block removed - find_config walks up the tree to locate config.json (skill root or plugin root) - tests import gitea_mcp via pytest pythonpath; README/CLAUDE paths updated Tests: 119 passed, 92% coverage. Standalone list-tools verified via uv --no-project.
This commit is contained in:
@@ -2,14 +2,14 @@
|
||||
|
||||
## Project overview
|
||||
|
||||
Gitea REST API exposed as 66 tools from a single source file: `server/gitea_mcp.py`.
|
||||
Gitea REST API exposed as 66 tools from a single source file: `skills/gitea/scripts/gitea_mcp.py`.
|
||||
Config in `config.json` (gitignored).
|
||||
|
||||
**Dual-mode — one file, two entrypoints over the same tool functions:**
|
||||
|
||||
- **MCP server:** no subcommand → `mcp.run()`. Launched by `.mcp.json`
|
||||
(`uv run server/gitea_mcp.py --config config.json`). Tools = `mcp__gitea__<tool>`.
|
||||
- **CLI skill:** `uv run server/gitea_mcp.py <tool> --flags` → one JSON object on
|
||||
(`uv run skills/gitea/scripts/gitea_mcp.py --config config.json`). Tools = `mcp__gitea__<tool>`.
|
||||
- **CLI skill:** `uv run skills/gitea/scripts/gitea_mcp.py <tool> --flags` → one JSON object on
|
||||
stdout (`{"success", "data"|"error"}`). Powers the `skills/gitea` Cline skill.
|
||||
|
||||
The split lives at the bottom of the file: every tool is registered in the `TOOLS`
|
||||
@@ -118,7 +118,7 @@ For every tool function, write at minimum:
|
||||
```python
|
||||
# Example pattern
|
||||
import respx, httpx, pytest
|
||||
from server.gitea_mcp import get_commit
|
||||
from gitea_mcp import get_commit
|
||||
|
||||
@respx.mock
|
||||
def test_get_commit_happy_path():
|
||||
@@ -142,7 +142,7 @@ def test_get_commit_api_error():
|
||||
|
||||
```python
|
||||
# tests/smoke/test_registration.py
|
||||
from server.gitea_mcp import mcp
|
||||
from gitea_mcp import mcp
|
||||
|
||||
EXPECTED_TOOL_COUNT = 66 # update when adding tools
|
||||
|
||||
@@ -161,7 +161,7 @@ the README table, the smoke test catches it.
|
||||
uv run pytest
|
||||
|
||||
# With coverage
|
||||
uv run pytest --cov=server --cov-report=term-missing
|
||||
uv run pytest --cov=gitea_mcp --cov-report=term-missing
|
||||
|
||||
# Smoke only
|
||||
uv run pytest tests/smoke/
|
||||
@@ -172,7 +172,7 @@ uv run pytest tests/unit/test_commits.py -v
|
||||
|
||||
### Coverage target
|
||||
|
||||
- **Unit tests**: 90 % line coverage on `server/gitea_mcp.py`
|
||||
- **Unit tests**: 90 % line coverage on `skills/gitea/scripts/gitea_mcp.py`
|
||||
- **Smoke tests**: 100 % tool registration (no gaps)
|
||||
- Integration tests are opt-in (require `GITEA_TEST_URL` + `GITEA_TEST_TOKEN` env vars)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user