Skip to content

Commit eb95409

Browse files
committed
feat: migrate mcp server to functions host
1 parent c70b478 commit eb95409

File tree

8 files changed

+74
-32
lines changed

8 files changed

+74
-32
lines changed

azure.yaml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,8 @@ services:
1212

1313
burger-mcp:
1414
project: ./packages/burger-mcp
15-
docker:
16-
path: ./Dockerfile
17-
# We build the Dockerfile from the root of the project as we're in an NPM workspace
18-
context: ../..
1915
language: ts
20-
host: containerapp
16+
host: function
2117

2218
burger-webapp:
2319
project: ./packages/burger-webapp

packages/burger-mcp/.dockerignore

Lines changed: 0 additions & 4 deletions
This file was deleted.

packages/burger-mcp/Dockerfile

Lines changed: 0 additions & 21 deletions
This file was deleted.

packages/burger-mcp/function.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"bindings": [
3+
{
4+
"authLevel": "anonymous",
5+
"type": "httpTrigger",
6+
"direction": "in",
7+
"name": "req",
8+
"methods": ["get", "post", "put", "delete", "patch", "head", "options"],
9+
"route": "{*route}"
10+
},
11+
{
12+
"type": "http",
13+
"direction": "out",
14+
"name": "res"
15+
}
16+
]
17+
}

packages/burger-mcp/host.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"version": "2.0",
3+
"extensions": {
4+
"http": {
5+
"routePrefix": ""
6+
}
7+
},
8+
"customHandler": {
9+
"description": {
10+
"defaultExecutablePath": "node",
11+
"workingDirectory": "",
12+
"arguments": ["lib/server.js"]
13+
},
14+
"enableForwardingHttpRequest": true,
15+
"enableHttpProxyingRequest": true
16+
}
17+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"IsEncrypted": false,
3+
"Values": {
4+
"FUNCTIONS_WORKER_RUNTIME": "custom"
5+
}
6+
}

packages/burger-mcp/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
"dev:local": "tsx watch src/local.ts",
1313
"build": "tsc",
1414
"clean": "rimraf lib",
15-
"docker:build": "docker build -t burger-mcp -f ./Dockerfile ../..",
16-
"docker:run": "docker run --rm -p 3000:3000 burger-mcp"
15+
"update:local-settings": "node ./scripts/update-local-settings.mjs",
16+
"postinstall": "npm run update:local-settings"
1717
},
1818
"keywords": [],
1919
"author": "Microsoft",
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env node
2+
/*
3+
* Creates local.settings.json file for the Azure Functions.
4+
* Uses .env file for loading environment variables.
5+
* Usage: update-local-settings.mjs
6+
*/
7+
8+
import path from 'node:path';
9+
import { writeFileSync } from 'node:fs';
10+
import { fileURLToPath } from 'node:url';
11+
12+
const __filename = fileURLToPath(import.meta.url);
13+
const __dirname = path.dirname(__filename);
14+
15+
let settings = {
16+
FUNCTIONS_WORKER_RUNTIME: 'custom',
17+
};
18+
const settingsFilePath = path.join(__dirname, '../local.settings.json');
19+
20+
writeFileSync(
21+
settingsFilePath,
22+
JSON.stringify(
23+
{
24+
IsEncrypted: false,
25+
Values: settings,
26+
},
27+
null,
28+
2,
29+
),
30+
);
31+
console.log('local.settings.json file updated successfully.');

0 commit comments

Comments
 (0)