MCP服务器发现工具

一款基于AI的聊天机器人,帮助用户通过自然语言对话发现和探索MCP服务器及相关工具。

  • by suhaniawasthi10
  • TypeScript
  • 本地部署
  • 更新于
在 GitHub 查看 suhaniawasthi10/MCPFinderChatbot

使用说明

MCP服务器查找器

一个由人工智能驱动的聊天机器人,帮助用户发现和探索 MCP(模型上下文协议) 服务器和工具通过自然对话。使用FastAPI后端和React前端构建,并由Groq的LLM推理提供支持。

特性

  • 人工智能驱动的MCP发现 --使用自然语言搜索和查找公开可用的MCP服务器
  • 智能推荐 --根据您的特定用例获取上下文感知建议
  • 实时网络搜索 --实时SerpAPI集成,以查找最新的MCP服务器和文档
  • 流媒体响应 --带有实时工具状态指示器的服务器发送事件(SSE)
  • 对话历史 --存储在MongoDB中的持久聊天会话
  • 用户认证 --使用用户名和密码注册/登录(基于JWT)

技术栈

层 技术
前端 React 19、TypeScript、顺风CSS、Radix UI、Shadcn/UI
后端 FastAPI、Python、Uvicorn
数据库 MongoDB Atlas(电机异步驱动程序)
LLM 通过LangChain的Groq API(LLaMA 3.3 70B)
搜索 SerpAPI
认证 bcrypt+JWT
部署 DigitalOcean,PM2

项目结构

MCPFinderChatbot/
├── MCPFinder/                  # Backend
│   ├── server.py               # FastAPI app entry point
│   ├── config.py               # Environment configuration
│   ├── database.py             # MongoDB connection
│   ├── controllers/
│   │   ├── auth_controller.py  # Signup/login logic
│   │   ├── chat_controller.py  # Chat streaming logic
│   │   └── conversation_controller.py
│   ├── models/
│   │   ├── user.py             # User schema
│   │   ├── auth.py             # Auth request/response models
│   │   ├── message.py          # Message schema
│   │   └── conversation.py     # Conversation schema
│   ├── routes/
│   │   ├── auth_routes.py      # /api/auth/*
│   │   ├── chat_routes.py      # /api/chat
│   │   └── conversation_routes.py # /api/conversations/*
│   ├── services/
│   │   └── llm_service.py      # LangChain agent with MCP search tools
│   └── utils/
│       ├── jwt_handler.py      # Token creation/verification
│       └── dependencies.py     # FastAPI auth dependency
├── MCPFinderFrontend/          # Frontend
│   ├── src/
│   │   ├── App.tsx             # Routes and app shell
│   │   ├── pages/
│   │   │   ├── HomePage.tsx    # Landing page
│   │   │   ├── LoginPage.tsx   # Login form
│   │   │   ├── SignupPage.tsx  # Signup form
│   │   │   └── ChatPage.tsx    # Main chat interface
│   │   └── components/ui/      # Shadcn/ui components
│   └── package.json
└── ecosystem.config.js         # PM2 deployment config

API终点

方法 端点 描述 身份验证
POST /api/auth/signup 创建新帐户 否
POST /api/auth/login 使用用户名/密码登录 否
GET /api/conversations 列出用户的对话 是
POST /api/conversations 创建新对话 是
GET /api/conversations/:id 获取对话消息 是
DELETE /api/conversations/:id 删除对话 是
POST /api/chat 发送消息(SSE流媒体) 是
GET /health 健康检查 否

入门指南

先决条件

后端设置

cd MCPFinder
cp env.example .env
# Fill in your environment variables in .env
pip install -r requirements.txt
uvicorn server:app --reload --port 8000

前端设置

cd MCPFinderFrontend
cp .env.example .env
# Set REACT_APP_BACKEND_URL in .env
npm install
npm start

环境变量

后端 (MCPFinder/.env):

MONGO_URL=mongodb+srv://...
DB_NAME=mcp_finder
xAI_KEY=your_groq_api_key
SERPAPI_KEY=your_serpapi_key
JWT_SECRET=your_jwt_secret
JWT_ALGORITHM=HS256
JWT_EXPIRATION_HOURS=24
CORS_ORIGINS=http://localhost:3000

前端 (MCPFinderFrontend/.env):

REACT_APP_BACKEND_URL=http://localhost:8000

运作原理

  1. 用户使用用户名/密码注册或登录
  2. 用户用自然语言询问有关MCP服务器的问题
  3. LangChain代理决定调用哪些工具:
    • search_mcp_servers --使用MCP特定过滤器进行多查询SerpAPI搜索
    • search_web --针对更广泛背景的一般网络搜索
  4. 工具状态通过SSE实时流式传输到前端
  5. 最终的AI响应以打字动画的形式显示
  6. 对话和消息在MongoDB中持久化

部署

部署在 数字海洋 液滴使用 PM2 作为流程管理者。

pm2 start ecosystem.config.js