@tenkicloud/mcp 0.4.2 → 0.4.3

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/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  All notable changes to `@luxorai/mcp` (also published as `@tenkicloud/mcp`). This project follows semantic versioning.
4
4
 
5
+ ## [0.4.3] - 2026-11-16
6
+
7
+ - The 401 challenge and protected-resource metadata match the request host even when it carries an explicit default port (`:443`); malformed Host headers fall back to the first resource.
8
+ - Protected-resource metadata `resource_name` is now `Luxor MCP`, configurable with `LUXORAI_MCP_RESOURCE_NAME` (or `TENKI_MCP_RESOURCE_NAME`).
9
+
5
10
  ## [0.4.2] - 2026-11-16
6
11
 
7
12
  - The Docker image builds and runs on Node 22.23.5, from the Node.js 2026-11-11 security release, pinned by digest.
package/README.md CHANGED
@@ -118,24 +118,25 @@ Substitute `node /absolute/path/to/tenki-mcp/dist/index.js` for the `npx` comman
118
118
 
119
119
  ### Environment variables
120
120
 
121
- | Variable | Default | Purpose |
122
- | ------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
123
- | `LUXORAI_API_KEY` | - | API key (`lx_…`, or `tk_…`). One of this or `LUXORAI_AUTH_TOKEN` is required. |
124
- | `LUXORAI_AUTH_TOKEN` | - | Session token (`ory_st_…` or cookie value). **Takes precedence over `LUXORAI_API_KEY`** when both are set. |
125
- | `LUXORAI_API_ENDPOINT` | `https://api.tenki.cloud` (the same API as `https://api.luxor.ai`) | Control-plane base URL (`LUXORAI_API_URL` is an alias). |
126
- | `LUXORAI_MCP_READONLY` | off | `1` registers only read tools (no create/run/delete/spend). |
127
- | `LUXORAI_MCP_DISABLED_TOOLS` | - | Comma-separated tool names to skip registering. |
128
- | `LUXORAI_MCP_AUDIT` | off | `1` logs each tool call name + arg keys to stderr. |
129
- | `LUXORAI_MCP_TRANSPORT` | `stdio` | `http` serves Streamable HTTP instead (see below). |
130
- | `PORT` | `3000` | HTTP transport port. |
131
- | `LUXORAI_MCP_HTTP_HOST` | `127.0.0.1` | HTTP bind host; non-loopback requires `LUXORAI_MCP_HTTP_TOKEN`. |
132
- | `LUXORAI_MCP_HTTP_TOKEN` | - | Bearer token for the HTTP endpoint; optional on loopback, required on a non-loopback host. |
133
- | `LUXORAI_MCP_PUBLIC_URL` | - | Public base URL for an OAuth-protected hosted server. |
134
- | `LUXORAI_MCP_OAUTH_ISSUER` | - | OAuth authorization-server issuer. Enables delegated OAuth HTTP mode. |
135
- | `LUXORAI_MCP_OAUTH_RESOURCE` | `<public URL>/mcp` | RFC 8707 resource identifier accepted in access-token audiences. A comma-separated list serves one resource per domain; metadata returns the one matching the request host, else the first. |
136
- | `LUXORAI_MCP_OAUTH_SCOPE` | `mcp` | Required delegated scope. |
137
- | `LUXORAI_MCP_IDENTITY_URL` | - | Internal Luxor Identity service endpoint used to exchange OAuth access tokens. |
138
- | `LUXORAI_MCP_IDENTITY_SERVICE_TOKEN` | - | Service credential for the private Identity token-exchange RPC. |
121
+ | Variable | Default | Purpose |
122
+ | ------------------------------------ | ------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
123
+ | `LUXORAI_API_KEY` | - | API key (`lx_…`, or `tk_…`). One of this or `LUXORAI_AUTH_TOKEN` is required. |
124
+ | `LUXORAI_AUTH_TOKEN` | - | Session token (`ory_st_…` or cookie value). **Takes precedence over `LUXORAI_API_KEY`** when both are set. |
125
+ | `LUXORAI_API_ENDPOINT` | `https://api.tenki.cloud` (the same API as `https://api.luxor.ai`) | Control-plane base URL (`LUXORAI_API_URL` is an alias). |
126
+ | `LUXORAI_MCP_READONLY` | off | `1` registers only read tools (no create/run/delete/spend). |
127
+ | `LUXORAI_MCP_DISABLED_TOOLS` | - | Comma-separated tool names to skip registering. |
128
+ | `LUXORAI_MCP_AUDIT` | off | `1` logs each tool call name + arg keys to stderr. |
129
+ | `LUXORAI_MCP_TRANSPORT` | `stdio` | `http` serves Streamable HTTP instead (see below). |
130
+ | `PORT` | `3000` | HTTP transport port. |
131
+ | `LUXORAI_MCP_HTTP_HOST` | `127.0.0.1` | HTTP bind host; non-loopback requires `LUXORAI_MCP_HTTP_TOKEN`. |
132
+ | `LUXORAI_MCP_HTTP_TOKEN` | - | Bearer token for the HTTP endpoint; optional on loopback, required on a non-loopback host. |
133
+ | `LUXORAI_MCP_PUBLIC_URL` | - | Public base URL for an OAuth-protected hosted server. |
134
+ | `LUXORAI_MCP_OAUTH_ISSUER` | - | OAuth authorization-server issuer. Enables delegated OAuth HTTP mode. |
135
+ | `LUXORAI_MCP_OAUTH_RESOURCE` | `<public URL>/mcp` | RFC 8707 resource identifier accepted in access-token audiences. A comma-separated list serves one resource per domain; metadata and the 401 `resource_metadata` follow the request host, else the first. |
136
+ | `LUXORAI_MCP_OAUTH_SCOPE` | `mcp` | Required delegated scope. |
137
+ | `LUXORAI_MCP_RESOURCE_NAME` | `Luxor MCP` | `resource_name` in the protected-resource metadata. |
138
+ | `LUXORAI_MCP_IDENTITY_URL` | - | Internal Luxor Identity service endpoint used to exchange OAuth access tokens. |
139
+ | `LUXORAI_MCP_IDENTITY_SERVICE_TOKEN` | - | Service credential for the private Identity token-exchange RPC. |
139
140
 
