
awslabs/run-model-context-protocol-servers-with-aws-lambda
Developer tools이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기
AWS Lambda 함수에서 기존 모델 컨텍스트 프로토콜(MCP) 표준 기반 서버를 실행하세요
개요
이 프로젝트는 AWS Lambda 함수에서 Model Context Protocol 표준 기반 서버를 실행할 수 있게 해줍니다. 현재 대부분의 MCP 서버와 클라이언트 구현은 단일 머신 내에서 완전히 로컬 처리되어 있습니다. IDE나 Claude 데스크톱과 같은 데스크톱 애플리케이션은 MCP 서버를 자식 프로세스로 로컬에서 시작하고, 장기 실행 Stdio 스트림을 통해 각 서버와 통신합니다. 이 라이브러리는 기존 stdio MCP 서버를 Lambda 함수로 감싸는 데 도움을 줍니다. 이 함수 기반 MCP 서버는 MCP 프로토콜을 통해 단명한 HTTPS 연결을 통해 애플리케이션에서 호출할 수 있습니다. 애플리케이션은 데스크톱 기반 앱, 클라우드에서 실행되는 분산 시스템 또는 기타 아키텍처일 수 있습니다. 이 라이브러리를 사용하여 Lambda 함수는 Stdio MCP 서버의 수명 주기를 관리합니다. 각 Lambda 함수 호출은 다음과 같은 역할을 합니다: 1. stdio MCP 서버를 자식 프로세스로 시작. 1. MCP 서버 초기화 1. 들어오는 요청을 로컬 서버로 전달합니다.
개요(AI 번역)
이 프로젝트는 AWS Lambda 함수에서 Model Context Protocol 표준 기반 서버를 실행할 수 있게 해줍니다.
현재 대부분의 MCP 서버와 클라이언트 구현은 단일 머신 내에서 완전히 로컬화되어 있습니다. IDE나 Claude 데스크톱과 같은 데스크톱 애플리케이션은 MCP 서버를 자식 프로세스로 로컬에서 시작합니다 그리고 각 서버와 장기 운영 Stdio 스트림을 통해 통신합니다.
이 라이브러리는 기존 stdio MCP 서버를 Lambda 함수로 감싸는 데 도움을 줍니다. MCP 프로토콜을 사용하여 애플리케이션에서 이러한 함수 기반 MCP 서버를 호출할 수 있습니다 단명한 HTTPS 연결을 통해 사용되었습니다. 애플리케이션은 데스크톱 기반 앱, 즉 클라우드에서 실행되는 분산 시스템이 될 수 있습니다. 또는 다른 어떤 건축물도 마찬가지입니다.
이 라이브러리를 사용해 Lambda 함수가 Stdio MCP 서버의 수명 주기를 관리합니다. 각 람다 함수 호출은 다음을 수행합니다:
- 자식 프로세스로 Stdio MCP 서버를 시작합니다
- MCP 서버 초기화
- 들어오는 요청을 로컬 서버로 전달합니다
- 서버의 응답을 함수 호출자에게 반환한다
- MCP 서버 자식 프로세스 종료
이 라이브러리는 네 가지 방식으로 람다 기반 MCP 서버에 연결됩니다:
이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요.
README
원문 README의 일부입니다. 원문 보기.
Run Model Context Protocol (MCP) servers with AWS Lambda
This project enables you to run Model Context Protocol stdio-based servers in AWS Lambda functions.
Currently, most implementations of MCP servers and clients are entirely local on a single machine. A desktop application such as an IDE or Claude Desktop initiates MCP servers locally as child processes and communicates with each of those servers over a long-running stdio stream.
flowchart LR
subgraph "Your Laptop"
Host["Desktop Applicationwith MCP Clients"]
S1["MCP Server A(child process)"]
S2["MCP Server B(child process)"]
Host |"MCP Protocol(over stdio stream)"| S1
Host |"MCP Protocol(over stdio stream)"| S2
end
This library helps you to wrap existing stdio MCP servers into Lambda functions. You can invoke these function-based MCP servers from your application using the MCP protocol over short-lived HTTPS connections. Your application can then be a desktop-based app, a distributed system running in the cloud, or any other architecture.
flowchart LR
subgraph "Distributed System"
App["Your Applicationwith MCP Clients"]
S3["MCP Server A(Lambda function)"]
S4["MCP Server B(Lambda function)"]
App |"MCP Protocol(over HTTPS connection)"| S3
App |"MCP Protocol(over HTTPS connection)"| S4
end
Using this library, the Lambda function will manage the lifecycle of your stdio MCP server. Each Lambda function invocation will:
- Start the stdio MCP server as a child process
- Initialize the MCP server
- Forward the incoming request to the local server
- Return the server’s response to the function caller
- Shut down the MCP server child process
This library supports connecting to Lambda-based MCP servers in four ways:
- The MCP Streamable HTTP transport, using Amazon API Gateway. Typically authenticated using OAuth.
- The MCP Streamable HTTP transport, using Amazon Bedrock AgentCore Gateway. Authenticated using OAuth.
- A custom Streamable HTTP transport with support for SigV4, using a Lambda function URL. Authenticated with AWS IAM.
- A custom Lambda invocation transport, using the Lambda Invoke API directly. Authenticated with AWS IAM.
Determine your server parameters
설치
npx --offline my-mcp-server-typescript-module --my-server-command-line-parameter some_value