Thanks to visit codestin.com
Credit goes to github.com

Skip to content

A modern React-based client for Model Context Protocol (MCP) servers with AI-powered chat interface, Azure OpenAI integration, and advanced trace debugging capabilities.

License

Notifications You must be signed in to change notification settings

Darko-Martinovic/react-mcp-client

Repository files navigation

React MCP Client

A modern React TypeScript application for interacting with Model Context Protocol (MCP) servers, featuring AI-powered chat with Azure OpenAI integration, multilingual support, and advanced data visualization.

✨ Key Features

  • πŸ€– AI-Powered Chat: Interactive interface with Azure OpenAI integration
  • 🌍 Multilingual Support: English, French, and Dutch with language-specific chat storage
  • πŸ“Š Data Visualization: Automatic charts (bar, pie, line) and interactive tables
  • πŸ’Ύ Manual Save/Import: Conversations can be manually saved and imported (JSON, TXT, MD)
  • 🍞 Toast Notifications: Modern toast system for user feedback
  • πŸ” Azure Search Integration: RAG capabilities with Azure Cognitive Search
  • πŸ“ˆ Excel Export: Professional Excel exports with formatting and metadata
  • πŸ› Debug Tracing: Comprehensive trace functionality for troubleshooting

🎬 Demo Video

See the React MCP Client in action with intelligent query processing and data visualization:

SQ_V2.mp4

The demo showcases smart query processing, automatic data visualization, and multilingual chat capabilities.

πŸ› οΈ Technology Stack

  • Frontend: React 18 + TypeScript, Vite, CSS Modules
  • AI Integration: Azure OpenAI, Azure Search
  • Charts: Recharts library for data visualization
  • Export: XLSX library for Excel generation
  • i18n: react-i18next with browser language detection

πŸ“‹ Quick Start

Prerequisites

  • Node.js 16+
  • Azure OpenAI account and API key
  • MCP Server running on port 9090
  • Proxy server running on port 5002

Installation

  1. Clone and install

    git clone <repository-url>
    cd react-mcp-client
    npm install
  2. Environment Setup Create .env file:

    VITE_AOAI_ENDPOINT=https://your-openai-resource.openai.azure.com/openai/deployments/your-model/chat/completions?api-version=2023-05-15
    VITE_AOAI_APIKEY=your-azure-openai-api-key
    VITE_MCP_SERVER_URL=http://localhost:9090
    
    # Optional - for RAG capabilities
    AZURE_SEARCH_ENDPOINT=https://your-search-service.search.windows.net
    AZURE_SEARCH_APIKEY=your-search-admin-key
    AZURE_SEARCH_INDEX=your-index-name
  3. Start the applications

    # Start proxy server (handles frontend ↔ MCP communication)
    node search-proxy.cjs
    
    # Start development server
    npm run dev
  4. Open browser: Navigate to http://localhost:5174

πŸ—οΈ Project Architecture

src/
β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ App.tsx                 # Main app & session management
β”‚   β”œβ”€β”€ Chat/Chat.tsx          # Chat interface & data visualization
β”‚   β”œβ”€β”€ Toast/                 # Toast notification system
β”‚   β”œβ”€β”€ DataVisualization/     # Chart rendering & table components
β”‚   └── LanguageSelector.tsx   # Multi-language support
β”œβ”€β”€ services/
β”‚   β”œβ”€β”€ azureOpenAI.ts         # Azure OpenAI integration
β”‚   β”œβ”€β”€ azureSearch.ts         # Azure Search/RAG capabilities
β”‚   β”œβ”€β”€ mcpServer.ts           # MCP server communication
β”‚   └── chatService.ts         # Business logic & parameter extraction
β”œβ”€β”€ i18n/
β”‚   └── locales/              # Translation files (en, fr, nl)
└── hooks/
    └── useToast.ts           # Toast notification hook

🎯 How It Works

Frontend (React) β†’ Vite Proxy (/api/*) β†’ Proxy Server (5002) β†’ MCP Server (9090) β†’ Data Processing β†’ UI Rendering
  1. User Input: User submits query through React chat interface
  2. AI Processing: Azure OpenAI analyzes intent and generates function calls
  3. Parameter Extraction: Smart extraction of dates, thresholds, categories, suppliers
  4. Proxy Communication: Frontend calls /api endpoints, proxied to search-proxy.cjs on port 5002
  5. MCP Communication: Proxy server communicates with MCP server on port 9090
  6. Data Processing: Intelligent formatting (summary vs detailed data)
  7. Visualization: Automatic chart/table rendering with export capabilities

πŸ’‘ Usage Examples

Chat Queries

  • "Show me recent sales data" β†’ Applies 30-day date range, renders charts
  • "What products are low in stock?" β†’ Extracts thresholds, filters data
  • "Category performance this month" β†’ Auto-applies date filters, shows breakdown

Data Export

  • Manual Save: Click πŸ’Ύ button to save chat to localStorage
  • Import: Click πŸ“₯ to import conversations (JSON/TXT/MD)
  • Excel Export: Export data tables to formatted Excel files

Language Support

  • Switch between πŸ‡ΊπŸ‡Έ English, πŸ‡«πŸ‡· French, πŸ‡³πŸ‡± Dutch
  • Each language maintains separate chat history
  • All UI elements fully translated

πŸ› Troubleshooting

Common Issues

Azure OpenAI Connection

  • Verify .env file has correct VITE_AOAI_ENDPOINT and VITE_AOAI_APIKEY
  • Ensure endpoint URL includes full path with API version

MCP Server Issues

  • Check MCP server is running on port 9090
  • Check proxy server is running on port 5002
  • Verify proxy can reach MCP server endpoints
  • Verify server returns data in expected JSON format

Data Visualization

  • Ensure data has numeric values and categories for charts
  • Check browser console for rendering errors

Language/Storage Issues

  • Check browser localStorage for language-specific keys
  • Translation files should load in browser network tab

πŸš€ Available Scripts

  • npm run dev - Start development server
  • npm run build - Build for production
  • npm run preview - Preview production build
  • npm run lint - Run code quality checks

πŸ“„ License

MIT License - see LICENSE file for details.

πŸ”— Resources

πŸ›‘οΈ Disclaimer

This project was developed independently on personal equipment and in personal time.
It is not affiliated with, endorsed by, or derived from the intellectual property of EPAM Systems or any of its clients.
All examples, configurations, and data are generic and intended solely for demonstration and educational purposes.


Built with ❀️ using React + TypeScript + MCP

About

A modern React-based client for Model Context Protocol (MCP) servers with AI-powered chat interface, Azure OpenAI integration, and advanced trace debugging capabilities.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published