Step-by-step integration guide via MCP (Model Context Protocol) delivery
Connect to this remote MCP server for react-conversation integration guidance.
https://install.md/swapnil-cometchat/react-conversation
Add this MCP server URL to your coding agent's configuration:
https://install.md/swapnil-cometchat/react-conversation
If your agent supports it, start with this prompt:
/use-react-conversation
Otherwise, send a prompt like "Start integration with react-conversation"
This guide helps you integrate the CometChat React UI Kit into your React app and build a modern chat experience with minimal setup.
The CometChat React UI Kit is a collection of prebuilt, modular chat UI components that handle messaging, presence, and real-time updates out of the box. You can compose these components to build chat experiences without reinventing core chat functionality.
Before you begin, make sure you have:
Auth Keys are recommended only for development. For production apps, use Auth Tokens.
Create a new React app using Vite:
npm create vite@latest cometchat-react -- --template react-ts
cd cometchat-react
npm install
Install the UI Kit package:
npm install @cometchat/chat-uikit-react
Import the CSS variables once in your app:
import "@cometchat/chat-uikit-react/css-variables.css";
Initialize CometChat before rendering any UI components:
import { CometChatUIKit, UIKitSettingsBuilder } from "@cometchat/chat-uikit-react";
const settings = new UIKitSettingsBuilder()
.setAppId("YOUR_APP_ID")
.setRegion("YOUR_REGION")
.setAuthKey("YOUR_AUTH_KEY")
.subscribePresenceForAllUsers()
.build();
CometChatUIKit.init(settings)
.then(() => console.log("CometChat initialized"))
.catch(console.error);
Log in a user before rendering conversations or messages:
import { CometChatUIKit } from "@cometchat/chat-uikit-react";
CometChatUIKit.login("cometchat-uid-1")
.then(user => console.log("Logged in as", user.getUid()))
.catch(console.error);
This guide uses a two-panel layout:
import { CometChatConversations } from "@cometchat/chat-uikit-react";
export function ConversationList({ onSelect }) {
return (
<CometChatConversations
onItemClick={(conversation) => {
const target = conversation.getConversationWith();
onSelect(target);
}}
/>
);
}
import {
CometChatMessageHeader,
CometChatMessageList,
CometChatMessageComposer,
} from "@cometchat/chat-uikit-react";
export function MessageView({ user, group }) {
if (!user && !group) {
return <div>Select a conversation</div>;
}
return (
<>
<CometChatMessageHeader user={user} group={group} />
<CometChatMessageList user={user} group={group} />
<CometChatMessageComposer user={user} group={group} />
</>
);
}
import { useState } from "react";
import { CometChat } from "@cometchat/chat-sdk-javascript";
import { ConversationList } from "./ConversationList";
import { MessageView } from "./MessageView";
export default function App() {
const [user, setUser] = useState();
const [group, setGroup] = useState();
return (
<div className="chat-layout">
<aside className="sidebar">
<ConversationList
onSelect={(item) => {
if (item instanceof CometChat.User) {
setUser(item);
setGroup(undefined);
} else {
setGroup(item);
setUser(undefined);
}
}}
/>
</aside>
<main className="chat-panel">
<MessageView user={user} group={group} />
</main>
</div>
);
}
npm run dev
You now have a working React chat UI powered by CometChat.
How your coding agent will interact with this MCP server
Pick your coding agent to learn how to add this guide:
Your coding agent can access:
Your coding agent will automatically guide you through each step.
Build precise, guided implementation plans that work with every modern coding agent