mcp-context-forge icon indicating copy to clipboard operation
mcp-context-forge copied to clipboard

[UI-REWRITE]: Playground page in React UI

Open a-effort opened this issue 6 months ago • 2 comments

🧭 Type of Feature

  • [x] Enhancement to existing functionality
  • [x] New feature or capability

Parent epic

Child of #4093 ([EPIC][UI-REWRITE]: Frontend refactor and redesign).

🧭 Context

The new React UI in client/ has a playground route wired into the sidebar (client/src/components/layout/Sidebar.tsx:45) but no corresponding page file in client/src/pages/. The legacy HTMX UI exposes this as the "LLM Chat" panel, backed by the existing /llmchat/* API (mcpgateway/routers/llmchat_router.py). This issue tracks bringing that surface to the React UI at parity, then improving it.

Goal: ship a Playground page that lets a user pick a virtual server, connect a configured LLM, hold a streaming conversation, see tool calls/results inline, and disconnect cleanly.


🧑🏻‍💻 User Story 1 — Connect and chat against a virtual server

As a: gateway operator or tool author I want: to open Playground, pick a virtual server and a configured LLM, and chat So that: I can validate that my tools, prompts, and resources work end-to-end without leaving the gateway UI

✅ Acceptance Criteria

Scenario: Connect to a virtual server
  Given I have at least one virtual server and one configured LLM model
  When I open /app/playground and select a server + model
  Then a session is established via POST /llmchat/connect
  And the chat input becomes enabled

Scenario: Streamed assistant response
  Given an active Playground session
  When I send a message
  Then assistant tokens stream into the message list
  And tool invocations and their results appear as inline cards under the assistant turn

Scenario: Disconnect
  Given an active Playground session
  When I click "Disconnect" or navigate away
  Then POST /llmchat/disconnect is called and the session is released

🧑🏻‍💻 User Story 2 — Tool visibility and per-call inspection

As a: developer debugging a MCP tool I want: to see which tools are available, which were called, with arguments and raw results So that: I can debug tool schemas, RBAC scoping, and result shape without curling the API

✅ Acceptance Criteria

Scenario: Tool toolbelt
  Given I am connected to a virtual server
  Then I can see the list of tools the LLM will be offered

Scenario: Tool-call inspection
  Given the LLM invokes a tool
  Then I can expand the tool card to see the arguments, the raw result, and timing

🧑🏻‍💻 User Story 3 — Auth, errors, and recovery

As a: Playground user I want: clear feedback when auth, transport, or streaming fails So that: I can recover without losing the conversation

✅ Acceptance Criteria

Scenario: Mid-stream failure does not kill the session
  Given an active session
  When the model stream errors
  Then the failed turn is marked, the session stays connected, and I can retry
  # See #3763 for the legacy bug this avoids

Scope

In scope (MVP):

  • New client/src/pages/Playground.tsx and route registration.
  • Server picker + model picker (drawing from existing Servers and LLM Models APIs).
  • Connect / disconnect / status using /llmchat/{connect,chat,disconnect,status/{user_id},config/{user_id},gateway/models}.
  • Streaming assistant messages with markdown rendering.
  • Tool-call card UI (name, args, result, duration).
  • Basic error toasts and session-survives-mid-stream-failure behaviour.

Out of scope (separate issues):

  • Rendering MCP Apps / SEP-1865 interactive UI content (tracked separately; see related issue).
  • Inline chart spec rendering (Vega-Lite / Plotly).
  • In-chat self-service "connect another MCP" flow.
  • Multi-session / conversation history persistence beyond what /llmchat already provides.

Dependencies / known issues to address as part of this work

  • #4789 — LLM Chat requires Redis but setup docs don't mention it (document or detect at runtime in the page's error state).
  • #4659 — Service initialization failed: LLM chat dependencies are missing (surface a clear "feature disabled" state instead of a generic error).
  • #3763 (closed) — Streaming errors used to kill the session; ensure the new UI preserves the recoverable behaviour.

🔗 MCP Standards Check

  • [x] Change adheres to current MCP specifications (uses existing gateway-mediated tool calls).
  • [x] No breaking changes to existing MCP-compliant integrations.

📓 Additional Context

  • Backend API: mcpgateway/routers/llmchat_router.py (already implements connect/chat/disconnect/status/config/gateway models).
  • Legacy implementation: mcpgateway/admin_ui/llmChat.js, mcpgateway/templates/admin.html (the "LLM Chat" panel) — useful as a parity reference, not a design reference.
  • Related epics: #2228 (AI-powered conversational gateway), #2291 (AI-assisted operations), #3131 (External LLM Gateway Adapter).

a-effort avatar May 27 '26 19:05 a-effort

Linking: #4928 (MCP Apps rendering in Playground) builds on this. The MVP described here is the foundation it needs.

a-effort avatar May 27 '26 20:05 a-effort

Also consider: https://github.com/IBM/mcp-context-forge/issues/2952

a-effort avatar Jun 10 '26 16:06 a-effort