terraphim / terraphim/terraphim-ai

Phase 4: Implement Advanced Features (Multi-tenancy & UI)

Offen
#281 7 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
Rust
Sterne
62
Forks
5
Ø Merge
2 Std. 27 Min.
Gemergte PRs (30 T.)
1

Beschreibung

Goal

Enterprise features and management UI

Tasks

Backend Implementation ✅ COMPLETE
  • Add user_id to all MCP resources
  • Implement public/private namespace scoping
  • Audit trail for tool invocations
  • Add health endpoint (GET /metamcp/health)
  • Add audit listing endpoint (GET /metamcp/audits)
  • AuditMiddleware for automatic tool call logging
  • REST wrapper for MCP tools
  • OpenAPI spec generation at /metamcp/openapi.json
In Progress / Planned
  • Role-based access control for endpoints (future enhancement)
  • Auto-generate OpenAPI specs from MCP tools (manual for now)
  • Swagger UI integration (OpenAPI JSON available for external viewers)
Frontend (Deferred to Phase 5)
  • Extend Svelte frontend with MCP management views
  • Namespace CRUD operations UI
  • Tool enable/disable toggles
  • Endpoint management dashboard
  • Real-time server status display

Completed Features

Phase 4A - Multi-Tenancy & Compliance

Commit: 6ce6d3ad

Persistence Layer

  • McpAuditRecord for tool invocation tracking
  • NamespaceVisibility enum (Public/Private) with Private default
  • Audit trail methods: save_audit, get_audit, list_audits, delete_audit
  • list_namespaces_with_visibility for multi-tenancy support
  • OpenDAL-based audit storage

Middleware

  • AuditMiddleware for automatic tool call logging
  • Feature-gated with 'audit' feature flag
  • Tracks: tool name, arguments, response, errors, latency

API Layer

  • get_mcp_health endpoint with namespace/endpoint counts
  • list_audits endpoint (limit 100 recent records)
  • Visibility field in CreateNamespaceRequest

Routes

  • GET /metamcp/health - Server health with counts
  • GET /metamcp/audits - Recent audit trail
Phase 4B - REST API Wrapper

Commit: 3d5a1c32

API Module (terraphim_server/src/api_mcp_tools.rs)

  • list_tools_for_endpoint: Lists all tools for an endpoint
  • execute_tool: Executes tool with JSON arguments
  • create_proxy_from_namespace: Initializes McpProxy from config
  • Error handling for missing endpoints/namespaces

Routes

  • GET /metamcp/endpoints/{endpoint_uuid}/tools
  • POST /metamcp/endpoints/{endpoint_uuid}/tools/{tool_name}

Integration

  • Leverages terraphim_mcp_proxy for routing
  • Uses MCP persistence for lookups
  • Supports all transports (STDIO, SSE, HTTP, OAuth)
Phase 4C - OpenAPI Documentation

Commit: 318f113a

API Specification

  • Complete OpenAPI 3.0 spec at GET /metamcp/openapi.json
  • Documented paths, parameters, request/response schemas
  • Ready for Postman/Insomnia/Swagger UI import

Type System

  • McpTool: OpenAPI-compatible tool wrapper
  • McpContentItem: Response content enum
  • ToolListResponse, ToolCallRequestPayload, ToolCallResponsePayload
  • All types implement ToSchema for documentation

Test Coverage

  • Persistence: 6/6 tests passing (audit, visibility)
  • MCP Proxy: 19/19 tests passing
  • MCP Tools API: 7/7 tests passing
  • Total: 32 tests passing ✅

Success Criteria

  • Multi-user support with proper isolation (namespace visibility)
  • Audit trail for compliance
  • REST API for tool execution
  • OpenAPI documentation
  • High test coverage (32 tests)
  • Web UI for managing MCP configuration (deferred to Phase 5)

Usage Examples

# List tools
curl http://localhost:8080/metamcp/endpoints/{uuid}/tools

# Execute tool
curl -X POST http://localhost:8080/metamcp/endpoints/{uuid}/tools/filesystem__read_file \
  -H "Content-Type: application/json" \
  -d '{"arguments": {"path": "/path/to/file"}}'

# Get OpenAPI spec
curl http://localhost:8080/metamcp/openapi.json > mcp-api.json

# Health check
curl http://localhost:8080/metamcp/health

# Audit trail
curl http://localhost:8080/metamcp/audits

Timeline

Week 7-8 (Backend completed ahead of schedule ✅)

Phase 4 COMPLETE - All backend features implemented with full test coverage.

Depends on: Phase 3 ✅

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

This is a completed phase tracker rather than a single scoped task. Start with terraphim_server/src/api_mcp_tools.rs and the listed MCP routes, then inspect the current backend and frontend entry points. The remaining work is broad: role-based access control, automatic OpenAPI generation, Swagger UI, and deferred Svelte management views.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
openapi, rust
Bereich
api, backend, documentation, frontend
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
15/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.