@tinycloud/mcp 0.8.7-beta.3 → 0.9.0-beta.4
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 +1 -1
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/http-cli.cjs +16 -17
- package/dist/http-cli.cjs.map +1 -1
- package/dist/http-cli.js +16 -17
- package/dist/http-cli.js.map +1 -1
- package/dist/http.cjs +16 -12
- 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 +16 -12
- package/dist/http.js.map +1 -1
- package/dist/index.cjs +16 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +16 -12
- package/dist/index.js.map +1 -1
- package/dist/server.cjs +1 -1
- package/dist/server.cjs.map +1 -1
- package/dist/server.js +1 -1
- package/dist/server.js.map +1 -1
- package/package.json +1 -1
package/dist/http.d.cts
CHANGED
|
@@ -37,7 +37,6 @@ interface RemoteStoreConfig {
|
|
|
37
37
|
|
|
38
38
|
interface HostedMcpConfig extends RemoteStoreConfig {
|
|
39
39
|
readonly oauthMetadata: OAuthMetadata;
|
|
40
|
-
readonly allowedOrigins?: readonly string[];
|
|
41
40
|
/**
|
|
42
41
|
* OpenKey token introspection client (`TC_MCP_INTROSPECTION_URL` and client
|
|
43
42
|
* credentials). The hosted server always sets this; without it only the
|
package/dist/http.d.ts
CHANGED
|
@@ -37,7 +37,6 @@ interface RemoteStoreConfig {
|
|
|
37
37
|
|
|
38
38
|
interface HostedMcpConfig extends RemoteStoreConfig {
|
|
39
39
|
readonly oauthMetadata: OAuthMetadata;
|
|
40
|
-
readonly allowedOrigins?: readonly string[];
|
|
41
40
|
/**
|
|
42
41
|
* OpenKey token introspection client (`TC_MCP_INTROSPECTION_URL` and client
|
|
43
42
|
* credentials). The hosted server always sets this; without it only the
|
package/dist/http.js
CHANGED
|
@@ -1941,7 +1941,7 @@ function outcomeCode(result) {
|
|
|
1941
1941
|
// package.json
|
|
1942
1942
|
var package_default = {
|
|
1943
1943
|
name: "@tinycloud/mcp",
|
|
1944
|
-
version: "0.
|
|
1944
|
+
version: "0.9.0-beta.4",
|
|
1945
1945
|
description: "TinyCloud delegated operations MCP server",
|
|
1946
1946
|
keywords: [
|
|
1947
1947
|
"tinycloud",
|
|
@@ -2038,6 +2038,7 @@ var MCP_SERVER_NAME = "tinycloud-mcp";
|
|
|
2038
2038
|
|
|
2039
2039
|
// src/http.ts
|
|
2040
2040
|
var REQUIRED_SCOPE = "tinycloud:mcp";
|
|
2041
|
+
var MCP_CORS_ALLOWED_HEADERS = "Authorization, Content-Type, Accept, Mcp-Protocol-Version, Mcp-Session-Id, Last-Event-ID, Mcp-Method, Mcp-Name";
|
|
2041
2042
|
var LOCAL_CLI_PACKAGE = ["@tinycloud", "cli"].join("/");
|
|
2042
2043
|
var LOCAL_MCP_PACKAGE = ["@tinycloud", "mcp"].join("/");
|
|
2043
2044
|
function createHostedMcpApp(config) {
|
|
@@ -2358,8 +2359,8 @@ Local alternative: install \`${LOCAL_CLI_PACKAGE}\` and \`${LOCAL_MCP_PACKAGE}\`
|
|
|
2358
2359
|
if (url.pathname === callbackPath) {
|
|
2359
2360
|
if (request.method === "OPTIONS") return callbackCors(new Response(null, { status: 204 }), config.openkeyHost);
|
|
2360
2361
|
if (request.method !== "POST") return methodNotAllowed("POST");
|
|
2361
|
-
const
|
|
2362
|
-
if (
|
|
2362
|
+
const originFailure = validateCallbackOrigin(request, config.openkeyHost);
|
|
2363
|
+
if (originFailure !== void 0) return callbackCors(originFailure, config.openkeyHost);
|
|
2363
2364
|
try {
|
|
2364
2365
|
await store.completeApproval(requiredState(url), request);
|
|
2365
2366
|
return callbackCors(json({ success: true }), config.openkeyHost);
|
|
@@ -2453,11 +2454,9 @@ Local alternative: install \`${LOCAL_CLI_PACKAGE}\` and \`${LOCAL_MCP_PACKAGE}\`
|
|
|
2453
2454
|
});
|
|
2454
2455
|
}
|
|
2455
2456
|
if (url.pathname !== resourceUrl.pathname) return json({ error: "Not found" }, 404);
|
|
2456
|
-
|
|
2457
|
-
if (originFailure !== void 0) return originFailure;
|
|
2457
|
+
if (request.method === "OPTIONS") return mcpCors(new Response(null, { status: 204 }), request);
|
|
2458
2458
|
const auth = await authenticate(request);
|
|
2459
|
-
|
|
2460
|
-
return handler.fetch(request, { authInfo: auth });
|
|
2459
|
+
return mcpCors(auth instanceof Response ? auth : await handler.fetch(request, { authInfo: auth }), request);
|
|
2461
2460
|
},
|
|
2462
2461
|
close: () => handler.close()
|
|
2463
2462
|
};
|
|
@@ -2545,11 +2544,16 @@ function requiredState(url) {
|
|
|
2545
2544
|
if (state.length > 512) throw new ApprovalRequestError("state_invalid", "Approval state is invalid.");
|
|
2546
2545
|
return state;
|
|
2547
2546
|
}
|
|
2548
|
-
function
|
|
2549
|
-
const
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2547
|
+
function mcpCors(response, request) {
|
|
2548
|
+
const headers = new Headers(response.headers);
|
|
2549
|
+
headers.append("vary", "Origin");
|
|
2550
|
+
if (request.headers.has("origin")) {
|
|
2551
|
+
headers.set("access-control-allow-origin", "*");
|
|
2552
|
+
headers.set("access-control-allow-methods", "GET, POST, DELETE, OPTIONS");
|
|
2553
|
+
headers.set("access-control-expose-headers", "WWW-Authenticate");
|
|
2554
|
+
if (request.method === "OPTIONS") headers.set("access-control-allow-headers", MCP_CORS_ALLOWED_HEADERS);
|
|
2555
|
+
}
|
|
2556
|
+
return new Response(response.body, { status: response.status, statusText: response.statusText, headers });
|
|
2553
2557
|
}
|
|
2554
2558
|
function validateCallbackOrigin(request, openkeyHost) {
|
|
2555
2559
|
const origin = request.headers.get("origin");
|