MCP Chat Application
A web-based chat application that intelligently finds and recommends MCP (Model Context Protocol) servers based on user requirements and integrates them into chat sessions for enhanced AI capabilities.
Features
- 💬 Interactive Chat Interface - Clean, responsive chat UI with real-time messaging
- 🔍 Smart MCP Server Discovery - Intelligent recommendation engine for finding relevant MCP servers
- 🔧 Dynamic Server Integration - Add/remove MCP servers during chat sessions
- 🎯 Context-Aware Suggestions - AI-powered recommendations based on conversation context
- 🚀 Real-time Processing - Fast response times with efficient agent processing
Architecture
System Components
Frontend (/frontend)
- React + TypeScript + Vite + Tailwind CSS
- Real-time chat interface and MCP server management
- Server browsing, filtering, and session management
Backend (/backend)
- Node.js + Express + TypeScript
- RESTful API for chat sessions and MCP server catalog
- Recommendation engine and business logic
Agent Service (/agent-service)
- Python + FastAPI + OpenAI integration
- AI message processing with MCP server tool execution
- Context management and tool call orchestration
Data Flow```
User Message → Frontend → Backend API → Agent Service → MCP Servers
↓ ↓ ↓
Session Storage ← Response ← AI Processing
## Quick Start
1. **Install dependencies:**```bash
npm run install:all
- Set up environment variables:```bash
Backend (.env)
OPENAI_API_KEY=your_openai_key
CORS_ORIGIN=http://localhost:5173
AGENT_SERVICE_URL=http://localhost:8000
Agent Service (.env)
OPENAI_API_KEY=your_openai_key
3. **Start all services:**```bash
npm run dev
This starts:
- Frontend: http://localhost:5173
- Backend: http://localhost:3001
- Agent Service: http://localhost:8000
Project Structure```
mcp-chat-app/
├── frontend/ # React frontend
│ ├── src/
│ │ ├── components/ # UI components
│ │ ├── contexts/ # React contexts
│ │ └── services/ # API services
├── backend/ # Node.js API server
│ ├── src/
│ │ ├── services/ # Business logic
│ │ ├── data/ # MCP server catalog
│ │ └── routes/ # API endpoints
├── agent-service/ # Python agent service
│ ├── main.py # FastAPI application
│ └── requirements.txt # Python dependencies
└── shared/ # Shared TypeScript types
## API Endpoints
### Chat Management
- `POST /api/chat/sessions` - Create new chat session
- `GET /api/chat/sessions/:id` - Get session details
- `POST /api/chat/sessions/:id/messages` - Send message
- `GET /api/chat/sessions/:id/messages` - Get message history
### MCP Server Management
- `GET /api/mcp/servers` - List all available servers
- `POST /api/mcp/servers/search` - Search servers by query
- `POST /api/mcp/servers/recommend` - Get server recommendations
- `POST /api/chat/sessions/:id/servers` - Add server to session
- `DELETE /api/chat/sessions/:id/servers/:serverId` - Remove server
## MCP Server Integration
The application includes a curated catalog of MCP servers with capabilities for:
- **File Operations** - Read, write, and manage files
- **Database Access** - PostgreSQL, SQLite, Redis integration
- **Web Services** - Search engines, content extraction
- **Development Tools** - GitHub, Docker, cloud services
- **Productivity** - Email, calendar, note-taking
Servers are automatically recommended based on conversation context and user intent.
## Development
### Building```bash
# Build all components
npm run build
# Build individual components
npm run build:frontend
npm run build:backend
Linting```bash
Backend
cd backend && npm run lint
Frontend
cd frontend && npm run lint
```
Deployment
The application is designed for containerized deployment with Docker. Each service can be deployed independently:
- Frontend: Static files served by nginx
- Backend: Node.js server with Express
- Agent Service: Python FastAPI application
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
License
MIT License - see LICENSE file for details
