#Connect MCP Server to Copilotkit UI

1 messages · Page 1 of 1 (latest)

lyric ice
#

I have an MCP server built with FastMCP but having a hard time connecting it with Copilotkit UI

weak flaxBOT
#

@lyric ice To connect your FastMCP server to CopilotKit UI:

In your React chat page, call

useCopilotChat().setMcpServers([{ endpoint: "YOUR_FASTMCP_URL" }])

Create/update your Next.js API route (e.g., app/api/copilotkit/route.ts) to use CopilotRuntime with a createMCPClient that connects to your FastMCP server.

Make sure your FastMCP client implements the MCPClient interface and includes a tools() method that returns your available tools.
Docs for MCP setup: https://docs.copilotkit.ai/direct-to-llm/guides/model-context-protocol?cli=do-it-manually

Integrate Model Context Protocol (MCP) servers into React applications

lyric ice
#

thanks for the help @mental bane