Repository navigation
feat: mcp-server-basti — privater stdio-MCP-Server mit 3 Tools #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
8a2f9d1
feat: mcp-server-basti — privater stdio-MCP-Server mit 3 Tools
Toqsick 2b1d692
fix: ToolError statt ToolResult für echte isError=True auf der Wire
Toqsick c029f95
Merge remote-tracking branch 'origin/main' into feat/mcp-server-basti
Copilot 3dbcb64
Potential fix for pull request finding
Toqsick 78d7ad2
Potential fix for pull request finding
Toqsick b3f7868
Potential fix for pull request finding
Toqsick f654db7
Potential fix for pull request finding
Toqsick fc6518c
Potential fix for pull request finding
Toqsick 65731e6
Potential fix for pull request finding
Toqsick File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
| branches: [main] | ||
|
|
||
| # Erlaubt gleichzeitige CI-Runs pro Branch (keine Auto-Cancellation). | ||
| concurrency: | ||
| group: ci-${{ github.ref }} | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| # --- 1) Lint: ruff auf den Source-Code ------------------------------------- | ||
| lint: | ||
| name: Lint (ruff) | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Repo auschecken | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Python 3.11 einrichten | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.11' | ||
|
|
||
| - name: ruff installieren | ||
| run: pip install ruff | ||
|
|
||
| - name: ruff auf src/ ausführen | ||
| run: ruff check src/ | ||
|
|
||
| # --- 2) Tests: Unit + Integration via pytest ------------------------------- | ||
| test: | ||
| name: Tests (pytest) | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Repo auschecken | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: uv einrichten | ||
| uses: astral-sh/setup-uv@v3 | ||
| with: | ||
| version: latest | ||
|
|
||
| - name: Python 3.11 (über uv) einrichten | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.11' | ||
|
|
||
| - name: Dependencies installieren (inkl. Test-Extras) | ||
| run: uv sync --all-extras | ||
|
|
||
| - name: pytest ausführen (unit + integration) | ||
| # PYTHONPATH leeren, um Interpreter-Hijacking durch System-Venvs zu verhindern. | ||
| run: env -u PYTHONPATH uv run pytest tests/unit tests/integration -v | ||
|
|
||
| # --- 3) Build: uv build + Wheel-Artefakt-Upload --------------------------- | ||
| build: | ||
| name: Build (uv build) | ||
| needs: [lint, test] | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Repo auschecken | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: uv einrichten | ||
| uses: astral-sh/setup-uv@v3 | ||
| with: | ||
| version: latest | ||
|
|
||
| - name: Python 3.11 (über uv) einrichten | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: '3.11' | ||
|
|
||
| - name: Dependencies synchronisieren | ||
| run: uv sync | ||
|
|
||
| - name: Wheel & Sdist bauen | ||
| run: uv build | ||
|
|
||
| - name: Wheel installieren und Smoke-Test | ||
| # H4-Fix: Das gebaute Wheel wird tatsächlich installiert und der | ||
| # Entry-Point getestet — nicht nur gebaut und weggelegt. | ||
| run: | | ||
| uv pip install dist/*.whl --system | ||
| python -c "from mcp_server_basti.server import mcp; assert mcp.name == 'mcp-server-basti'" | ||
| mcp-server-basti --help || true | ||
|
|
||
| - name: Build-Artefakte hochladen | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: mcp-server-basti-wheel | ||
| path: dist/ | ||
| if-no-files-found: error | ||
| retention-days: 14 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| # Tool Reference — mcp-server-basti | ||
|
|
||
| ## Tools | ||
|
|
||
| | Tool | Parameter | Rückgabetyp | Beschreibung | Side-Effect | | ||
| |------|-----------|-------------|--------------|-------------| | ||
| | `get_system_status` | keine | `str` (uptime-Output) | Führt `uptime` aus und gibt den stdout zurück. | read (Subprocess, keine Mutation) | | ||
| | `echo_tool` | `text: str` (required) | `str` | Gibt den übergebenen Text unverändert zurück. Health-Check-Tool. | none | | ||
| | `get_repo_info` | keine | `str` | Git-Branch und letzter Commit des Server-Repos (`DEFAULT_REPO_PATH`). | read (git-Subprocess, keine Mutation) | | ||
|
|
||
| ## Beispiele | ||
|
|
||
| ### get_system_status | ||
|
|
||
| **Input:** keine Parameter | ||
|
|
||
| **Output (beispielhaft, Linux):** | ||
| ``` | ||
| 04:24:40 up 2:46, 1 user, load average: 9,64, 8,19, 6,85 | ||
| ``` | ||
|
|
||
| > Format hängt vom Betriebssystem ab. Der Server gibt den rohen `uptime`-stdout zurück ohne weitere Formatierung. | ||
|
|
||
| **Fehlerfall:** Wenn `uptime` nicht gefunden wird oder mit Exit-Code ≠ 0 terminiert, gibt das Tool einen strukturierten Fehler zurück (`isError: true`). | ||
|
|
||
| ### echo_tool | ||
|
|
||
| **Input:** | ||
| ```json | ||
| {"text": "hello"} | ||
| ``` | ||
|
|
||
| **Output:** | ||
| ``` | ||
| hello | ||
| ``` | ||
|
|
||
| **Fehlerfall:** FastMCP validiert via Pydantic, dass `text` ein String ist. Fehlt der Parameter → `McpError` auf Client-Seite. | ||
|
|
||
| ### get_repo_info | ||
|
|
||
| **Input:** keine Parameter | ||
|
|
||
| **Output (beispielhaft):** | ||
| ``` | ||
| Branch: main | ||
| Letzter Commit: 634ff36 Merge pull request #1 from Toqsick/integrate/zcode-routing | ||
| ``` | ||
|
|
||
| > Das Tool ruft `git rev-parse --abbrev-ref HEAD` und `git log -1 --oneline` für das Server-Repo (`DEFAULT_REPO_PATH` in `server.py`) auf. Es liefert **nur** Branch und Commit — kein Remote, keine Tags. | ||
|
|
||
| **Fehlerfall:** Wenn das Verzeichnis kein Git-Repo ist oder `git` fehlschlägt, gibt das Tool einen strukturierten Fehler zurück (`isError: true`). | ||
|
|
||
| ## Fehlerformat | ||
|
|
||
| Tool-Errors nutzen `fastmcp.tools.base.ToolResult` mit `is_error=True`: | ||
|
|
||
| ```json | ||
| { | ||
| "isError": true, | ||
| "content": [{"type": "text", "text": "Systemstatus konnte nicht ermittelt werden: ..."}] | ||
| } | ||
| ``` | ||
|
|
||
| ## skill-mcp-router Integration | ||
|
|
||
| Der Server ist für die Integration mit dem bestehenden `skill-mcp-router` vorbereitet, aber **noch nicht aktiv verdrahtet**. Die `routing/registry/registry.json` hat ein `mcp_server`-Feld pro Skill, in das `"mcp-server-basti"` eingetragen werden kann, um Skill-Intents zu diesen Tools aufzulösen. | ||
|
|
||
| **Status:** Derzeit nutzt kein Skill in der Registry den Server `mcp-server-basti`. Um ihn zu aktivieren, müssten Skills mit passenden Intents angelegt und in der Registry registriert werden. Siehe `routing/registry/registry.json` für das Format. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.