Skip to content

Commit 44ddd49

Browse files
committed
chore(docs): Simplify examples
1 parent c33dc50 commit 44ddd49

File tree

7 files changed

+29
-40
lines changed

7 files changed

+29
-40
lines changed

README.md

Lines changed: 17 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@ flowchart LR
3434
end
3535
```
3636

37+
Using this library, the Lambda function will manage the lifecycle of your stdio MCP server.
38+
Each Lambda function invocation will:
39+
40+
1. start the stdio MCP server as a child process
41+
1. initialize the MCP server
42+
1. forward the incoming request to the local server
43+
1. return the server's response to the function caller
44+
1. shut down the MCP server child process
45+
3746
This library supports connecting to Lambda-based MCP servers in three ways:
3847

3948
1. The [MCP Streamable HTTP transport](https://modelcontextprotocol.io/specification/2025-06-18/basic/transports#streamable-http), using Amazon API Gateway. Typically authenticated using OAuth.
@@ -102,20 +111,6 @@ so this solution is more appropriate for service-to-service communication rather
102111

103112
<summary><b>Python server example</b></summary>
104113

105-
This project includes an
106-
[example Python Lambda function](examples/servers/time/function/index.py)
107-
that runs the simple
108-
[MCP 'time' reference server](https://github.com/modelcontextprotocol/servers/tree/main/src/time).
109-
The Lambda function bundles the [mcp-server-time package](https://pypi.org/project/mcp-server-time/).
110-
On each function invocation, the Lambda function will manage the lifecycle of the bundled MCP server.
111-
It will:
112-
113-
1. start the 'time' MCP server as a child process
114-
1. initialize the MCP server
115-
1. forward the incoming request to the local server
116-
1. return the server's response to the function caller
117-
1. shut down the MCP server child process
118-
119114
```python
120115
import sys
121116
from mcp.client.stdio import StdioServerParameters
@@ -136,26 +131,14 @@ def handler(event, context):
136131
return stdio_server_adapter(server_params, event, context)
137132
```
138133

134+
See a full, deployable example [here](examples/servers/time/).
135+
139136
</details>
140137

141138
<details>
142139

143140
<summary><b>Typescript server example</b></summary>
144141

145-
This project includes an
146-
[example Node.js Lambda function](examples/servers/weather-alerts/lib/weather-alerts-mcp-server.function.ts)
147-
that runs an [OpenAPI MCP server](https://github.com/snaggle-ai/openapi-mcp-server/)
148-
to provide a single API from [weather.gov](https://www.weather.gov/documentation/services-web-api) as a tool.
149-
The Lambda function bundles the [openapi-mcp-server package](https://www.npmjs.com/package/openapi-mcp-server).
150-
On each function invocation, the Lambda function will manage the lifecycle of the bundled MCP server.
151-
It will:
152-
153-
1. start the 'openapi-mcp-server' MCP server as a child process
154-
1. initialize the MCP server
155-
1. forward the incoming request to the local server
156-
1. return the server's response to the function caller
157-
1. shut down the MCP server child process
158-
159142
```typescript
160143
import { Handler, Context } from "aws-lambda";
161144

@@ -174,18 +157,14 @@ export const handler: Handler = async (event, context: Context) => {
174157
};
175158
```
176159

160+
See a full, deployable example [here](examples/servers/weather-alerts/).
161+
177162
</details>
178163

179164
<details>
180165

181166
<summary><b>Python client example</b></summary>
182167

183-
This project includes an
184-
[example Python MCP client](examples/chatbots/python/server_clients/lambda_function.py)
185-
that invokes the 'time' MCP server function from above.
186-
The client invokes a Lambda function named "mcp-server-time" with a payload that is compliant
187-
with the MCP protocol and returns the function's response to the caller.
188-
189168
```python
190169
from mcp import ClientSession
191170
from mcp_lambda import LambdaFunctionParameters, lambda_function_client
@@ -200,18 +179,14 @@ session = ClientSession(read, write)
200179
await session.initialize()
201180
```
202181

182+
See a full example as part of the sample chatbot [here](examples/chatbots/python/server_clients/lambda_function.py).
183+
203184
</details>
204185

205186
<details>
206187

207188
<summary><b>Typescript client example</b></summary>
208189

209-
This project includes an
210-
[example Typescript MCP client](examples/chatbots/typescript/src/server_clients/lambda_function.ts)
211-
that invokes the 'time' MCP server function from above.
212-
The client invokes a Lambda function named "mcp-server-time" with a payload that is compliant
213-
with the MCP protocol and returns the function's response to the caller.
214-
215190
```typescript
216191
import {
217192
LambdaFunctionParameters,
@@ -240,6 +215,8 @@ const transport = new LambdaFunctionClientTransport(serverParams);
240215
await client.connect(transport);
241216
```
242217

218+
See a full example as part of the sample chatbot [here](examples/chatbots/typescript/src/server_clients/lambda_function.ts).
219+
243220
</details>
244221

245222
## Related projects

examples/servers/cat-facts/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,5 @@ npm run build
2020

2121
cdk deploy --app 'node lib/cat-facts-mcp-server.js'
2222
```
23+
24+
See the [development guide](/DEVELOP.md) for full instructions to deploy and run the examples in this repository.

examples/servers/dad-jokes/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@ uv pip install -r requirements.txt
1616

1717
cdk deploy --app 'python3 cdk_stack.py'
1818
```
19+
20+
See the [development guide](/DEVELOP.md) for full instructions to deploy and run the examples in this repository.

examples/servers/dog-facts/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,5 @@ npm run build
2020

2121
cdk deploy --app 'node lib/dog-facts-mcp-server.js'
2222
```
23+
24+
See the [development guide](/DEVELOP.md) for full instructions to deploy and run the examples in this repository.

examples/servers/mcpdoc/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ uv pip install -r requirements.txt
1515

1616
cdk deploy --app 'python3 cdk_stack.py'
1717
```
18+
19+
See the [development guide](/DEVELOP.md) for full instructions to deploy and run the examples in this repository.

examples/servers/time/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ uv pip install -r requirements.txt
1515
cdk deploy --app 'python3 cdk_stack.py'
1616
```
1717

18+
See the [development guide](/DEVELOP.md) for full instructions to deploy and run the examples in this repository.
19+
1820
### Testing
1921

2022
Sample inputs:

examples/servers/weather-alerts/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ npm run build
2121
cdk deploy --app 'node lib/weather-alerts-mcp-server.js'
2222
```
2323

24+
See the [development guide](/DEVELOP.md) for full instructions to deploy and run the examples in this repository.
25+
2426
### Testing
2527

2628
Sample inputs:

0 commit comments

Comments
 (0)