@henkas/orderfood 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +70 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -28322,7 +28322,7 @@ function extractZipCode(location) {
|
|
|
28322
28322
|
return `${normalized.slice(0, 4)} ${normalized.slice(4)}`;
|
|
28323
28323
|
}
|
|
28324
28324
|
function slugify(input) {
|
|
28325
|
-
return input.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").
|
|
28325
|
+
return input.trim().toLowerCase().replace(/[^a-z0-9]+/g, "-").split("-").filter(Boolean).join("-");
|
|
28326
28326
|
}
|
|
28327
28327
|
function sortRestaurants(restaurants, sortBy) {
|
|
28328
28328
|
const sorted = [...restaurants];
|
|
@@ -28599,6 +28599,74 @@ function registerAccountTools(server2) {
|
|
|
28599
28599
|
);
|
|
28600
28600
|
}
|
|
28601
28601
|
|
|
28602
|
+
// src/tools/health.ts
|
|
28603
|
+
var platformSchema5 = external_exports.enum(["ubereats", "thuisbezorgd"]);
|
|
28604
|
+
function registerHealthTools(server2) {
|
|
28605
|
+
server2.tool(
|
|
28606
|
+
"ping_platform",
|
|
28607
|
+
'Check whether a platform is reachable and credentials are valid. Returns { platform, status, latency_ms }. Call this when you receive auth or network errors to diagnose the issue before retrying a complex flow. status values: "ok" | "auth_error" | "rate_limited" | "error"',
|
|
28608
|
+
{ platform: platformSchema5 },
|
|
28609
|
+
async ({ platform }) => {
|
|
28610
|
+
const start = Date.now();
|
|
28611
|
+
try {
|
|
28612
|
+
const client = getClient(platform);
|
|
28613
|
+
await client.getPaymentMethods();
|
|
28614
|
+
return {
|
|
28615
|
+
content: [{
|
|
28616
|
+
type: "text",
|
|
28617
|
+
text: JSON.stringify({ platform, status: "ok", latency_ms: Date.now() - start })
|
|
28618
|
+
}]
|
|
28619
|
+
};
|
|
28620
|
+
} catch (e2) {
|
|
28621
|
+
const latency_ms = Date.now() - start;
|
|
28622
|
+
if (e2 instanceof AuthError) {
|
|
28623
|
+
return {
|
|
28624
|
+
content: [{
|
|
28625
|
+
type: "text",
|
|
28626
|
+
text: JSON.stringify({
|
|
28627
|
+
platform,
|
|
28628
|
+
status: "auth_error",
|
|
28629
|
+
message: `Credentials missing or expired. Run: npx @henkas/orderfood setup --platform ${platform}`,
|
|
28630
|
+
latency_ms
|
|
28631
|
+
})
|
|
28632
|
+
}],
|
|
28633
|
+
isError: true
|
|
28634
|
+
};
|
|
28635
|
+
}
|
|
28636
|
+
if (e2 instanceof RateLimitError) {
|
|
28637
|
+
return {
|
|
28638
|
+
content: [{
|
|
28639
|
+
type: "text",
|
|
28640
|
+
text: JSON.stringify({
|
|
28641
|
+
platform,
|
|
28642
|
+
status: "rate_limited",
|
|
28643
|
+
message: e2.message,
|
|
28644
|
+
retry_after: e2.retry_after,
|
|
28645
|
+
latency_ms
|
|
28646
|
+
})
|
|
28647
|
+
}],
|
|
28648
|
+
isError: true
|
|
28649
|
+
};
|
|
28650
|
+
}
|
|
28651
|
+
const err = e2;
|
|
28652
|
+
return {
|
|
28653
|
+
content: [{
|
|
28654
|
+
type: "text",
|
|
28655
|
+
text: JSON.stringify({
|
|
28656
|
+
platform,
|
|
28657
|
+
status: "error",
|
|
28658
|
+
message: err.message ?? String(e2),
|
|
28659
|
+
...err.code !== void 0 && { code: err.code },
|
|
28660
|
+
latency_ms
|
|
28661
|
+
})
|
|
28662
|
+
}],
|
|
28663
|
+
isError: true
|
|
28664
|
+
};
|
|
28665
|
+
}
|
|
28666
|
+
}
|
|
28667
|
+
);
|
|
28668
|
+
}
|
|
28669
|
+
|
|
28602
28670
|
// src/index.ts
|
|
28603
28671
|
var server = new McpServer({
|
|
28604
28672
|
name: "orderfood",
|
|
@@ -28608,6 +28676,7 @@ registerDiscoveryTools(server);
|
|
|
28608
28676
|
registerCartTools(server);
|
|
28609
28677
|
registerOrderTools(server);
|
|
28610
28678
|
registerAccountTools(server);
|
|
28679
|
+
registerHealthTools(server);
|
|
28611
28680
|
var transport = new StdioServerTransport();
|
|
28612
28681
|
await server.connect(transport);
|
|
28613
28682
|
/*! Bundled license information:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@henkas/orderfood",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "MCP server for AI-driven food delivery on Uber Eats and Thuisbezorgd",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"@modelcontextprotocol/sdk": "^1.9.0",
|
|
26
26
|
"node-machine-id": "^1.1.12",
|
|
27
27
|
"zod": "^3.23.8",
|
|
28
|
+
"@orderfood/shared": "0.1.0",
|
|
28
29
|
"@orderfood/ubereats-client": "0.1.0",
|
|
29
|
-
"@orderfood/thuisbezorgd-client": "0.1.0"
|
|
30
|
-
"@orderfood/shared": "0.1.0"
|
|
30
|
+
"@orderfood/thuisbezorgd-client": "0.1.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/node": "^20.14.0",
|