mcp问阿奇尔
MCP服务器为工具和交互式应用程序供电 ask.archil.io.作为AWS Lambda函数部署,它公开了标准MCP工具和 MCP应用程序 --在对话中直接呈现交互式HTML UI的工具。
可用工具
| 工具 | 类型 | 描述 |
|---|---|---|
add-numbers | 工具 | 添加两个数字(演示工具) |
get-resume | MCP应用程序 | 交互式PDF简历查看器(从S3获取PDF) |
get-architecture | MCP应用程序 | 解释ask.archil.io如何构建的动画架构图 |
get-archils-work-experience | MCP应用程序 | Archil专业工作经验和项目的互动概述 |
MCP应用程序
MCP应用程序是工具+资源对。调用时,该工具返回 resourceUri 指向一个自包含的单文件HTML包。MCP主机获取该资源,并将其呈现在通过AppBridge/PostMessageTransport连接的沙盒iframe中。
图案:
registerAppTool()--将工具注册到_meta.ui.resourceUri元数据registerAppResource()--将编译后的HTML包作为MCP资源提供- 内部的React应用程序使用
useApp从@modelcontextprotocol/ext-apps/react接收工具结果并与主机通信
每个应用程序都是用Vite+React+Tailwind构建的+ vite-plugin-singlefile 变成一个独立的 .html 归档 dist/mcp-lambda/.
项目结构
src/
├── handler.ts # Express HTTP server (Lambda Web Adapter)
├── server.ts # MCP server — registers all tools + apps
├── tools/ # Standard MCP tools
│ ├── get-alerts.ts
│ ├── get-forecast.ts
│ └── add-numbers.ts
├── apps/ # MCP Apps (tool + resource + React UI)
│ ├── get-resume/
│ │ ├── get-resume-app.ts # Server: registerAppTool + registerAppResource
│ │ ├── vite.config.ts
│ │ ├── get-resume-app.html
│ │ └── src/get-resume-app.tsx
│ ├── get-architecture/
│ │ ├── get-architecture-app.ts
│ │ ├── vite.config.ts
│ │ ├── get-architecture-app.html
│ │ └── src/get-architecture-app.tsx
│ └── get-archils-work-experience/
│ ├── get-archils-work-experience-app.ts
│ ├── vite.config.ts
│ ├── get-archils-work-experience-app.html
│ └── src/get-archils-work-experience-app.tsx
├── types/types.ts # defineTool factory
├── components/ # Shared React components (pdf-viewer, ui/)
├── styles/globals.css # Shared Tailwind styles
└── utils/helpers.ts
cdk/ # AWS CDK infrastructure
scripts/mcp-proxy.ts # Local dev: proxies MCP Inspector → Lambda
dist/mcp-lambda/ # Build output (bundled JS + HTML apps)构建命令
npm run build # Full build: typecheck + apps + esbuild + CDK synth
npm run build:apps # Build all MCP App HTML bundles
npm run build:app:get-resume # Build resume app only
npm run build:app:get-architecture # Build architecture app only
npm run build:app:get-archils-work-experience # Build work experience app only
npm run typecheck # TypeScript type check (no emit)
npm run dev # Watch apps + start MCP proxy for local dev
npm run deploy # Deploy to AWS (prod)部署
服务器使用Lambda Web适配器作为Node 24 AWS Lambda函数运行。MCP端点位于 /mcp (POST、流式HTTP传输)。
基础设施定义见 cdk/ 并使用AWS CDK进行部署。
