Skip to content

Commit 901b1a0

Browse files
committed
feat: Typescript dog-facts MCP server that authenticates with OAuth
1 parent 8436739 commit 901b1a0

File tree

19 files changed

+2826
-8
lines changed

19 files changed

+2826
-8
lines changed

.github/dependabot.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,16 @@ updates:
120120
prefix: "chore(deps)"
121121
rebase-strategy: "disabled"
122122

123+
- package-ecosystem: npm
124+
directory: "/examples/servers/dog-facts"
125+
schedule:
126+
interval: monthly
127+
open-pull-requests-limit: 10
128+
versioning-strategy: increase
129+
commit-message:
130+
prefix: "chore(deps)"
131+
rebase-strategy: "disabled"
132+
123133
- package-ecosystem: npm
124134
directory: "/e2e_tests/typescript"
125135
schedule:

.github/workflows/cdk-checks.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,3 +195,45 @@ jobs:
195195
working-directory: ./examples/servers/cat-facts
196196
env:
197197
CDK_DEFAULT_ACCOUNT: "000000000000"
198+
199+
check_dog_facts_server:
200+
name: Check Typescript-based Dog Facts Server
201+
runs-on: ubuntu-latest
202+
permissions:
203+
contents: read
204+
timeout-minutes: 15
205+
steps:
206+
- uses: actions/checkout@v4
207+
208+
- name: "Set up Typescript"
209+
uses: actions/setup-node@v4
210+
with:
211+
node-version: 20
212+
213+
- name: Install CDK CLI
214+
run: npm install -g aws-cdk
215+
216+
- name: Build and link local package
217+
run: |
218+
npm ci
219+
npm audit --audit-level critical
220+
npm run build
221+
npm link
222+
working-directory: ./src/typescript
223+
224+
- name: Install dependencies
225+
run: |
226+
npm ci
227+
npm audit --audit-level critical
228+
npm link @aws/run-mcp-servers-with-aws-lambda
229+
working-directory: ./examples/servers/dog-facts
230+
231+
- name: Build
232+
run: npm run build
233+
working-directory: ./examples/servers/dog-facts
234+
235+
- name: Synthesize CDK stack
236+
run: cdk synth --app 'node lib/dog-facts-mcp-server.js'
237+
working-directory: ./examples/servers/dog-facts
238+
env:
239+
CDK_DEFAULT_ACCOUNT: "000000000000"

.versionrc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@
5050
"filename": "examples/servers/cat-facts/package-lock.json",
5151
"type": "json"
5252
},
53+
{
54+
"filename": "examples/servers/dog-facts/package.json",
55+
"type": "json"
56+
},
57+
{
58+
"filename": "examples/servers/dog-facts/package-lock.json",
59+
"type": "json"
60+
},
5361
{
5462
"filename": "examples/chatbots/typescript/package.json",
5563
"type": "json"

DEVELOP.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ The example chatbot client will communicate with five servers:
1212
2. a Lambda function-based **mcpdoc** MCP server (Python). Ask questions like "What documentation sources do you have access to?".
1313
3. a Lambda function-based **weather-alerts** MCP server (Typescript). Ask questions like "Are there any weather alerts right now?".
1414
4. a Lambda function-based **cat-facts** MCP server (Typescript). Ask questions like "Tell me something about cats".
15-
5. a [local **fetch** MCP server](https://github.com/modelcontextprotocol/servers/tree/main/src/fetch). Ask questions like "Who is Tom Cruise?".
15+
5. a Lambda function-based **dog-facts** MCP server (Typescript). Ask questions like "Tell me something about dogs".
16+
6. a [local **fetch** MCP server](https://github.com/modelcontextprotocol/servers/tree/main/src/fetch). Ask questions like "Who is Tom Cruise?".
1617

1718
### Setup
1819

@@ -150,6 +151,20 @@ npm run build
150151
cdk deploy --app 'node lib/cat-facts-mcp-server.js'
151152
```
152153

154+
Deploy the Lambda 'dog-facts' function - the deployed function will be named "mcp-server-dog-facts".
155+
156+
```bash
157+
cd examples/servers/dog-facts/
158+
159+
npm install
160+
161+
npm link @aws/run-mcp-servers-with-aws-lambda
162+
163+
npm run build
164+
165+
cdk deploy --app 'node lib/dog-facts-mcp-server.js'
166+
```
167+
153168
### Run the example Python client
154169

155170
Run the Python-based chatbot client:

e2e_tests/clean_up_integ_test.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,6 @@ cdk destroy --force --app 'node lib/weather-alerts-mcp-server.js'
2323

2424
cd ../cat-facts/
2525
cdk destroy --force --app 'node lib/cat-facts-mcp-server.js'
26+
27+
cd ../dog-facts/
28+
cdk destroy --force --app 'node lib/dog-facts-mcp-server.js'

e2e_tests/python/main.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ async def main() -> None:
8989
"What is the current time in Seattle?",
9090
"Are there any weather alerts right now?",
9191
"List your available documentation sources.",
92+
"Tell me a dog fact.",
9293
"Tell me a cat fact.",
9394
"Who is Tom Cruise?",
9495
]

e2e_tests/run_integ_test.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ npm link @aws/run-mcp-servers-with-aws-lambda
4141
npm run build
4242
cdk deploy --app 'node lib/cat-facts-mcp-server.js'
4343

44+
# Deploy Typescript-based dog-facts MCP server
45+
cd ../dog-facts/
46+
npm ci
47+
npm link @aws/run-mcp-servers-with-aws-lambda
48+
npm run build
49+
cdk deploy --app 'node lib/dog-facts-mcp-server.js'
50+
4451
# Configure integ tests
4552
cd ../../../e2e_tests/
4653
sed "s/INTEG_TEST_ID/$INTEG_TEST_ID/g" servers_config.integ.json > python/servers_config.json

e2e_tests/typescript/src/main.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ async function main(): Promise<void> {
3434
"What is the current time in Seattle?",
3535
"Are there any weather alerts right now?",
3636
"List your available documentation sources.",
37+
"Tell me a dog fact.",
3738
"Tell me a cat fact.",
3839
"Who is Tom Cruise?",
3940
];

examples/chatbots/typescript/servers_config.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,9 @@
1414
"functionName": "mcp-server-weather-alerts",
1515
"region": "us-east-2"
1616
}
17+
},
18+
"oAuthServers": {
19+
"dog-facts": {
20+
"serverStackName": "LambdaMcpServer-DogFacts"
1721
}
1822
}

examples/servers/cat-facts/README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,4 @@ $ node -e 'require("./lib/cat-facts-mcp-server.function.js").handler({"method":"
1212

1313
# Get a random cat fact
1414
$ node -e 'require("./lib/cat-facts-mcp-server.function.js").handler({"method":"tools/call","params":{"name":"getRandomFact","arguments":{}},"jsonrpc":"2.0","id":0}, "")'
15-
16-
# Get cat breeds
17-
$ node -e 'require("./lib/cat-facts-mcp-server.function.js").handler({"method":"tools/call","params":{"name":"getBreeds","arguments":{"limit":5}},"jsonrpc":"2.0","id":0}, "")'
18-
19-
# Get multiple cat facts
20-
$ node -e 'require("./lib/cat-facts-mcp-server.function.js").handler({"method":"tools/call","params":{"name":"getFacts","arguments":{"limit":3,"max_length":100}},"jsonrpc":"2.0","id":0}, "")'
2115
```

0 commit comments

Comments
 (0)