react-mcp-chatbot 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,36 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ type MCPToolParameter = {
4
+ type: "string" | "number" | "boolean";
5
+ description?: string;
6
+ optional?: boolean;
7
+ };
8
+ type MCPTool<TArgs = any> = {
9
+ name: string;
10
+ description: string;
11
+ parameters?: Record<string, MCPToolParameter>;
12
+ call: (args: TArgs) => Promise<any>;
13
+ };
14
+ type BaseUIProps = {
15
+ title?: string;
16
+ align?: "left" | "right";
17
+ primaryColor?: string;
18
+ width?: number;
19
+ height?: number;
20
+ theme?: "light" | "dark";
21
+ buttonLabel?: string;
22
+ placeholder?: string;
23
+ borderRadius?: number;
24
+ providerURL: string;
25
+ };
26
+ type AgentProps = {
27
+ providerURL: string;
28
+ provider: "ollama";
29
+ model: string;
30
+ tools: MCPTool[];
31
+ };
32
+ type MCPAgentProps = BaseUIProps & AgentProps;
33
+
34
+ declare function MCPAgent({ provider, providerURL, model, tools, title, align, primaryColor, width, height, theme, buttonLabel, placeholder, borderRadius, }: MCPAgentProps): react_jsx_runtime.JSX.Element;
35
+
36
+ export { MCPAgent, type MCPAgentProps, type MCPTool };
package/dist/index.js ADDED
@@ -0,0 +1,590 @@
1
+ // src/MCPAgent.tsx
2
+ import { useState, useRef, useEffect, useMemo } from "react";
3
+ import ReactMarkdown from "react-markdown";
4
+ import remarkGfm from "remark-gfm";
5
+
6
+ // src/types.ts
7
+ var Agent = class {
8
+ tools;
9
+ model;
10
+ url;
11
+ constructor(model, url, tools = []) {
12
+ this.tools = tools;
13
+ this.url = url;
14
+ this.model = model;
15
+ }
16
+ };
17
+
18
+ // src/helpers/prompts.ts
19
+ var buildToolDecisionPrompt = (tools, message) => `
20
+ You are an API query planner.
21
+
22
+ Available tools:
23
+ ${tools.map((t) => `
24
+ Tool: ${t.name}
25
+ Description: ${t.description}
26
+ Parameters:
27
+ ${Object.entries(t.parameters ?? []).map(([k, v]) => {
28
+ const optional = typeof v.optional === "boolean" ? v.optional : true;
29
+ return `- ${k} (${v.type})${optional ? " optional" : ""}`;
30
+ }).join("\n")}
31
+ `).join("\n")}
32
+
33
+ User request:
34
+ ${message}
35
+
36
+ Rules:
37
+ - Decide the best tool to use
38
+ - Extract correct parameter values from the user message
39
+ - Only include parameters relevant to the request
40
+ - If no tool is needed, return { "tool": null }
41
+
42
+ Respond ONLY with valid JSON.
43
+ `;
44
+
45
+ // src/agents/ollamaAgent.ts
46
+ var OllamaAgent = class extends Agent {
47
+ constructor(model = "llama3.2:latest", providerURL, tools = []) {
48
+ super(model, providerURL, tools);
49
+ }
50
+ async decideTool(message) {
51
+ if (this.tools.length === 0) return { tool: null };
52
+ console.log(this.url);
53
+ const res = await fetch(`${this.url}/api/generate`, {
54
+ method: "POST",
55
+ headers: { "Content-Type": "application/json" },
56
+ body: JSON.stringify({
57
+ model: this.model,
58
+ system: "You select tools and arguments. Output JSON only.",
59
+ prompt: buildToolDecisionPrompt(this.tools, message),
60
+ stream: false
61
+ })
62
+ });
63
+ const data = await res.json();
64
+ try {
65
+ return JSON.parse(data.response);
66
+ } catch {
67
+ return { tool: null };
68
+ }
69
+ }
70
+ async ask(message) {
71
+ let toolContext = "";
72
+ const decision = await this.decideTool(message);
73
+ if (decision.tool) {
74
+ const tool = this.tools.find((t) => t.name === decision.tool);
75
+ if (tool) {
76
+ const result = await tool.call(decision.arguments);
77
+ toolContext = `
78
+ Tool used: ${tool.name}
79
+ Result (partial):
80
+ \`\`\`json
81
+ ${JSON.stringify(result, null, 2).slice(0, 4e3)}
82
+ \`\`\`
83
+ `;
84
+ }
85
+ }
86
+ const finalPrompt = `
87
+ User request:
88
+ ${message}
89
+
90
+ ${toolContext}
91
+
92
+ Respond in clean, well-formatted Markdown.
93
+ Use lists, tables, and headings where appropriate.
94
+ Do NOT mention tools or APIs explicitly.
95
+ `;
96
+ const res = await fetch(`${this.url}/api/generate`, {
97
+ method: "POST",
98
+ headers: { "Content-Type": "application/json" },
99
+ body: JSON.stringify({
100
+ model: this.model,
101
+ system: MARKDOWN_SYSTEM_PROMPT,
102
+ prompt: finalPrompt,
103
+ stream: false
104
+ })
105
+ });
106
+ const data = await res.json();
107
+ return data.response;
108
+ }
109
+ };
110
+
111
+ // src/assets/send.svg
112
+ var send_default = "./send-2CSO66UQ.svg";
113
+
114
+ // src/components/TypingDots.tsx
115
+ import { jsx, jsxs } from "react/jsx-runtime";
116
+ function TypingDots({ color }) {
117
+ return /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: 5, alignItems: "center", padding: "4px 0" }, children: [
118
+ [0, 1, 2].map((i) => /* @__PURE__ */ jsx(
119
+ "span",
120
+ {
121
+ style: {
122
+ width: 7,
123
+ height: 7,
124
+ borderRadius: "50%",
125
+ background: color,
126
+ opacity: 0.4,
127
+ animation: `dotPulse 1.2s ease-in-out ${i * 0.2}s infinite`
128
+ }
129
+ },
130
+ i
131
+ )),
132
+ /* @__PURE__ */ jsx("style", { children: `
133
+ @keyframes dotPulse {
134
+ 0%, 60%, 100% { opacity: 0.3; transform: scale(0.85); }
135
+ 30% { opacity: 1; transform: scale(1.1); }
136
+ }
137
+ ` })
138
+ ] });
139
+ }
140
+
141
+ // src/helpers/buildTokens.ts
142
+ function buildTokens(accent, dark) {
143
+ if (dark) {
144
+ return {
145
+ bg: "#0f1117",
146
+ surface: "#1a1d27",
147
+ surfaceHover: "#232736",
148
+ border: "#2a2e3d",
149
+ text: "#e8eaf0",
150
+ textMuted: "#7a7f8e",
151
+ accent,
152
+ accentHover: accent + "dd",
153
+ userBubble: accent,
154
+ userBubbleText: "#fff",
155
+ aiBubble: "#1e2130",
156
+ aiBubbleText: "#dce0e8",
157
+ inputBg: "#141620",
158
+ inputBorder: "#2a2e3d",
159
+ inputFocus: accent,
160
+ scrollbar: "transparent",
161
+ scrollbarThumb: "#2a2e3d",
162
+ shadow: "0 24px 64px rgba(0,0,0,.45)",
163
+ headerGlow: accent + "22"
164
+ };
165
+ }
166
+ return {
167
+ bg: "#ffffff",
168
+ surface: "#f4f6f9",
169
+ surfaceHover: "#eef1f5",
170
+ border: "#e2e5ec",
171
+ text: "#1a1c23",
172
+ textMuted: "#8a8f9e",
173
+ accent,
174
+ accentHover: accent + "ee",
175
+ userBubble: accent,
176
+ userBubbleText: "#fff",
177
+ aiBubble: "#ffffff",
178
+ aiBubbleText: "#1a1c23",
179
+ inputBg: "#fff",
180
+ inputBorder: "#e2e5ec",
181
+ inputFocus: accent,
182
+ scrollbar: "transparent",
183
+ scrollbarThumb: "#d6d9e2",
184
+ shadow: "0 24px 64px rgba(0,0,0,.12)",
185
+ headerGlow: accent + "18"
186
+ };
187
+ }
188
+
189
+ // src/MCPAgent.tsx
190
+ import { Fragment, jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
191
+ var MARKDOWN_SYSTEM_PROMPT = `
192
+ You are a helpful AI assistant.
193
+
194
+ Formatting rules:
195
+ - Always respond in Markdown
196
+ - Use bullet lists for multiple items
197
+ - Use **bold** for important values
198
+ - Use tables when comparing data
199
+ - Use \`inline code\` for variables or keys
200
+ - Use code blocks only when necessary
201
+ - Keep responses clean and readable
202
+ `;
203
+ function MCPAgent({
204
+ provider,
205
+ providerURL,
206
+ model,
207
+ tools = [],
208
+ title = "AI Assistant",
209
+ align = "right",
210
+ primaryColor = "#6366f1",
211
+ width = 600,
212
+ height = 900,
213
+ theme = "dark",
214
+ buttonLabel,
215
+ placeholder = "Message\u2026",
216
+ borderRadius = 20
217
+ }) {
218
+ const isDark = theme === "dark";
219
+ const t = buildTokens(primaryColor, isDark);
220
+ const [open, setOpen] = useState(false);
221
+ const [messages, setMessages] = useState([]);
222
+ const [input, setInput] = useState("");
223
+ const [loading, setLoading] = useState(false);
224
+ const [animateIn, setAnimateIn] = useState(false);
225
+ const scrollRef = useRef(null);
226
+ const inputRef = useRef(null);
227
+ useEffect(() => {
228
+ if (scrollRef.current) {
229
+ scrollRef.current.scrollTop = scrollRef.current.scrollHeight;
230
+ }
231
+ }, [messages, loading]);
232
+ useEffect(() => {
233
+ if (open) {
234
+ requestAnimationFrame(() => setAnimateIn(true));
235
+ setTimeout(() => inputRef.current?.focus(), 200);
236
+ } else {
237
+ setAnimateIn(false);
238
+ }
239
+ }, [open]);
240
+ const agent = useMemo(() => {
241
+ if (provider === "ollama") {
242
+ return new OllamaAgent(model, providerURL, tools);
243
+ }
244
+ return new OllamaAgent(model, providerURL, tools);
245
+ }, [provider, model, providerURL, tools]);
246
+ async function send() {
247
+ if (!input.trim() || loading) return;
248
+ const userMessage = input.trim();
249
+ setInput("");
250
+ setLoading(true);
251
+ setMessages((prev) => [...prev, { role: "user", content: userMessage }]);
252
+ try {
253
+ const response = await agent.ask(userMessage);
254
+ setMessages((prev) => [
255
+ ...prev,
256
+ { role: "ai", content: response }
257
+ ]);
258
+ } catch (err) {
259
+ setMessages((prev) => [
260
+ ...prev,
261
+ { role: "ai", content: "\u26A0\uFE0F **Error:** Unable to fetch response." }
262
+ ]);
263
+ } finally {
264
+ setLoading(false);
265
+ }
266
+ }
267
+ const side = align === "right" ? { right: 24 } : { left: 24 };
268
+ const styleTag = `
269
+ .mcp-input:focus { outline: none; box-shadow: 0 0 0 2.5px ${t.inputFocus}33; border-color: ${t.inputFocus} !important; }
270
+ .mcp-input::placeholder { color: ${t.textMuted}; }
271
+ .mcp-scrollpane::-webkit-scrollbar { width: 6px; }
272
+ .mcp-scrollpane::-webkit-scrollbar-track { background: ${t.scrollbar}; }
273
+ .mcp-scrollpane::-webkit-scrollbar-thumb { background: ${t.scrollbarThumb}; border-radius: 3px; }
274
+ .mcp-scrollpane::-webkit-scrollbar-thumb:hover { background: ${t.textMuted}44; }
275
+ .mcp-btn-send:hover { background: ${t.accentHover} !important; transform: translateY(-1px); }
276
+ .mcp-btn-send:active { transform: translateY(0); }
277
+ .mcp-bubble-ai a { color: ${t.accent}; }
278
+ .mcp-bubble-ai code { background: ${isDark ? "#2a2e3d" : "#eef1f5"}; color: ${isDark ? "#c9cdd8" : "#e11d48"}; padding: 2px 6px; border-radius: 4px; font-size: 0.82em; }
279
+ .mcp-bubble-ai pre { background: ${isDark ? "#161923" : "#f0f2f5"}; padding: 10px 12px; border-radius: 8px; overflow-x: auto; font-size: 0.8em; margin: 6px 0; }
280
+ .mcp-bubble-ai table { border-collapse: collapse; width: 100%; font-size: 0.82em; margin: 6px 0; }
281
+ .mcp-bubble-ai th, .mcp-bubble-ai td { border: 1px solid ${t.border}; padding: 5px 8px; text-align: left; }
282
+ .mcp-bubble-ai th { background: ${isDark ? "#232736" : "#eef1f5"}; font-weight: 600; }
283
+ .mcp-bubble-ai p { margin: 4px 0; }
284
+ .mcp-bubble-ai ul, .mcp-bubble-ai ol { margin: 4px 0; padding-left: 18px; }
285
+ .mcp-bubble-ai li { margin: 2px 0; }
286
+ .mcp-float-btn:hover { transform: scale(1.08); box-shadow: 0 14px 36px ${primaryColor}55 !important; }
287
+ .mcp-float-btn:active { transform: scale(0.96); }
288
+ `;
289
+ return /* @__PURE__ */ jsxs2(Fragment, { children: [
290
+ /* @__PURE__ */ jsx2("style", { children: styleTag }),
291
+ /* @__PURE__ */ jsxs2(
292
+ "button",
293
+ {
294
+ className: "mcp-float-btn",
295
+ onClick: () => setOpen((o) => !o),
296
+ style: {
297
+ position: "fixed",
298
+ bottom: 24,
299
+ ...side,
300
+ background: open ? isDark ? t.surface : t.border : primaryColor,
301
+ color: open ? t.textMuted : "#fff",
302
+ borderRadius: 999,
303
+ padding: buttonLabel ? "13px 22px" : "16px 18px",
304
+ border: "none",
305
+ cursor: "pointer",
306
+ boxShadow: open ? `0 8px 24px rgba(0,0,0,.15)` : `0 12px 32px ${primaryColor}44`,
307
+ fontWeight: 600,
308
+ fontSize: 15,
309
+ display: "flex",
310
+ alignItems: "center",
311
+ gap: 8,
312
+ transition: "all .25s cubic-bezier(.4,0,.2,1)",
313
+ zIndex: 9999,
314
+ userSelect: "none"
315
+ },
316
+ children: [
317
+ /* @__PURE__ */ jsx2("span", { style: { fontSize: open ? 18 : 20, transition: "font-size .2s" }, children: open ? "\u2715" : "\u{1F4AC}" }),
318
+ buttonLabel && !open && /* @__PURE__ */ jsx2("span", { children: buttonLabel })
319
+ ]
320
+ }
321
+ ),
322
+ /* @__PURE__ */ jsxs2(
323
+ "div",
324
+ {
325
+ style: {
326
+ position: "fixed",
327
+ bottom: 84,
328
+ ...side,
329
+ width,
330
+ height,
331
+ background: t.bg,
332
+ borderRadius,
333
+ display: "flex",
334
+ flexDirection: "column",
335
+ boxShadow: t.shadow,
336
+ overflow: "hidden",
337
+ zIndex: 9998,
338
+ pointerEvents: open ? "auto" : "none",
339
+ opacity: open && animateIn ? 1 : 0,
340
+ transform: open && animateIn ? "translateY(0) scale(1)" : "translateY(18px) scale(.96)",
341
+ transition: "opacity .3s cubic-bezier(.4,0,.2,1), transform .3s cubic-bezier(.4,0,.2,1)",
342
+ fontFamily: "'DM Sans', 'Segoe UI', system-ui, sans-serif"
343
+ },
344
+ children: [
345
+ /* @__PURE__ */ jsxs2(
346
+ "div",
347
+ {
348
+ style: {
349
+ padding: "16px 20px",
350
+ background: isDark ? t.surface : t.bg,
351
+ borderBottom: `1px solid ${t.border}`,
352
+ display: "flex",
353
+ alignItems: "center",
354
+ gap: 10,
355
+ position: "relative",
356
+ overflow: "hidden"
357
+ },
358
+ children: [
359
+ /* @__PURE__ */ jsx2(
360
+ "div",
361
+ {
362
+ style: {
363
+ position: "absolute",
364
+ top: -20,
365
+ left: "50%",
366
+ transform: "translateX(-50%)",
367
+ width: 120,
368
+ height: 60,
369
+ background: t.headerGlow,
370
+ filter: "blur(20px)",
371
+ pointerEvents: "none"
372
+ }
373
+ }
374
+ ),
375
+ /* @__PURE__ */ jsx2(
376
+ "div",
377
+ {
378
+ style: {
379
+ width: 34,
380
+ height: 34,
381
+ borderRadius: "50%",
382
+ background: `linear-gradient(135deg, ${primaryColor}, ${primaryColor}88)`,
383
+ display: "flex",
384
+ alignItems: "center",
385
+ justifyContent: "center",
386
+ fontSize: 16,
387
+ flexShrink: 0,
388
+ position: "relative",
389
+ zIndex: 1
390
+ },
391
+ children: "\u{1F916}"
392
+ }
393
+ ),
394
+ /* @__PURE__ */ jsxs2("div", { style: { position: "relative", zIndex: 1 }, children: [
395
+ /* @__PURE__ */ jsx2("div", { style: { color: t.text, fontWeight: 600, fontSize: 14, lineHeight: 1.3 }, children: title }),
396
+ /* @__PURE__ */ jsxs2("div", { style: { color: t.textMuted, fontSize: 11, display: "flex", alignItems: "center", gap: 4 }, children: [
397
+ /* @__PURE__ */ jsx2(
398
+ "span",
399
+ {
400
+ style: {
401
+ width: 7,
402
+ height: 7,
403
+ borderRadius: "50%",
404
+ background: "#22c55e",
405
+ boxShadow: "0 0 6px #22c55e66",
406
+ display: "inline-block"
407
+ }
408
+ }
409
+ ),
410
+ "Online"
411
+ ] })
412
+ ] })
413
+ ]
414
+ }
415
+ ),
416
+ /* @__PURE__ */ jsxs2(
417
+ "div",
418
+ {
419
+ className: "mcp-scrollpane",
420
+ ref: scrollRef,
421
+ style: {
422
+ flex: 1,
423
+ padding: "16px 14px",
424
+ overflowY: "auto",
425
+ background: t.surface,
426
+ display: "flex",
427
+ flexDirection: "column",
428
+ gap: 10
429
+ },
430
+ children: [
431
+ messages.length === 0 && /* @__PURE__ */ jsxs2(
432
+ "div",
433
+ {
434
+ style: {
435
+ flex: 1,
436
+ display: "flex",
437
+ flexDirection: "column",
438
+ alignItems: "center",
439
+ justifyContent: "center",
440
+ color: t.textMuted,
441
+ fontSize: 13,
442
+ textAlign: "center",
443
+ padding: "0 16px",
444
+ gap: 10
445
+ },
446
+ children: [
447
+ /* @__PURE__ */ jsx2(
448
+ "div",
449
+ {
450
+ style: {
451
+ width: 48,
452
+ height: 48,
453
+ borderRadius: "50%",
454
+ background: `linear-gradient(135deg, ${primaryColor}22, ${primaryColor}44)`,
455
+ display: "flex",
456
+ alignItems: "center",
457
+ justifyContent: "center",
458
+ fontSize: 22
459
+ },
460
+ children: "\u{1F44B}"
461
+ }
462
+ ),
463
+ /* @__PURE__ */ jsx2("span", { style: { fontWeight: 600, color: t.text, fontSize: 14 }, children: "Hey there!" }),
464
+ /* @__PURE__ */ jsx2("span", { children: "How can I help you today?" })
465
+ ]
466
+ }
467
+ ),
468
+ messages.map((m, i) => {
469
+ const isUser = m.role === "user";
470
+ return /* @__PURE__ */ jsx2(
471
+ "div",
472
+ {
473
+ style: {
474
+ display: "flex",
475
+ justifyContent: isUser ? "flex-end" : "flex-start",
476
+ animation: "msgSlideIn .22s ease forwards"
477
+ },
478
+ children: /* @__PURE__ */ jsx2(
479
+ "div",
480
+ {
481
+ className: isUser ? "" : "mcp-bubble-ai",
482
+ style: {
483
+ maxWidth: "82%",
484
+ padding: "10px 14px",
485
+ borderRadius: isUser ? "18px 18px 6px 18px" : "18px 18px 18px 6px",
486
+ background: isUser ? t.userBubble : t.aiBubble,
487
+ color: isUser ? t.userBubbleText : t.aiBubbleText,
488
+ boxShadow: isDark ? "0 2px 10px rgba(0,0,0,.2)" : "0 2px 10px rgba(0,0,0,.07)",
489
+ fontSize: 13.5,
490
+ lineHeight: 1.55,
491
+ wordBreak: "break-word"
492
+ },
493
+ children: isUser ? m.content : /* @__PURE__ */ jsx2(ReactMarkdown, { remarkPlugins: [remarkGfm], children: m.content })
494
+ }
495
+ )
496
+ },
497
+ i
498
+ );
499
+ }),
500
+ loading && /* @__PURE__ */ jsx2("div", { style: { display: "flex", justifyContent: "flex-start" }, children: /* @__PURE__ */ jsx2(
501
+ "div",
502
+ {
503
+ style: {
504
+ background: t.aiBubble,
505
+ padding: "10px 16px",
506
+ borderRadius: "18px 18px 18px 6px",
507
+ boxShadow: isDark ? "0 2px 10px rgba(0,0,0,.2)" : "0 2px 10px rgba(0,0,0,.07)"
508
+ },
509
+ children: /* @__PURE__ */ jsx2(TypingDots, { color: primaryColor })
510
+ }
511
+ ) })
512
+ ]
513
+ }
514
+ ),
515
+ /* @__PURE__ */ jsxs2(
516
+ "div",
517
+ {
518
+ style: {
519
+ padding: "10px 12px",
520
+ background: isDark ? t.surface : t.bg,
521
+ borderTop: `1px solid ${t.border}`,
522
+ display: "flex",
523
+ gap: 8,
524
+ alignItems: "center"
525
+ },
526
+ children: [
527
+ /* @__PURE__ */ jsx2(
528
+ "input",
529
+ {
530
+ ref: inputRef,
531
+ className: "mcp-input",
532
+ value: input,
533
+ onChange: (e) => setInput(e.target.value),
534
+ onKeyDown: (e) => e.key === "Enter" && send(),
535
+ placeholder,
536
+ disabled: loading,
537
+ style: {
538
+ flex: 1,
539
+ padding: "10px 14px",
540
+ borderRadius: 12,
541
+ border: `1.5px solid ${t.inputBorder}`,
542
+ background: t.inputBg,
543
+ color: t.text,
544
+ fontSize: 13.5,
545
+ outline: "none",
546
+ transition: "border-color .2s, box-shadow .2s",
547
+ fontFamily: "inherit"
548
+ }
549
+ }
550
+ ),
551
+ /* @__PURE__ */ jsx2(
552
+ "button",
553
+ {
554
+ className: "mcp-btn-send",
555
+ onClick: send,
556
+ disabled: loading || !input.trim(),
557
+ style: {
558
+ background: loading || !input.trim() ? t.textMuted + "55" : primaryColor,
559
+ color: "#fff",
560
+ border: "none",
561
+ borderRadius: 12,
562
+ width: 40,
563
+ height: 40,
564
+ display: "flex",
565
+ alignItems: "center",
566
+ justifyContent: "center",
567
+ cursor: loading || !input.trim() ? "not-allowed" : "pointer",
568
+ transition: "all .2s cubic-bezier(.4,0,.2,1)",
569
+ flexShrink: 0
570
+ },
571
+ children: /* @__PURE__ */ jsx2("img", { src: send_default, width: 24 })
572
+ }
573
+ )
574
+ ]
575
+ }
576
+ )
577
+ ]
578
+ }
579
+ ),
580
+ /* @__PURE__ */ jsx2("style", { children: `
581
+ @keyframes msgSlideIn {
582
+ from { opacity: 0; transform: translateY(6px); }
583
+ to { opacity: 1; transform: translateY(0); }
584
+ }
585
+ ` })
586
+ ] });
587
+ }
588
+ export {
589
+ MCPAgent
590
+ };
@@ -0,0 +1,3 @@
1
+ <svg width="24px" height="24px" viewBox="0 0 32 32" id="icon" xmlns="http://www.w3.org/2000/svg">
2
+ <path fill="#ffffff" d="M27.71,4.29a1,1,0,0,0-1.05-.23l-22,8a1,1,0,0,0,0,1.87l8.59,3.43L19.59,11,21,12.41l-6.37,6.37,3.44,8.59A1,1,0,0,0,19,28h0a1,1,0,0,0,.92-.66l8-22A1,1,0,0,0,27.71,4.29Z"/>
3
+ </svg>
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "react-mcp-chatbot",
3
+ "version": "0.0.1",
4
+ "description": "A React MCP-style AI chatbot component with tool calling and backend integration",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js",
12
+ "require": "./dist/index.js"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "sideEffects": false,
19
+ "scripts": {
20
+ "build": "tsup src/index.tsx --format esm --dts --clean",
21
+ "dev": "tsup src/index.tsx --watch",
22
+ "prepublishOnly": "npm run build"
23
+ },
24
+ "peerDependencies": {
25
+ "react": ">=18",
26
+ "react-dom": ">=18"
27
+ },
28
+ "dependencies": {
29
+ "react-markdown": "^10.1.0",
30
+ "remark-gfm": "^4.0.1"
31
+ },
32
+ "devDependencies": {
33
+ "@types/react": "^19.2.10",
34
+ "tsup": "^8.5.1",
35
+ "typescript": "^5.9.3",
36
+ "vite": "^7.3.1"
37
+ },
38
+ "license": "MIT",
39
+ "keywords": [
40
+ "react",
41
+ "ai",
42
+ "chatbot",
43
+ "mcp",
44
+ "tool-calling",
45
+ "react-component"
46
+ ],
47
+ "repository": {
48
+ "type": "git",
49
+ "url": "https://github.com/TigranZakharyan/react-mcp-chatbot"
50
+ },
51
+ "homepage": "https://github.com/TigranZakharyan/react-mcp-chatbot#readme",
52
+ "bugs": {
53
+ "url": "https://github.com/TigranZakharyan/react-mcp-chatbot/issues"
54
+ },
55
+ "engines": {
56
+ "node": ">=18"
57
+ }
58
+ }