agentic-community / agentic-community/mcp-gateway-registry

feat(copilot): Chat panel & natural-language registry guide (advisory + discovery)

Đang mở
#1,340 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
architecture enhancement feature-request semantic-search subtask
Ngôn ngữ chính
Python
Star
911
Fork
234
Merge trung bình
1 ngày 11 giờ
Pull request đã merge (30 ngày)
62

Mô tả

## Parent

Sub-issue of the Registry Copilot umbrella (#744).

## Summary

Build the foundational **Registry Copilot chat experience**: a toggleable left-sidebar chat panel that acts as a **natural-language guide to the registry**. It answers questions like "how do I register a new MCP server?" and "where do I find a tool that does X?" by running **agentic/semantic search** over the registry and explaining results, then deep-linking the user to the right UI page.

This sub-issue is **advisory + discovery only (read-only)**:
- It does **not** design agents or generate specs (that is the Agent Builder sub-issue).
- It does **not** execute registry CRUD on the user's behalf (no register/update/delete via chat). It explains *how* and links to the page; the user performs the action. (Conversational CRUD = the original #744 "Phase A", deferred — see umbrella.)

## Relationship to the existing UI semantic search (important)

The registry UI **already has** a semantic search box (`/api/search/semantic`): you type a query and get a ranked, one-shot list of matching servers/tools/agents/skills. **This feature does not replace that — it is a conversational, agent-backed layer on top of it.**

The difference is **multi-turn reasoning**. The existing search is stateless and single-shot; the Copilot is a conversation backed by an agent (Claude Opus 4.8) that *uses the same semantic search as a tool* and keeps context across turns, so the user can **reason through the results they got** and ask follow-ups, e.g.:

> "find me tools for processing PDFs" → (agent runs semantic search, summarizes 5 results)
> "which of those support OAuth?" → (agent reasons over the prior results, searches again if needed)
> "okay, how do I register the second one in my registry?" → (agent explains the steps + deep-links to the Register page)

So the value is: the same trusted search ranking, but wrapped in a guided, stateful conversation where the user can refine, compare, drill in, and get how-to guidance — instead of re-typing one-shot queries and interpreting raw lists themselves. It is **additive** to the search box, not a replacement for it.

## Problem

The existing UI semantic search is one-shot and stateless: the user types a query, gets a ranked list, and must interpret and act on it themselves — re-typing refined queries to narrow down, and already knowing which page to visit to act. There is no conversational way to ask "how do I do X?", to **reason across the results of a search**, ask follow-up questions that build on prior answers, or get grounded how-to guidance that points at real, accessible registry assets.

## Proposed solution

- **Toggleable left sidebar** that swaps the existing nav rail for a Copilot chat panel (reuses the existing `sidebarOpen`/`Layout.tsx` machinery; `ServerStatsContext` stays mounted so toggling back is instant). Gated by `COPILOT_ENABLED` (default false).
- **Agentic-search grounding:** the assistant calls the existing hybrid `POST /api/search/semantic` (extracted to an in-process `search_service.semantic_search(req, user_context)`) so every answer is grounded in real assets and **visibility-filtered** to the requesting user. It can run multiple search passes per turn (tool-calling loop).
- **Guide behavior:** answers "how do I register an MCP server / agent / skill", "where do I find a tool for PDF processing", "what servers are tagged finance", etc. — explaining steps and **deep-linking** to the relevant UI route. No write actions.
- **Conversations persisted** per user in DocumentDB (`copilot_conversations_{namespace}`) with TTL; list/create/delete/switch. Caps: 200k tokens / 25 messages per conversation; per-user max conversations + concurrent streams.
- **LLM backend:** Anthropic SDK `AnthropicBedrockMantle`, default model `anthropic.claude-opus-4-8`, adaptive thinking + effort. Dedicated `ThreadPoolExecutor`; zero overhead + routes 404 when disabled.
- **Streaming:** SSE over POST (fetch + ReadableStream on the client; 15s heartbeats; SSE-safe nginx location). Markdown rendering via react-markdown.
- **Guardrails:** optional Amazon Bedrock Guardrails via the decoupled `ApplyGuardrail` API (`COPILOT_GUARDRAIL_ID`), screening user input.

## Acceptance criteria

- [ ] Toggleable Copilot chat sidebar; hidden when `COPILOT_ENABLED=false` (flag exposed to all authenticated users)
- [ ] Markdown-rendered chat; SSE streaming with heartbeats; CSRF on the streaming POST
- [ ] Assistant answers how-to and discovery questions grounded in a **read-only tool set**, all visibility-filtered: `semantic_search`, `get_entity_details`, `list_by_tag`, `health_status`, `how_to` (docs-grounded). No write tools.
- [ ] Deep-links to the correct UI pages for suggested actions; performs no write operations
- [ ] UI decisions (v1): cited results are **deep-links only** (no main-grid coupling); chat is **self-contained** (UI filter/selection not passed to the agent)
- [ ] Conversations persisted per user (DocumentDB + TTL); list/create/delete/switch
- [ ] Caps enforced (200k tokens / 25 msgs); per-user conversation + concurrent-stream limits
- [ ] LLM via `AnthropicBedrockMantle` (Opus 4.8 default); dedicated thread pool; 404 + zero overhead when disabled
- [ ] Optional `ApplyGuardrail` input screening when `COPILOT_GUARDRAIL_ID` is set
- [ ] Config plumbed across Docker/ECS/Helm + unified parameter reference; nginx SSE-safe location + MCP canary unaffected

## Out of scope (this sub-issue)

- Agent design / recommendation, YAML `AgentSpec`, AgentCore harness output (Agent Builder sub-issue)
- Executing registry CRUD via chat (deferred Phase A)

## Design reference

Detailed design (shared with the Agent Builder sub-issue): `.scratchpad/issue-744/lld-744.md` (foundational chat, search grounding, runtime, SSE, guardrails, config), `review-744.md`, `testing-744.md`.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.