Conversation
⏭️ Changeset Not RequiredLatest commit: bad0c3c No changes in this PR affected the Changeset is not required for this PR. |
WalkthroughAdds a new documentation page detailing how to connect Model Context Protocol (MCP) servers to React/Next.js apps using CopilotKit, including CLI and manual setup paths, example code for chat integration and tool visualization, and guidance for self-hosting. Updates the docs navigation to include this page. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant UI as React App (CopilotChat)
participant CK as CopilotKit Provider
participant MCP as MCP Client
participant S as MCP Server (SSE)
User->>UI: Enters prompt / interacts with chat
UI->>CK: useCopilotChat.submitMessage()
CK->>MCP: setMcpServers([...]) / create client
MCP-->>S: Connect via SSE (subscribe/tools)
S-->>MCP: Stream tool calls/results
MCP-->>CK: Forward tool events/results
CK-->>UI: Update messages & tool call UI
UI-->>User: Render assistant output and tool results
rect rgb(235, 245, 255)
note over CK,MCP: Optional: Self-hosted Copilot Runtime proxy
UI->>CK: Calls runtime endpoint (if self-hosted)
CK->>MCP: Route via runtime
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
Status, Documentation and Community
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (7)
docs/content/docs/(root)/connect-mcp-servers.mdx (7)
11-19: Remove unused imports to avoid MDX/TS build warnings.Only SquareTerminal and SquareChartGantt are used; Link and the other lucide icons are unused.
Apply this diff:
-import Link from "next/link"; -import { - Database, - Code, - Server, - Bot, - SquareTerminal, - SquareChartGantt, -} from "lucide-react"; +import { SquareTerminal, SquareChartGantt } from "lucide-react";
39-45: Fix grammar in Composio step.“find a server the suits your needs” → “find a server that suits your needs”
Apply this diff:
- To get started, go to [Composio](https://mcp.composio.dev/), find a server the suits your needs and copy the SSE URL before continuing here. + To get started, go to [Composio](https://mcp.composio.dev/), find a server that suits your needs, and copy the SSE URL before continuing here.
66-79: Improve phrasing and punctuation for the CLI instruction.“Just run this following command …” → “Just run the following command …” and use a colon before the code block.
Apply this diff:
- Just run this following command in your Next.js application to get started! + Just run the following command in your Next.js application to get started:
121-128: Avoid placing MCP SSE URLs or tokens directly in client code.If the MCP endpoint requires auth, embedding it in a client component can leak credentials. Prefer configuring MCP server connections on the server (runtime) and exposing only safe identifiers client-side.
Would you add a short note here advising readers to avoid hardcoding secrets in the browser and to route MCP connections via their Copilot runtime or a server API? If helpful, I can draft that note.
169-186: Simplify the generic type for the catch-all action renderer.Catch-all tools can have varied arg types; using
unknownis clearer than[]and avoids implying an empty tuple type.Apply this diff:
- render: ({ name, status, args, result }: CatchAllActionRenderProps<[]>) => ( + render: ({ name, status, args, result }: CatchAllActionRenderProps<unknown>) => ( <McpToolCall status={status} name={name} args={args} result={result} /> ),
241-246: Align component name with import to reduce confusion.Earlier you import
McpToolCall(camel-cased acronym). Renaming the exported default toMcpToolCallimproves consistency in the example.Apply this diff:
-export default function MCPToolCall({ +export default function McpToolCall({ status, name = "", args, result, }: ToolCallProps) {
345-363: Add file placement guidance for the Next.js App Router example.A brief note like “Place this in app/api/copilotkit/route.ts” helps readers wire the endpoint correctly. Also ensure the
endpointoption matches the actual route path.Do you want me to append a one-liner above the snippet clarifying the file path and the need to align
endpointwith the route?
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
docs/content/docs/(root)/connect-mcp-servers.mdx(1 hunks)docs/content/docs/(root)/meta.json(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
docs/**/*
📄 CodeRabbit Inference Engine (.cursor/rules/quick-reference.mdc)
Check [docs/] for documentation site
Files:
docs/content/docs/(root)/meta.jsondocs/content/docs/(root)/connect-mcp-servers.mdx
docs/content/docs/**/*
📄 CodeRabbit Inference Engine (.cursor/rules/quick-reference.mdc)
See [docs/content/docs/] for markdown documentation files
Files:
docs/content/docs/(root)/meta.jsondocs/content/docs/(root)/connect-mcp-servers.mdx
🪛 LanguageTool
docs/content/docs/(root)/connect-mcp-servers.mdx
[grammar] ~7-~7: There might be a mistake here.
Context: ...ns" icon: "lucide/Network" --- import { TailoredContent, TailoredContentOption...
(QB_NEW_EN)
[grammar] ~8-~8: There might be a mistake here.
Context: ...etwork" --- import { TailoredContent, TailoredContentOption, } from "@/compone...
(QB_NEW_EN)
[grammar] ~9-~9: There might be a mistake here.
Context: ...ailoredContent, TailoredContentOption, } from "@/components/react/tailored-cont...
(QB_NEW_EN)
[grammar] ~10-~10: There might be a mistake here.
Context: .../components/react/tailored-content.tsx"; import Link from "next/link"; import { ...
(QB_NEW_EN)
[grammar] ~11-~11: There might be a mistake here.
Context: ...tent.tsx"; import Link from "next/link"; import { Database, Code, Server, ...
(QB_NEW_EN)
[grammar] ~12-~12: There might be a mistake here.
Context: ...; import Link from "next/link"; import { Database, Code, Server, Bot, Squ...
(QB_NEW_EN)
[grammar] ~13-~13: There might be a mistake here.
Context: ...k from "next/link"; import { Database, Code, Server, Bot, SquareTerminal,...
(QB_NEW_EN)
[grammar] ~14-~14: There might be a mistake here.
Context: ...next/link"; import { Database, Code, Server, Bot, SquareTerminal, Squar...
(QB_NEW_EN)
[grammar] ~15-~15: There might be a mistake here.
Context: ...; import { Database, Code, Server, Bot, SquareTerminal, SquareChartGant...
(QB_NEW_EN)
[grammar] ~16-~16: There might be a mistake here.
Context: ...t { Database, Code, Server, Bot, SquareTerminal, SquareChartGantt, } fr...
(QB_NEW_EN)
[grammar] ~17-~17: There might be a mistake here.
Context: ...Code, Server, Bot, SquareTerminal, SquareChartGantt, } from "lucide-react";...
(QB_NEW_EN)
[grammar] ~18-~18: There might be a mistake here.
Context: ...t, SquareTerminal, SquareChartGantt, } from "lucide-react"; ## Introduction ...
(QB_NEW_EN)
🔇 Additional comments (3)
docs/content/docs/(root)/meta.json (1)
11-11: Nav entry looks good; slug matches new page.The new "connect-mcp-servers" entry is correctly added under Feature Overviews and matches the MDX filename, so the route should resolve as expected.
docs/content/docs/(root)/connect-mcp-servers.mdx (2)
33-47: Confirm global availability of MDX UI components.
Steps,Step,Accordions,Accordion,Callout, andLinkToCopilotCloudare used without imports. If your MDX provider registers them globally, great—otherwise the page will error at runtime.If not globally registered, import them explicitly or add a brief note indicating they’re provided by the docs framework.
115-129: Double-check API names: useCopilotChat.setMcpServers.API surfaces evolve; please verify
useCopilotChatexposessetMcpServersin the current @copilotkit/react-core. If the setter lives elsewhere (e.g., a different hook or provider prop), update the snippet accordingly.To verify across the repo, run a quick grep locally for
setMcpServersand confirm the import path and types.
|
Preview environments destroyed for this pull request. |
Test ResultsStatus: ✅ Passed (View Run) Commit: a4c1591 Duration: 288.7s Total Tests: 37 Pass Rate: 100.0% Failed Tests: 0 🔍 Detailed Resultscoagents-research-canvasCoAgents Research Canvas (UI) - Local Depenencies
coagents-qa-nativeCoAgents QA Native (UI) - Local
coagents-qa-textCoAgents QA Text (UI) - Local
coagents-routingCoAgents Routing (UI) - Local
next-openaiNext OpenAI - Self Hosted
|
Summary by CodeRabbit