140
141
  Every `LUXORAI_*` variable above is still accepted under its `TENKI_*` name (for example `TENKI_API_KEY`, `TENKI_MCP_TRANSPORT`). All `LUXORAI_*` credentials are read before any `TENKI_*` one. Keys start with `lx_`; `tk_…` keys are still accepted.
141
142
 
package/dist/oauth.d.ts CHANGED
@@ -9,6 +9,7 @@ export interface OAuthConfig {
9
9
  identityUrl: string;
10
10
  identityServiceToken: string;
11
11
  scope: string;
12
+ resourceName: string;
12
13
  }
13
14
  export interface DelegatedAuthorization {
14
15
  tokenDigest: string;
package/dist/oauth.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import { createHash } from "node:crypto";
2
2
  import { readEnv } from "./env.js";
3
3
  const DEFAULT_SCOPE = "mcp";
4
+ const DEFAULT_RESOURCE_NAME = "Luxor MCP";
4
5
  const FETCH_TIMEOUT_MS = 8_000;
5
6
  const TOKEN_CACHE_MS = 15_000;
6
7
  const EXCHANGE_PROCEDURE = "/tenki.cloud.identity.private.v1beta1.IdentityPrivateService/ExchangeMcpOAuthToken";
@@ -28,6 +29,7 @@ export function loadOAuthConfig() {
28
29
  identityUrl,
29
30
  identityServiceToken,
30
31
  scope: (readEnv("MCP_OAUTH_SCOPE") || DEFAULT_SCOPE).trim(),
32
+ resourceName: (readEnv("MCP_RESOURCE_NAME") || DEFAULT_RESOURCE_NAME).trim(),
31
33
  };
32
34
  }
