@vellumai/cli 0.12.5-dev.202609252215.b94bc6c → 0.12.5-dev.202609252314.2f8433a
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/node_modules/@vellumai/local-mode/node_modules/@vellumai/service-contracts/package.json +2 -1
- package/node_modules/@vellumai/local-mode/node_modules/@vellumai/service-contracts/src/__tests__/mcp-oauth.test.ts +53 -0
- package/node_modules/@vellumai/local-mode/node_modules/@vellumai/service-contracts/src/index.ts +1 -0
- package/node_modules/@vellumai/local-mode/node_modules/@vellumai/service-contracts/src/mcp-oauth.ts +60 -0
- package/node_modules/@vellumai/service-contracts/package.json +2 -1
- package/node_modules/@vellumai/service-contracts/src/__tests__/mcp-oauth.test.ts +53 -0
- package/node_modules/@vellumai/service-contracts/src/index.ts +1 -0
- package/node_modules/@vellumai/service-contracts/src/mcp-oauth.ts +60 -0
- package/package.json +1 -1
package/node_modules/@vellumai/local-mode/node_modules/@vellumai/service-contracts/package.json
CHANGED
|
@@ -28,7 +28,8 @@
|
|
|
28
28
|
"./guardian-requests": "./src/guardian-requests.ts",
|
|
29
29
|
"./platform-credential": "./src/platform-credential.ts",
|
|
30
30
|
"./plan-credit": "./src/plan-credit.ts",
|
|
31
|
-
"./integration-categories": "./src/integration-categories.ts"
|
|
31
|
+
"./integration-categories": "./src/integration-categories.ts",
|
|
32
|
+
"./mcp-oauth": "./src/mcp-oauth.ts"
|
|
32
33
|
},
|
|
33
34
|
"scripts": {
|
|
34
35
|
"typecheck": "bunx tsc --noEmit",
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
buildMcpOAuthCallbackUrl,
|
|
5
|
+
buildMcpOAuthClientMetadata,
|
|
6
|
+
buildMcpOAuthClientMetadataUrl,
|
|
7
|
+
} from "../mcp-oauth.js";
|
|
8
|
+
|
|
9
|
+
describe("MCP OAuth client metadata", () => {
|
|
10
|
+
test("builds the public client document", () => {
|
|
11
|
+
expect(
|
|
12
|
+
buildMcpOAuthClientMetadata({
|
|
13
|
+
clientId:
|
|
14
|
+
"https://velay.example/assistant-123/oauth/client-metadata.json",
|
|
15
|
+
redirectUris: [
|
|
16
|
+
"https://velay.example/assistant-123/webhooks/oauth/callback",
|
|
17
|
+
],
|
|
18
|
+
}),
|
|
19
|
+
).toEqual({
|
|
20
|
+
client_id:
|
|
21
|
+
"https://velay.example/assistant-123/oauth/client-metadata.json",
|
|
22
|
+
redirect_uris: [
|
|
23
|
+
"https://velay.example/assistant-123/webhooks/oauth/callback",
|
|
24
|
+
],
|
|
25
|
+
token_endpoint_auth_method: "none",
|
|
26
|
+
grant_types: ["authorization_code", "refresh_token"],
|
|
27
|
+
response_types: ["code"],
|
|
28
|
+
client_name: "Vellum Assistant",
|
|
29
|
+
logo_uri: "https://www.vellum.ai/favicon.svg",
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
test("builds callback and metadata URLs from one normalized base", () => {
|
|
34
|
+
const baseUrl = "https://velay.example/assistant-123///";
|
|
35
|
+
expect(buildMcpOAuthCallbackUrl(baseUrl)).toBe(
|
|
36
|
+
"https://velay.example/assistant-123/webhooks/oauth/callback",
|
|
37
|
+
);
|
|
38
|
+
expect(buildMcpOAuthClientMetadataUrl(baseUrl)).toBe(
|
|
39
|
+
"https://velay.example/assistant-123/oauth/client-metadata.json",
|
|
40
|
+
);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
test("canonicalizes equivalent public base URL spellings", () => {
|
|
44
|
+
const baseUrl = " https://VELAY.EXAMPLE:443/a/../assistant-123/// ";
|
|
45
|
+
|
|
46
|
+
expect(buildMcpOAuthCallbackUrl(baseUrl)).toBe(
|
|
47
|
+
"https://velay.example/assistant-123/webhooks/oauth/callback",
|
|
48
|
+
);
|
|
49
|
+
expect(buildMcpOAuthClientMetadataUrl(baseUrl)).toBe(
|
|
50
|
+
"https://velay.example/assistant-123/oauth/client-metadata.json",
|
|
51
|
+
);
|
|
52
|
+
});
|
|
53
|
+
});
|
package/node_modules/@vellumai/local-mode/node_modules/@vellumai/service-contracts/src/index.ts
CHANGED
|
@@ -30,6 +30,7 @@ export * from "./ingress.js";
|
|
|
30
30
|
export * from "./no-response.js";
|
|
31
31
|
export * from "./plan-credit.js";
|
|
32
32
|
export * from "./integration-categories.js";
|
|
33
|
+
export * from "./mcp-oauth.js";
|
|
33
34
|
export * from "./platform-credential.js";
|
|
34
35
|
export * from "./remote-web-pairing.js";
|
|
35
36
|
export * from "./twilio-ingress.js";
|
package/node_modules/@vellumai/local-mode/node_modules/@vellumai/service-contracts/src/mcp-oauth.ts
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { normalizeHttpPublicBaseUrlWithoutTrailingSlash } from "./ingress.js";
|
|
2
|
+
|
|
3
|
+
export const MCP_OAUTH_CALLBACK_PATH = "/webhooks/oauth/callback";
|
|
4
|
+
export const MCP_OAUTH_CLIENT_METADATA_PATH = "/oauth/client-metadata.json";
|
|
5
|
+
export const MCP_OAUTH_CLIENT_LOGO_URI = "https://www.vellum.ai/favicon.svg";
|
|
6
|
+
|
|
7
|
+
export interface McpOAuthClientMetadata {
|
|
8
|
+
client_id?: string;
|
|
9
|
+
redirect_uris: string[];
|
|
10
|
+
token_endpoint_auth_method: "none";
|
|
11
|
+
grant_types: ["authorization_code", "refresh_token"];
|
|
12
|
+
response_types: ["code"];
|
|
13
|
+
client_name: string;
|
|
14
|
+
logo_uri: string;
|
|
15
|
+
software_id?: string;
|
|
16
|
+
software_version?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface BuildMcpOAuthClientMetadataOptions {
|
|
20
|
+
clientId?: string;
|
|
21
|
+
redirectUris: string[];
|
|
22
|
+
clientName?: string;
|
|
23
|
+
softwareId?: string;
|
|
24
|
+
softwareVersion?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function buildMcpOAuthClientMetadata(
|
|
28
|
+
options: BuildMcpOAuthClientMetadataOptions,
|
|
29
|
+
): McpOAuthClientMetadata {
|
|
30
|
+
return {
|
|
31
|
+
...(options.clientId && { client_id: options.clientId }),
|
|
32
|
+
redirect_uris: options.redirectUris,
|
|
33
|
+
token_endpoint_auth_method: "none",
|
|
34
|
+
grant_types: ["authorization_code", "refresh_token"],
|
|
35
|
+
response_types: ["code"],
|
|
36
|
+
client_name: options.clientName ?? "Vellum Assistant",
|
|
37
|
+
logo_uri: MCP_OAUTH_CLIENT_LOGO_URI,
|
|
38
|
+
...(options.softwareId && { software_id: options.softwareId }),
|
|
39
|
+
...(options.softwareVersion && {
|
|
40
|
+
software_version: options.softwareVersion,
|
|
41
|
+
}),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function buildMcpOAuthCallbackUrl(publicBaseUrl: string): string {
|
|
46
|
+
return `${normalizeBaseUrl(publicBaseUrl)}${MCP_OAUTH_CALLBACK_PATH}`;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function buildMcpOAuthClientMetadataUrl(publicBaseUrl: string): string {
|
|
50
|
+
return `${normalizeBaseUrl(publicBaseUrl)}${MCP_OAUTH_CLIENT_METADATA_PATH}`;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function normalizeBaseUrl(publicBaseUrl: string): string {
|
|
54
|
+
const normalized =
|
|
55
|
+
normalizeHttpPublicBaseUrlWithoutTrailingSlash(publicBaseUrl);
|
|
56
|
+
if (!normalized) {
|
|
57
|
+
throw new Error("MCP OAuth public base URL must be an absolute HTTP URL");
|
|
58
|
+
}
|
|
59
|
+
return normalized;
|
|
60
|
+
}
|
|
@@ -28,7 +28,8 @@
|
|
|
28
28
|
"./guardian-requests": "./src/guardian-requests.ts",
|
|
29
29
|
"./platform-credential": "./src/platform-credential.ts",
|
|
30
30
|
"./plan-credit": "./src/plan-credit.ts",
|
|
31
|
-
"./integration-categories": "./src/integration-categories.ts"
|
|
31
|
+
"./integration-categories": "./src/integration-categories.ts",
|
|
32
|
+
"./mcp-oauth": "./src/mcp-oauth.ts"
|
|
32
33
|
},
|
|
33
34
|
"scripts": {
|
|
34
35
|
"typecheck": "bunx tsc --noEmit",
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
buildMcpOAuthCallbackUrl,
|
|
5
|
+
buildMcpOAuthClientMetadata,
|
|
6
|
+
buildMcpOAuthClientMetadataUrl,
|
|
7
|
+
} from "../mcp-oauth.js";
|
|
8
|
+
|
|
9
|
+
describe("MCP OAuth client metadata", () => {
|
|
10
|
+
test("builds the public client document", () => {
|
|
11
|
+
expect(
|
|
12
|
+
buildMcpOAuthClientMetadata({
|
|
13
|
+
clientId:
|
|
14
|
+
"https://velay.example/assistant-123/oauth/client-metadata.json",
|
|
15
|
+
redirectUris: [
|
|
16
|
+
"https://velay.example/assistant-123/webhooks/oauth/callback",
|
|
17
|
+
],
|
|
18
|
+
}),
|
|
19
|
+
).toEqual({
|
|
20
|
+
client_id:
|
|
21
|
+
"https://velay.example/assistant-123/oauth/client-metadata.json",
|
|
22
|
+
redirect_uris: [
|
|
23
|
+
"https://velay.example/assistant-123/webhooks/oauth/callback",
|
|
24
|
+
],
|
|
25
|
+
token_endpoint_auth_method: "none",
|
|
26
|
+
grant_types: ["authorization_code", "refresh_token"],
|
|
27
|
+
response_types: ["code"],
|
|
28
|
+
client_name: "Vellum Assistant",
|
|
29
|
+
logo_uri: "https://www.vellum.ai/favicon.svg",
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
test("builds callback and metadata URLs from one normalized base", () => {
|
|
34
|
+
const baseUrl = "https://velay.example/assistant-123///";
|
|
35
|
+
expect(buildMcpOAuthCallbackUrl(baseUrl)).toBe(
|
|
36
|
+
"https://velay.example/assistant-123/webhooks/oauth/callback",
|
|
37
|
+
);
|
|
38
|
+
expect(buildMcpOAuthClientMetadataUrl(baseUrl)).toBe(
|
|
39
|
+
"https://velay.example/assistant-123/oauth/client-metadata.json",
|
|
40
|
+
);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
test("canonicalizes equivalent public base URL spellings", () => {
|
|
44
|
+
const baseUrl = " https://VELAY.EXAMPLE:443/a/../assistant-123/// ";
|
|
45
|
+
|
|
46
|
+
expect(buildMcpOAuthCallbackUrl(baseUrl)).toBe(
|
|
47
|
+
"https://velay.example/assistant-123/webhooks/oauth/callback",
|
|
48
|
+
);
|
|
49
|
+
expect(buildMcpOAuthClientMetadataUrl(baseUrl)).toBe(
|
|
50
|
+
"https://velay.example/assistant-123/oauth/client-metadata.json",
|
|
51
|
+
);
|
|
52
|
+
});
|
|
53
|
+
});
|
|
@@ -30,6 +30,7 @@ export * from "./ingress.js";
|
|
|
30
30
|
export * from "./no-response.js";
|
|
31
31
|
export * from "./plan-credit.js";
|
|
32
32
|
export * from "./integration-categories.js";
|
|
33
|
+
export * from "./mcp-oauth.js";
|
|
33
34
|
export * from "./platform-credential.js";
|
|
34
35
|
export * from "./remote-web-pairing.js";
|
|
35
36
|
export * from "./twilio-ingress.js";
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { normalizeHttpPublicBaseUrlWithoutTrailingSlash } from "./ingress.js";
|
|
2
|
+
|
|
3
|
+
export const MCP_OAUTH_CALLBACK_PATH = "/webhooks/oauth/callback";
|
|
4
|
+
export const MCP_OAUTH_CLIENT_METADATA_PATH = "/oauth/client-metadata.json";
|
|
5
|
+
export const MCP_OAUTH_CLIENT_LOGO_URI = "https://www.vellum.ai/favicon.svg";
|
|
6
|
+
|
|
7
|
+
export interface McpOAuthClientMetadata {
|
|
8
|
+
client_id?: string;
|
|
9
|
+
redirect_uris: string[];
|
|
10
|
+
token_endpoint_auth_method: "none";
|
|
11
|
+
grant_types: ["authorization_code", "refresh_token"];
|
|
12
|
+
response_types: ["code"];
|
|
13
|
+
client_name: string;
|
|
14
|
+
logo_uri: string;
|
|
15
|
+
software_id?: string;
|
|
16
|
+
software_version?: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface BuildMcpOAuthClientMetadataOptions {
|
|
20
|
+
clientId?: string;
|
|
21
|
+
redirectUris: string[];
|
|
22
|
+
clientName?: string;
|
|
23
|
+
softwareId?: string;
|
|
24
|
+
softwareVersion?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function buildMcpOAuthClientMetadata(
|
|
28
|
+
options: BuildMcpOAuthClientMetadataOptions,
|
|
29
|
+
): McpOAuthClientMetadata {
|
|
30
|
+
return {
|
|
31
|
+
...(options.clientId && { client_id: options.clientId }),
|
|
32
|
+
redirect_uris: options.redirectUris,
|
|
33
|
+
token_endpoint_auth_method: "none",
|
|
34
|
+
grant_types: ["authorization_code", "refresh_token"],
|
|
35
|
+
response_types: ["code"],
|
|
36
|
+
client_name: options.clientName ?? "Vellum Assistant",
|
|
37
|
+
logo_uri: MCP_OAUTH_CLIENT_LOGO_URI,
|
|
38
|
+
...(options.softwareId && { software_id: options.softwareId }),
|
|
39
|
+
...(options.softwareVersion && {
|
|
40
|
+
software_version: options.softwareVersion,
|
|
41
|
+
}),
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function buildMcpOAuthCallbackUrl(publicBaseUrl: string): string {
|
|
46
|
+
return `${normalizeBaseUrl(publicBaseUrl)}${MCP_OAUTH_CALLBACK_PATH}`;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function buildMcpOAuthClientMetadataUrl(publicBaseUrl: string): string {
|
|
50
|
+
return `${normalizeBaseUrl(publicBaseUrl)}${MCP_OAUTH_CLIENT_METADATA_PATH}`;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function normalizeBaseUrl(publicBaseUrl: string): string {
|
|
54
|
+
const normalized =
|
|
55
|
+
normalizeHttpPublicBaseUrlWithoutTrailingSlash(publicBaseUrl);
|
|
56
|
+
if (!normalized) {
|
|
57
|
+
throw new Error("MCP OAuth public base URL must be an absolute HTTP URL");
|
|
58
|
+
}
|
|
59
|
+
return normalized;
|
|
60
|
+
}
|