@tinycloud/mcp 0.8.7-beta.3 → 0.8.7
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/README.md +8 -2
- package/dist/cli.cjs +3 -3
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +3 -3
- package/dist/cli.js.map +1 -1
- package/dist/http-cli.cjs +18 -19
- package/dist/http-cli.cjs.map +1 -1
- package/dist/http-cli.js +18 -19
- package/dist/http-cli.js.map +1 -1
- package/dist/http.cjs +18 -14
- package/dist/http.cjs.map +1 -1
- package/dist/http.d.cts +0 -1
- package/dist/http.d.ts +0 -1
- package/dist/http.js +18 -14
- package/dist/http.js.map +1 -1
- package/dist/index.cjs +18 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +18 -14
- package/dist/index.js.map +1 -1
- package/dist/server.cjs +3 -3
- package/dist/server.cjs.map +1 -1
- package/dist/server.js +3 -3
- package/dist/server.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -522,7 +522,7 @@ function outcomeCode(result) {
|
|
|
522
522
|
// package.json
|
|
523
523
|
var package_default = {
|
|
524
524
|
name: "@tinycloud/mcp",
|
|
525
|
-
version: "0.8.7
|
|
525
|
+
version: "0.8.7",
|
|
526
526
|
description: "TinyCloud delegated operations MCP server",
|
|
527
527
|
keywords: [
|
|
528
528
|
"tinycloud",
|
|
@@ -593,9 +593,9 @@ var package_default = {
|
|
|
593
593
|
dependencies: {
|
|
594
594
|
"@modelcontextprotocol/node": "2.0.0-beta.5",
|
|
595
595
|
"@modelcontextprotocol/server": "2.0.0-beta.5",
|
|
596
|
-
"@tinycloud/node-sdk": "3.
|
|
596
|
+
"@tinycloud/node-sdk": "3.10.0",
|
|
597
597
|
"@tinycloud/node-sdk-wasm": "1.7.8",
|
|
598
|
-
"@tinycloud/operations": "0.7.
|
|
598
|
+
"@tinycloud/operations": "0.7.10",
|
|
599
599
|
jose: "6.2.4"
|
|
600
600
|
},
|
|
601
601
|
devDependencies: {
|
|
@@ -2200,6 +2200,7 @@ function samePendingRequest(pending, expected) {
|
|
|
2200
2200
|
|
|
2201
2201
|
// src/http.ts
|
|
2202
2202
|
var REQUIRED_SCOPE = "tinycloud:mcp";
|
|
2203
|
+
var MCP_CORS_ALLOWED_HEADERS = "Authorization, Content-Type, Accept, Mcp-Protocol-Version, Mcp-Session-Id, Last-Event-ID, Mcp-Method, Mcp-Name";
|
|
2203
2204
|
var LOCAL_CLI_PACKAGE = ["@tinycloud", "cli"].join("/");
|
|
2204
2205
|
var LOCAL_MCP_PACKAGE = ["@tinycloud", "mcp"].join("/");
|
|
2205
2206
|
function createHostedMcpApp(config) {
|
|
@@ -2520,8 +2521,8 @@ Local alternative: install \`${LOCAL_CLI_PACKAGE}\` and \`${LOCAL_MCP_PACKAGE}\`
|
|
|
2520
2521
|
if (url.pathname === callbackPath) {
|
|
2521
2522
|
if (request.method === "OPTIONS") return callbackCors(new Response(null, { status: 204 }), config.openkeyHost);
|
|
2522
2523
|
if (request.method !== "POST") return methodNotAllowed("POST");
|
|
2523
|
-
const
|
|
2524
|
-
if (
|
|
2524
|
+
const originFailure = validateCallbackOrigin(request, config.openkeyHost);
|
|
2525
|
+
if (originFailure !== void 0) return callbackCors(originFailure, config.openkeyHost);
|
|
2525
2526
|
try {
|
|
2526
2527
|
await store.completeApproval(requiredState(url), request);
|
|
2527
2528
|
return callbackCors(json({ success: true }), config.openkeyHost);
|
|
@@ -2615,11 +2616,9 @@ Local alternative: install \`${LOCAL_CLI_PACKAGE}\` and \`${LOCAL_MCP_PACKAGE}\`
|
|
|
2615
2616
|
});
|
|
2616
2617
|
}
|
|
2617
2618
|
if (url.pathname !== resourceUrl.pathname) return json({ error: "Not found" }, 404);
|
|
2618
|
-
|
|
2619
|
-
if (originFailure !== void 0) return originFailure;
|
|
2619
|
+
if (request.method === "OPTIONS") return mcpCors(new Response(null, { status: 204 }), request);
|
|
2620
2620
|
const auth = await authenticate(request);
|
|
2621
|
-
|
|
2622
|
-
return handler.fetch(request, { authInfo: auth });
|
|
2621
|
+
return mcpCors(auth instanceof Response ? auth : await handler.fetch(request, { authInfo: auth }), request);
|
|
2623
2622
|
},
|
|
2624
2623
|
close: () => handler.close()
|
|
2625
2624
|
};
|
|
@@ -2707,11 +2706,16 @@ function requiredState(url) {
|
|
|
2707
2706
|
if (state.length > 512) throw new ApprovalRequestError("state_invalid", "Approval state is invalid.");
|
|
2708
2707
|
return state;
|
|
2709
2708
|
}
|
|
2710
|
-
function
|
|
2711
|
-
const
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2709
|
+
function mcpCors(response, request) {
|
|
2710
|
+
const headers = new Headers(response.headers);
|
|
2711
|
+
headers.append("vary", "Origin");
|
|
2712
|
+
if (request.headers.has("origin")) {
|
|
2713
|
+
headers.set("access-control-allow-origin", "*");
|
|
2714
|
+
headers.set("access-control-allow-methods", "GET, POST, DELETE, OPTIONS");
|
|
2715
|
+
headers.set("access-control-expose-headers", "WWW-Authenticate");
|
|
2716
|
+
if (request.method === "OPTIONS") headers.set("access-control-allow-headers", MCP_CORS_ALLOWED_HEADERS);
|
|
2717
|
+
}
|
|
2718
|
+
return new Response(response.body, { status: response.status, statusText: response.statusText, headers });
|
|
2715
2719
|
}
|
|
2716
2720
|
function validateCallbackOrigin(request, openkeyHost) {
|
|
2717
2721
|
const origin = request.headers.get("origin");
|