Package Exports
- react-mcp-chatbot
Readme
π€ React MCP Chatbot
AI-powered React chatbot with intelligent API tool calling
A production-ready chat widget that understands user intent, selects the correct API, executes it, and responds with clean Markdown-formatted answers.
β¨ What is React MCP Chatbot?
React MCP Chatbot is a customizable AI chatbot component that connects natural language user requests to real API calls using an LLM-powered agent.
Instead of writing complex conditional logic, you simply define tools (API functions) β the AI automatically decides when and how to call them.
This makes it ideal for real-world, data-driven AI applications.
π₯ Demo
Example: user asks a question β AI decides β API is called β formatted response
π Features
- π€ AI-driven tool selection
- π Pluggable API tools
- π§ LLM-powered intent detection
- π§© Fully typed (TypeScript)
- π¨ Modern floating chat UI
- π Dark & Light themes
- π Highly customizable
- π Markdown responses (tables, lists, code)
- β‘ Ollama / Groq / OpenAI / Gemini / Deepseek
- π Optional & validated tool parameters
π§ How It Works
User Message
β
LLM analyzes intent
β
Tool decision (or no tool)
β
API function executed
β
Markdown-formatted response
π¦ Installation
npm install react-mcp-chatbot
or
yarn add react-mcp-chatbot
β‘ Quick Start
import { MCPAgent } from "react-mcp-chatbot";
<MCPAgent
provider="ollama" // or "groq"
providerURL="http://localhost:11434"
model="llama3"
tools={tools}
/>
π Defining API Tools
import type { MCPTool } from "react-mcp-chatbot";
const weatherTool: MCPTool = {
name: "get_weather",
description: "Get current weather for a city",
parameters: {
city: {
type: "string",
description: "City name",
},
units: {
type: "string",
optional: true,
description: "metric or imperial",
},
},
call: async ({ city, units }) => {
const res = await fetch(
`https://api.example.com/weather?q=${city}&units=${units ?? "metric"}`
);
return res.json();
},
};
π¨ UI Customization
<MCPAgent
title="Support Assistant"
align="right"
theme="dark"
width={420}
height={640}
primaryColor="#6366f1"
borderRadius={20}
placeholder="Ask me anythingβ¦"
/>
π§ Use Cases
- AI customer support bots
- Internal admin dashboards
- API copilots
- SaaS onboarding assistants
- Analytics chatbots
- Developer tools
- Portfolio projects
π License
MIT Β© Tigran Zakharyan
β Star the Project
If this project helped you or inspired you, please consider giving it a star β
It helps a lot and motivates further development.