diff --git a/gateway-proxy/user_dashboard_ui.py b/gateway-proxy/user_dashboard_ui.py new file mode 100644 index 0000000..d7df457 --- /dev/null +++ b/gateway-proxy/user_dashboard_ui.py @@ -0,0 +1,402 @@ +""" +Enhanced Dashboard with User Management UI +=========================================== +Provides a comprehensive web interface for managing users and API keys. +Vue 3 compatible. +""" + +from starlette.responses import HTMLResponse + + +USER_DASHBOARD_HTML = """ + + + + + + MCP Gateway Admin + + + + + +
+ + + + + +
+

Gateway Status

+ +
+
+
Healthy Services
+
{{ servicesHealthy }}/{{ services.length }}
+
+
+
Total Tools Available
+
{{ totalTools }}
+
+
+ +
+
+

MCP Services

+ +
+
Loading services...
+
+
+
+
{{ svc.name }}
+
{{ svc.toolCount }} tools • {{ svc.responseTime }}ms
+
+ {{ svc.status }} +
+
+
+ +
Auto-refreshes every 10s
+
+ + +
+

User Management

+ + +
+

Create New User

+
+ + + +
+ + {{ createMsg.text }} +
+ + +
+
+

Users ({{ users.length }})

+
+
+ No users yet. Create one above. +
+
+
+ +
+
+ {{ user.username }} + {{ user.email }} +
Created {{ formatDate(user.created_at) }}
+
+
+ + {{ user.enabled ? 'ENABLED' : 'DISABLED' }} + + + +
+
+ + +
+ + +

API Keys

+
No API keys yet.
+
+
+
+
{{ key.key_name || 'Unnamed key' }}
+
Created {{ formatDate(key.created_at) }} + • Expires {{ formatDate(key.expires_at) }} +
+
+ REVOKED + +
+
+ + + +
+

MCP Access Control

+

Leave both empty = access to all MCPs. Toggle to explicitly allow or block.

+ +
+
Allowed MCPs + (only these are accessible) +
+
+ +
+
+ +
+
Blocked MCPs + (these are always denied) +
+
+ +
+
+
+
+
+
+
+
+ + +
+

API Documentation

+
+
+

Create User

+
POST /users
+{ "username": "alice", "email": "alice@example.com", "description": "Engineering" }
+
+
+

Generate API Key

+
POST /users/{username}/keys
+{ "key_name": "my-key", "ttl_days": 90 }
+=> { "api_key": "mcpgw_..." }  ← save immediately, shown once
+
+
+

Set MCP Access

+
PUT /users/{username}/mcp-access
+{ "allowed_mcps": ["erpnext", "wave"], "blocked_mcps": [] }
+
+
+

Using an API Key with Claude

+
MCP Server URL: https://mcp.wilddragon.net/mcp
+Authorization:  Bearer mcpgw_...
+
+
+
+ +
+ + + + + +""" + +async def user_management_dashboard(request): + """Serve the user management dashboard.""" + return HTMLResponse(USER_DASHBOARD_HTML)