33
35
  function tokenDigest(token) {
@@ -127,7 +129,7 @@ export class OAuthResourceRoutes {
127
129
  authorization_servers: [this.config.issuer],
128
130
  scopes_supported: [this.config.scope, "offline_access"],
129
131
  bearer_methods_supported: ["header"],
130
- resource_name: "Tenki MCP",
132
+ resource_name: this.config.resourceName,
131
133
  });
132
134
  return true;
133
135
  }
@@ -140,20 +142,25 @@ export class OAuthResourceRoutes {
140
142
  }
141
143
  /** The configured resource whose host matches the request (RFC 9728 requires an exact match), else the first. */
142
144
  export function resourceForHost(config, host) {
143
- const wanted = (host ?? "").toLowerCase();
144
- return config.resources.find((resource) => urlHost(resource) === wanted) ?? config.resource;
145
+ return matchResource(config.resources, host) ?? config.resource;
145
146
  }
146
147
  /** Protected-resource metadata URL to advertise in a challenge, on the same host as the matched resource. */
147
148
  export function metadataUrlForHost(config, host) {
148
- const wanted = (host ?? "").toLowerCase();
149
- const matched = config.resources.find((resource) => urlHost(resource) === wanted);
150
- if (!matched || wanted === urlHost(config.publicUrl))
149
+ const matched = matchResource(config.resources, host);
150
+ if (!matched || sameHost(config.publicUrl, host))
151
151
  return config.metadataUrl;
152
152
  return `${new URL(matched).origin}/.well-known/oauth-protected-resource/mcp`;
153
153
  }
154
- /** Lowercased host of a URL, or undefined when it does not parse (a resource may be any absolute URI). */
155
- function urlHost(value) {
156
- return URL.canParse(value) ? new URL(value).host.toLowerCase() : undefined;
154
+ function matchResource(resources, host) {
155
+ return resources.find((resource) => sameHost(resource, host));
156
+ }
157
+ /** Whether a Host header names the URL's host; an explicit default port (`:443` for https) still matches. */
158
+ function sameHost(value, host) {
159
+ if (!host || /[\s/?#@\\]/.test(host) || !URL.canParse(value))
160
+ return false;
161
+ const url = new URL(value);
162
+ const candidate = `${url.protocol}//${host}`;
163
+ return URL.canParse(candidate) && new URL(candidate).host === url.host;
157
164
  }
158
165
  export function bearerToken(header) {
159
166
  const match = /^Bearer (.+)$/.exec(header ?? "");
package/dist/server.d.ts CHANGED
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
17
17
  import type { TenkiClient } from "./client.js";
18
- export declare const VERSION = "0.4.2";
18
+ export declare const VERSION = "0.4.3";
19
19
  /**
20
20
  * Tool classes, mapped to MCP annotations by annotationsFor():
21
21
  * read → readOnlyHint: true. Pure inspection: no state change, no spend.
package/dist/server.js CHANGED
@@ -34,7 +34,7 @@ import { registerEgress } from "./tools/egress.js";
34
34
  import { registerAuthStatus } from "./tools/auth_status.js";
35
35
  import { readEnv } from "./env.js";
36
36
  import { TOOL_TITLES } from "./tools/titles.js";
37
- export const VERSION = "0.4.2";
37
+ export const VERSION = "0.4.3";
38
38
  const modules = [
39
39
  registerIdentity,
40
40
  registerRun,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tenkicloud/mcp",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "mcpName": "io.github.LuxorLabs/tenki-mcp",
5
5
  "description": "Model Context Protocol server for Luxor Sandbox (Luxor Agent Cloud): disposable microVM sandboxes for AI agents. Create sandboxes, run code, read/write files, run git, expose preview URLs, from any MCP client.",
6
6
  "type": "module",