diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md new file mode 100644 index 0000000..fc02d39 --- /dev/null +++ b/ARCHITECTURE.md @@ -0,0 +1,103 @@ +# RhinoMCP - Architektur + +## Übersicht + +```text +┌─────────────────────────────────────────────────────────┐ +│ Claude.ai / Claude Code │ +└──────────────────┬──────────────────────────────────────┘ + │ MCP Protocol (stdio) +┌──────────────────▼──────────────────────────────────────┐ +│ MCP-Server (Python) │ +│ src/mcp-server/server.py │ +│ - Tool-Definitionen │ +│ - Request/Response Handling │ +└──────────────────┬──────────────────────────────────────┘ + │ HTTP (localhost:9000) +┌──────────────────▼──────────────────────────────────────┐ +│ Rhino-Plugin (C# .rhp) │ +│ src/rhino-plugin/RhinoMCP/ │ +│ ├─ RhinoMcpPlugin.cs (Plugin-Einstieg) │ +│ ├─ HttpServer.cs (HTTP-Endpoint) │ +│ ├─ CommandHandler.cs (Rhino-Befehle) │ +│ ├─ GrasshopperHandler.cs(GH-Befehle) │ +│ └─ MeshTerrainHandler.cs(Mesh/GIS-Tools) │ +└─────────────────────────────────────────────────────────┘ +``` + +## Technische Details + +- **Rhino-Version**: Rhino 9 WIP +- **Framework**: .NET 7.0 +- **RhinoCommon/Grasshopper SDK**: 8.0.23304.9001 +- **HTTP-Server**: EmbedIO auf Port 9000 +- **MCP-Transport**: stdio + +## Verfügbare Tools + +### Rhino-Geometrie + +- `rhino_create_point`, `rhino_create_line`, `rhino_create_polyline` +- `rhino_create_circle`, `rhino_create_sphere`, `rhino_create_box` +- `rhino_create_surface`, `rhino_create_curve` +- `rhino_move`, `rhino_rotate`, `rhino_scale`, `rhino_copy` +- `rhino_boolean_union`, `rhino_boolean_difference`, `rhino_boolean_intersection` +- `rhino_export`, `rhino_run_command` + +### Grasshopper + +- `grasshopper_open_definition`, `grasshopper_get_definition_info` +- `grasshopper_add_component`, `grasshopper_connect_components` +- `grasshopper_add_slider`, `grasshopper_set_slider_value` +- `grasshopper_set_toggle_value`, `grasshopper_set_panel_text` +- `grasshopper_bake`, `grasshopper_save_definition`, `grasshopper_recompute` +- `grasshopper_delete_component`, `grasshopper_add_group` +- `grasshopper_add_scribble`, `grasshopper_rename_component` + +### Mesh/Terrain/GIS + +- `rhino_mesh_from_points`, `rhino_import_mesh`, `rhino_mesh_boolean` +- `rhino_terrain_contours`, `rhino_terrain_slope_analysis` +- `rhino_terrain_watershed`, `rhino_terrain_low_points` +- `rhino_create_drainage_line`, `rhino_create_road_surface` +- `rhino_import_geotiff`, `rhino_import_shapefile`, `rhino_import_xyz` +- `rhino_transform_coordinates`, `rhino_get_bounding_box` +- `rhino_create_grid`, `rhino_create_site_section`, `rhino_calculate_area_volume` + +## Projektstruktur + +```text +Rhino-MCP/ +├── CLAUDE.md # Arbeitsanweisungen (kurz!) +├── ARCHITECTURE.md # Diese Datei +├── HANDOVER.md # Session-Übergabe +├── README.md # Öffentliche Dokumentation +├── LICENSE # MIT Lizenz +├── install.bat # Windows-Installer +├── src/ +│ ├── mcp-server/ +│ │ ├── server.py +│ │ └── requirements.txt +│ └── rhino-plugin/ +│ └── RhinoMCP/ +│ ├── RhinoMCP.csproj +│ ├── RhinoMcpPlugin.cs +│ ├── HttpServer.cs +│ ├── CommandHandler.cs +│ ├── GrasshopperHandler.cs +│ └── MeshTerrainHandler.cs +└── docs/ +``` + +## HTTP-Request Format + +```json +{ + "action": "grasshopper_delete_component", + "params": { + "component_id": "guid-here" + } +} +``` + +**Wichtig**: Parameter müssen unter `"params"` sein, nicht im Root-Objekt! diff --git a/CLAUDE.md b/CLAUDE.md index 6e3aba0..81e950e 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1,139 +1,37 @@ -# RhinoMCP - Claude Code Projektdokumentation +# RhinoMCP - Arbeitsanweisungen -## Projektübersicht +**Nach Context-Komprimierung diese Datei lesen!** -RhinoMCP ist ein MCP (Model Context Protocol) Plugin, das Claude AI direkten Zugriff auf Rhino 3D und Grasshopper ermöglicht. Es wurde für Landschaftsarchitektur, Straßeninfrastruktur und Regenwassermanagement entwickelt. +## Kritische Regeln + +1. **85%-Regel**: Ab 85% Chat-Kapazität sofort dokumentieren und committen +2. **300-Zeilen-Regel**: Maximale Dateigröße pro Datei, bei Überschreitung aufteilen +3. **Params-Format**: HTTP-Requests an Rhino nutzen `"params": {...}` nicht Root-Level ## Architektur -```text -┌─────────────────────────────────────────────────────────┐ -│ Claude.ai / Claude Code │ -└──────────────────┬──────────────────────────────────────┘ - │ MCP Protocol (stdio) -┌──────────────────▼──────────────────────────────────────┐ -│ MCP-Server (Python) │ -│ src/mcp-server/server.py │ -│ - Tool-Definitionen │ -│ - Request/Response Handling │ -└──────────────────┬──────────────────────────────────────┘ - │ HTTP (localhost:9000) -┌──────────────────▼──────────────────────────────────────┐ -│ Rhino-Plugin (C# .rhp) │ -│ src/rhino-plugin/RhinoMCP/ │ -│ ├─ RhinoMcpPlugin.cs (Plugin-Einstieg) │ -│ ├─ HttpServer.cs (HTTP-Endpoint) │ -│ ├─ CommandHandler.cs (Rhino-Befehle) │ -│ ├─ GrasshopperHandler.cs(GH-Befehle) │ -│ └─ MeshTerrainHandler.cs(Mesh/GIS-Tools) │ -└─────────────────────────────────────────────────────────┘ -``` - -## Technische Details - -- **Rhino-Version**: Rhino 9 WIP -- **Framework**: .NET 7.0 -- **RhinoCommon/Grasshopper SDK**: 8.0.23304.9001 -- **HTTP-Server**: EmbedIO auf Port 9000 -- **MCP-Transport**: stdio - -## Verfügbare Tools - -### Rhino-Geometrie - -- `rhino_create_point`, `rhino_create_line`, `rhino_create_polyline` -- `rhino_create_circle`, `rhino_create_sphere`, `rhino_create_box` -- `rhino_create_surface`, `rhino_create_curve` -- `rhino_move`, `rhino_rotate`, `rhino_scale`, `rhino_copy` -- `rhino_boolean_union`, `rhino_boolean_difference`, `rhino_boolean_intersection` -- `rhino_export`, `rhino_run_command` - -### Grasshopper - -- `grasshopper_open_definition`, `grasshopper_get_definition_info` -- `grasshopper_add_component`, `grasshopper_connect_components` -- `grasshopper_add_slider`, `grasshopper_set_slider_value` -- `grasshopper_set_toggle_value`, `grasshopper_set_panel_text` -- `grasshopper_bake`, `grasshopper_save_definition`, `grasshopper_recompute` -- `grasshopper_delete_component`, `grasshopper_add_group` -- `grasshopper_add_scribble`, `grasshopper_rename_component` - -### Mesh/Terrain/GIS - -- `rhino_mesh_from_points`, `rhino_import_mesh`, `rhino_mesh_boolean` -- `rhino_terrain_contours`, `rhino_terrain_slope_analysis` -- `rhino_terrain_watershed`, `rhino_terrain_low_points` -- `rhino_create_drainage_line`, `rhino_create_road_surface` -- `rhino_import_geotiff`, `rhino_import_shapefile`, `rhino_import_xyz` -- `rhino_transform_coordinates`, `rhino_get_bounding_box` -- `rhino_create_grid`, `rhino_create_site_section`, `rhino_calculate_area_volume` - -## Installation - -1. Plugin bauen: `dotnet build --configuration Release` -2. `install.bat` ausführen oder manuell nach `%APPDATA%\McNeel\Rhinoceros\9.0\Plug-ins\RhinoMCP (1.0.0)\` kopieren -3. MCP-Server in Claude Code konfigurieren - -## Entwicklungsrichtlinien - -### Automatisches Commit bei Kapazitätswarnung - -**WICHTIG**: Ab 85% Chat-Kapazität muss automatisch: - -1. Aktueller Stand dokumentiert werden -2. Alle Änderungen committet werden -3. Zusammenfassung der offenen Aufgaben erstellt werden - -### Code-Struktur - -- **Maximale Dateigröße: 300 Zeilen pro Datei** -- Bei Überschreitung: Logisch aufteilen in separate Handler-Klassen - -### Aktuelle Aufteilungsempfehlungen - -| Datei | Zeilen | Status | Empfehlung | -| ---------------------- | ------ | -------- | --------------------------------------------------------- | -| CommandHandler.cs | ~683 | Zu groß | Aufteilen in GeometryHandler, TransformHandler | -| MeshTerrainHandler.cs | ~1509 | Zu groß | Aufteilen in MeshHandler, TerrainHandler, GISHandler, RoadHandler | -| GrasshopperHandler.cs | ~671 | Zu groß | Aufteilen in GH_ComponentHandler, GH_DocumentHandler | -| server.py | ~1185 | Zu groß | Tool-Definitionen in separate Module | - -## Changelog - -### 2025-12-29 - -- Initiale Entwicklung des RhinoMCP Plugins -- Implementiert: Rhino-Geometrie, Grasshopper-Integration, Mesh/Terrain-Tools -- Neue GH-Tools: `delete_component`, `add_group`, `add_scribble`, `rename_component` -- GIS-Tools: GeoTIFF, Shapefile, XYZ Import -- Terrain-Analyse: Konturlinien, Gefälle, Wasserscheiden - -## Offene Aufgaben - -- [ ] Code-Refactoring: Große Dateien aufteilen (max. 300 Zeilen) -- [ ] Unit-Tests implementieren -- [ ] Fehlerbehandlung verbessern -- [ ] Dokumentation erweitern - -## Projektstruktur +Siehe [ARCHITECTURE.md](ARCHITECTURE.md) für Details. ```text -Rhino-MCP/ -├── CLAUDE.md # Diese Dokumentation -├── README.md # Öffentliche Dokumentation -├── LICENSE # MIT Lizenz -├── install.bat # Windows-Installer -├── src/ -│ ├── mcp-server/ -│ │ ├── server.py # MCP-Server (TODO: aufteilen) -│ │ └── requirements.txt -│ └── rhino-plugin/ -│ └── RhinoMCP/ -│ ├── RhinoMCP.csproj -│ ├── RhinoMcpPlugin.cs -│ ├── HttpServer.cs -│ ├── CommandHandler.cs # TODO: aufteilen -│ ├── GrasshopperHandler.cs # TODO: aufteilen -│ └── MeshTerrainHandler.cs # TODO: aufteilen -└── docs/ # Zusätzliche Dokumentation +Claude <--MCP--> Python Server (server.py) <--HTTP:9000--> Rhino Plugin (C#) ``` + +## Offene Refactoring-Aufgaben + +| Datei | Zeilen | Aktion | +|-------|--------|--------| +| MeshTerrainHandler.cs | ~1509 | Aufteilen | +| server.py | ~1185 | Aufteilen | +| CommandHandler.cs | ~683 | Aufteilen | +| GrasshopperHandler.cs | ~671 | Aufteilen | + +## Build & Deploy + +```bash +cd src/rhino-plugin/RhinoMCP && dotnet build --configuration Release +# Dann install.bat ausführen oder manuell kopieren +``` + +## Handover + +Bei Session-Ende: Siehe [HANDOVER.md](HANDOVER.md) für aktuellen Stand. diff --git a/HANDOVER.md b/HANDOVER.md new file mode 100644 index 0000000..cbaf26a --- /dev/null +++ b/HANDOVER.md @@ -0,0 +1,33 @@ +# RhinoMCP - Session Handover + +## Letztes Update: 2025-12-29 + +## Aktueller Stand + +- Plugin funktioniert mit Rhino 9 WIP +- Alle GH-Tools (delete, group, scribble, rename) implementiert und getestet +- GIS-Tools (GeoTIFF, Shapefile, XYZ) implementiert +- Commit `873fba3` gepusht nach `git.artetui.de/admin/Rhino-MCP.git` + +## Nächste Aufgaben + +1. **Code-Refactoring** (Priorität hoch): + - MeshTerrainHandler.cs (~1509 Zeilen) aufteilen + - server.py (~1185 Zeilen) aufteilen + - CommandHandler.cs (~683 Zeilen) aufteilen + - GrasshopperHandler.cs (~671 Zeilen) aufteilen + +2. **Geplante Aufteilung**: + - MeshTerrainHandler → MeshHandler, TerrainHandler, GISHandler, RoadHandler + - server.py → tools_rhino.py, tools_grasshopper.py, tools_terrain.py + - CommandHandler → GeometryHandler, TransformHandler + - GrasshopperHandler → GH_ComponentHandler, GH_DocumentHandler + +## Bekannte Probleme + +- GeoTIFF-Import über Heightfield-Command funktioniert nicht immer automatisch +- Rhino muss geschlossen sein für Plugin-Rebuild (DLL-Lock) + +## Testdateien + +- `C:\Users\LarsMunkes\Downloads\MeshTerrainWorkflow.gh` - Terrain-Workflow mit Gruppen