数字孪生MCP服务器
A. 模型上下文协议(MCP) 创建数字双胞胎助手的服务器,使用 RAG(检索增强生成)。包括用于Claude Desktop的简历/聊天UI和实时MCP端点。
实时MCP URL: https://mydigitaltwin-mcp-server.vercel.app/api/mcp
实时用户界面: https://mydigitaltwin-mcp-server.vercel.app
______________________________________________________________________
建筑
┌─────────────────────┐ ┌──────────────────────────────────────┐
│ Claude Desktop │ │ Vercel (Next.js 15) │
│ or any MCP Client │────▶│ │
│ via mcp-remote │◀────│ /api/mcp ← MCP endpoint (SSE) │
└─────────────────────┘ │ / ← Resume + Chat UI │
│ │
│ ┌────────────────┐ │
│ │ lib/vector.ts │──▶ Upstash Vector DB
│ │ Semantic Search│ (mxbai-embed-large-v1)
│ └────────────────┘ │
│ ┌────────────────┐ │
│ │ lib/groq.ts │──▶ Groq API
│ │ LLM Generation │ (LLaMA 3.1-8b-instant)
│ └────────────────┘ │
└──────────────────────────────────────┘MCP工具暴露:
| 工具 | 说明 |
|---|---|
query_digital_twin | RAG查询——搜索向量数据库,生成AI响应 |
search_profile | 语义搜索——返回原始匹配的配置文件块 |
______________________________________________________________________
技术栈
| 组件 | 技术 |
|---|---|
| 框架 | Next.js 15(应用路由器) |
| 语言 | TypeScript |
| 包管理器 | pnpm |
| 矢量数据库 | 上传矢量 |
| LLM | Groq(LLaMA 3.1-8b-instant) |
| MCP SDK | @modelcontextprotocol/SDK |
| 部署 | Vercel |
| UI | 顺风CSS(暗模式) |
______________________________________________________________________
快速开始
先决条件
1.克隆并安装
git clone https://github.com/nashibrana25-code/mydigitaltwin-mcp-server.git
cd mydigitaltwin-mcp-server/digital-twin-mcp
pnpm install2.配置环境
cp .env.example .env编辑 .env 使用您的凭据:
UPSTASH_VECTOR_REST_URL=https://your-endpoint.upstash.io
UPSTASH_VECTOR_REST_TOKEN=your-token-here
GROQ_API_KEY=gsk_your-api-key-here3.上传个人资料数据
pnpm tsx scripts/upload-profile.ts4.在本地运行
pnpm dev打开 http://localhost:3000 用于简历+聊天UI。
______________________________________________________________________
连接到克劳德桌面
添加到您的Claude桌面配置(claude_desktop_config.json):
{
"mcpServers": {
"digital-twin": {
"command": "npx",
"args": [
"-y",
"mcp-remote",
"https://mydigitaltwin-mcp-server.vercel.app/api/mcp"
]
}
}
}然后重新启动Claude Desktop。将出现两个工具: query_digital_twin 和 search_profile.
______________________________________________________________________
示例提示(适用于Claude Desktop)
- “这个人的专业背景是什么?”
用途 query_digital_twin 从配置文件生成摘要。
- “搜索任何云架构经验。”
用途 search_profile 以查找相关的配置文件块。
- “这个人适合担任高级全栈职位吗?”
用途 query_digital_twin 以根据轮廓数据评估拟合度。
______________________________________________________________________
存储库结构
├── digital-twin-mcp/ # Main application (deployed to Vercel)
│ ├── app/ # Next.js App Router
│ │ ├── page.tsx # Resume + Chat UI
│ │ └── api/mcp/route.ts # MCP endpoint
│ ├── components/ # React components
│ ├── lib/ # Vector search + Groq LLM clients
│ ├── server/ # Local MCP server (stdio)
│ ├── scripts/ # Profile upload script
│ └── tests/ # Recruiter query tests
├── docs/ # Deployment & testing docs
├── archive/ # Previous iterations & coursework
└── README.md # This file______________________________________________________________________
