无服务器MCP服务

一个在AWS Lambda和Amazon API Gateway上原生运行的Peppa MCP服务器,无需额外的桥接组件或自定义传输,支持流式HTTP传输。

  • by aal80
  • JavaScript
  • 本地部署
  • 12 星标
  • 更新于
在 GitHub 查看 aal80/peppa-mcp-server-on-lambda

使用说明

Lambda上的Peppa MCP服务器

  1. 看看 构建无服务器MCP服务器和小猪佩奇有什么关系 完整故事的博客。
  2. 此回购没有得到维护。看 此回购 有关在AWS上运行无服务器MCP服务器的更多示例。

--

Peppa MCP服务器在AWS Lambda和Amazon API网关上本地运行,无需任何额外的桥接组件或自定义传输。由于 流式HTTP v2025-03-26中引入的传输。

架构非常简单:

前提条件

  • AWS-CLI
  • 地形

说明

安装依赖项:

cd src
npm install
cd ..

引导服务器并使用MCP服务器端点设置env var:

cd terraform
terraform init
terraform plan
terraform apply
export PEPPA_MCP_SERVER_ENDPOINT=$(terraform output --raw endpoint_url) 
cd ..

注意:API网关端点可能需要几秒钟才能运行。

运行客户端:

node src/client.js

观察响应:

> node client.js
listResources response:  {
  resources: [
    {
      uri: 'peppa://timeslots',
      name: 'timeslots',
      description: 'Use this resource to get all open timeslots for ordering tickets     to the Peppa Pig Theme Park.',
      mimeType: 'text/plain'
    }
  ]
}
readResource response:  {
  contents: [
    {
      uri: 'peppa://timeslots',
      mimeType: 'text/plain',
      text: 'Available timeslots are: April 19th 2025, April 20th 2025, April 21st 2025'
    }
  ]
}
listTools response:  {
  tools: [
    {
      name: 'order-tickets',
      description: 'Use this tool to order tickets to the Peppa Pig Park.     The tool expects two parameters - timeslot and quantity.     The timeslot should be a stringified date.     The quantity should be a number.         Example:     order-tickets(timeslot: "April 19, 2025", quantity: 3)         The tool will return a text message with the order number.     ',
      inputSchema: [Object]
    }
  ]
}
callTool response:  {
  content: [
    {
      type: 'text',
      text: "You've ordered 3 tickets for April 19th, 2025.         Your order number is OINK-1234."
    }
  ]
}

了解mcp

介绍

协议规范