vantage-peers-mcp 2.12.0 → 2.12.1

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/LICENSE ADDED
@@ -0,0 +1,110 @@
1
+ Functional Source License, Version 1.1, Apache 2.0 Future License
2
+
3
+ Abbreviation
4
+
5
+ FSL-1.1-Apache-2.0
6
+
7
+ Notice
8
+
9
+ Copyright 2026 VantageOS (ElPi Corp)
10
+
11
+ Terms and Conditions
12
+
13
+ Licensor: VantageOS (ElPi Corp)
14
+
15
+ Licensed Work: VantagePeers
16
+ The Licensed Work is (c) 2026 VantageOS (ElPi Corp)
17
+
18
+ Additional Use Grant: You may make production use of the Licensed Work,
19
+ provided Your use does not include offering the Licensed
20
+ Work to third parties as a hosted or managed service
21
+ where the service provides users with access to any
22
+ substantial set of the features or functionality of the
23
+ Licensed Work.
24
+
25
+ Change Date: 2028-04-03 (two years from publication)
26
+
27
+ Change License: Apache License, Version 2.0
28
+
29
+ For information about alternative licensing arrangements for the Licensed Work,
30
+ please contact: contact@vantageos.com
31
+
32
+ License text below is provided for informational purposes only.
33
+
34
+ ---
35
+
36
+ Functional Source License, Version 1.1, Apache 2.0 Future License
37
+
38
+ 1. Purpose
39
+
40
+ This license gives you broad permission to use, modify, and share this
41
+ software, with one important condition: you may not use it to compete with us.
42
+
43
+ 2. Acceptance
44
+
45
+ To use the software, you must agree to these terms. If you do not agree, you
46
+ may not use the software.
47
+
48
+ 3. Copyright License
49
+
50
+ The licensor grants you a non-exclusive, royalty-free, worldwide, non-
51
+ sublicensable, non-transferable license to use, copy, distribute, make
52
+ available, and prepare derivative works of the software, in each case subject
53
+ to the limitations below.
54
+
55
+ 4. Limitations
56
+
57
+ You may not make the functionality of the software available to third parties
58
+ as a service, or otherwise use the software to provide a service to third
59
+ parties that competes with the licensor.
60
+
61
+ 5. Patents
62
+
63
+ The licensor grants you a license, under any patent claims the licensor can
64
+ license or becomes able to license, to make, have made, use, sell, offer for
65
+ sale, import, and have imported the software, in each case subject to the
66
+ limitations and conditions in this license.
67
+
68
+ 6. Fair Use
69
+
70
+ This license is not intended to limit any rights you may have under applicable
71
+ fair use or other laws.
72
+
73
+ 7. No Other Rights
74
+
75
+ These terms do not grant any other rights. The licensor reserves all rights not
76
+ expressly granted.
77
+
78
+ 8. Termination
79
+
80
+ Your license is automatically terminated if you violate the terms. However, if
81
+ you cure the violation within 30 days of discovering it, your license is
82
+ reinstated retroactively.
83
+
84
+ 9. Disclaimer
85
+
86
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
87
+ IMPLIED.
88
+
89
+ 10. Limitation of Liability
90
+
91
+ TO THE EXTENT PERMITTED BY LAW, THE LICENSOR IS NOT LIABLE FOR ANY DAMAGES
92
+ ARISING FROM THE USE OF THE SOFTWARE.
93
+
94
+ 11. Change Date and License
95
+
96
+ After the Change Date, the licensor grants you the rights under the Change
97
+ License.
98
+
99
+ 12. Definitions
100
+
101
+ "Compete" means providing a product or service that is substantially similar
102
+ to, or a replacement for, all or a significant portion of the Licensed Work.
103
+
104
+ ---
105
+
106
+ Apache License, Version 2.0
107
+
108
+ After the Change Date (2028-04-03), this software will be available under the
109
+ Apache License, Version 2.0. See https://www.apache.org/licenses/LICENSE-2.0
110
+ for full text.
package/README.md CHANGED
@@ -242,7 +242,7 @@ Example:
242
242
  ### Session (1)
243
243
  `set_summary`
244
244
 
245
- ## Compact payloads and status aliases (v2.11.0 — feature since v2.3.0)
245
+ ## Compact payloads and status aliases (v2.12.0 — feature since v2.3.0)
246
246
 
247
247
  ### `fields=lite` — reduced token payloads
248
248
 
@@ -46,8 +46,13 @@ catch {
46
46
  // ─────────────────────────────────────────────────────────────────────────────
47
47
  // Constants
48
48
  // ─────────────────────────────────────────────────────────────────────────────
49
- const PUBLIC_BASE_URL_FALLBACK = process.env.PUBLIC_BASE_URL ??
50
- "https://vantage-peers-production.up.railway.app";
49
+ // Day 107 Cédric BLOCKER root cause: previously hardcoded a fallback to the
50
+ // VantagePeers Cloud production URL, which meant Self-host deploys forgetting
51
+ // PUBLIC_BASE_URL silently advertised Sigma's URL in OAuth metadata and broke
52
+ // every Self-host customer's DCR chain with `invalid_client`. Fix: env-only
53
+ // fallback, no implicit cross-tenant default. `resolveIssuer` throws clear
54
+ // error if both Host header AND env are absent.
55
+ const PUBLIC_BASE_URL_FALLBACK = process.env.PUBLIC_BASE_URL ?? null;
51
56
  const ACCESS_TOKEN_TTL_SECONDS = 3600; // 1 hour
52
57
  const REFRESH_TOKEN_TTL_SECONDS = 30 * 24 * 3600; // 30 days
53
58
  const AUTH_CODE_TTL_SECONDS = 600; // 10 minutes
@@ -77,7 +82,10 @@ function resolveIssuer(req) {
77
82
  : "https");
78
83
  return `${proto}://${host}`;
79
84
  }
80
- return PUBLIC_BASE_URL_FALLBACK;
85
+ if (PUBLIC_BASE_URL_FALLBACK) {
86
+ return PUBLIC_BASE_URL_FALLBACK;
87
+ }
88
+ throw new Error("Server misconfigured: cannot determine public base URL (no Host header and PUBLIC_BASE_URL env var unset). Self-host deploys MUST set PUBLIC_BASE_URL.");
81
89
  }
82
90
  function randomOpaqueToken() {
83
91
  // 256-bit entropy via getRandomValues (32 bytes → 64 hex chars).
package/dist/src/auth.js CHANGED
@@ -163,8 +163,28 @@ export function bearerAuthMiddleware() {
163
163
  // the param MUST be `resource_metadata=` (not `resource=`). Claude.ai's OAuth
164
164
  // connector looks for `resource_metadata=` to bootstrap PRM discovery; with
165
165
  // `resource=` the entire DCR chain breaks before any token is issued.
166
- const publicBaseUrl = process.env.PUBLIC_BASE_URL ??
167
- "https://vantage-peers-production.up.railway.app";
166
+ //
167
+ // Day 107 Cédric BLOCKER root cause: a hardcoded fallback to the
168
+ // VantagePeers Cloud production URL ("vantage-peers-production.up.railway.app")
169
+ // meant Self-host deploys that forgot PUBLIC_BASE_URL silently advertised
170
+ // Sigma's PRM endpoint, breaking every Self-host customer's DCR chain with
171
+ // `invalid_client`. Fix: derive from the incoming request (RFC 8414 §2 —
172
+ // issuer MUST be the URL the client used). Fall back to PUBLIC_BASE_URL env
173
+ // only if Host header is absent (curl smoke). Fail closed if neither is set.
174
+ const host = c.req.header("host");
175
+ const xfProto = c.req.header("x-forwarded-proto");
176
+ const proto = xfProto ??
177
+ (host?.startsWith("localhost") || host?.startsWith("127.")
178
+ ? "http"
179
+ : "https");
180
+ const publicBaseUrl = host
181
+ ? `${proto}://${host}`
182
+ : (process.env.PUBLIC_BASE_URL ?? null);
183
+ if (!publicBaseUrl) {
184
+ return c.json({
185
+ error: "Server misconfigured: cannot determine public base URL (no Host header and PUBLIC_BASE_URL env var unset).",
186
+ }, 500);
187
+ }
168
188
  const wwwAuthHeader = `Bearer resource_metadata="${publicBaseUrl}/.well-known/oauth-protected-resource"`;
169
189
  const authHeader = c.req.header("Authorization");
170
190
  if (!authHeader?.startsWith("Bearer ")) {
@@ -0,0 +1,51 @@
1
+ /**
2
+ * MCP tool: export_okf_bundle (Phase 1 — T3).
3
+ *
4
+ * Thin proxy around the Convex `okfBundle:exportOkfBundle` action. The MCP
5
+ * tool wrapper exposes the export to any MCP client (Claude.ai, ChatGPT,
6
+ * Claude Code, Codex, IDE…) via the public VantagePeers Cloud surface.
7
+ *
8
+ * **VantagePeers Cloud, multi-tenant**: this is the Cloud product (NOT
9
+ * Self-host). Phase 1 namespace is verrouillé to `project/elpi-corp`; the
10
+ * Convex action enforces the gate, the wrapper only forwards arguments.
11
+ *
12
+ * RFC parent: decisions/okf-bridge-phase-1-rfc-2026-06-18.md (commit 6613610).
13
+ * ADR: decisions/adr-okf-exporter-arch.md (commit 2cd357e).
14
+ *
15
+ * Orchestrator: Sigma — VantagePeers | 2026-06-19
16
+ */
17
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
18
+ import type { ConvexHttpClient } from "convex/browser";
19
+ import { z } from "zod";
20
+ export interface ExportOkfBundleResult {
21
+ bundleUrl: string;
22
+ storageId: string;
23
+ size: number;
24
+ fileCount: number;
25
+ manifest: {
26
+ types: {
27
+ memoryCount: number;
28
+ briefingCount: number;
29
+ taskCount: number;
30
+ };
31
+ truncated: boolean;
32
+ urlExpiresAt: string;
33
+ };
34
+ }
35
+ export declare const exportOkfBundleArgsSchema: {
36
+ namespace: z.ZodString;
37
+ types: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
38
+ format: z.ZodEnum<{
39
+ tarball: "tarball";
40
+ tree: "tree";
41
+ }>;
42
+ since: z.ZodOptional<z.ZodNullable<z.ZodString>>;
43
+ urlTtl: z.ZodOptional<z.ZodNumber>;
44
+ };
45
+ /**
46
+ * Register the `export_okf_bundle` MCP tool against an McpServer instance.
47
+ *
48
+ * Call this from `tools.ts` (or directly from `server.ts`) alongside the other
49
+ * `server.tool(...)` registrations.
50
+ */
51
+ export declare function registerExportOkfBundle(server: McpServer, convex: ConvexHttpClient): void;
@@ -0,0 +1,100 @@
1
+ /**
2
+ * MCP tool: export_okf_bundle (Phase 1 — T3).
3
+ *
4
+ * Thin proxy around the Convex `okfBundle:exportOkfBundle` action. The MCP
5
+ * tool wrapper exposes the export to any MCP client (Claude.ai, ChatGPT,
6
+ * Claude Code, Codex, IDE…) via the public VantagePeers Cloud surface.
7
+ *
8
+ * **VantagePeers Cloud, multi-tenant**: this is the Cloud product (NOT
9
+ * Self-host). Phase 1 namespace is verrouillé to `project/elpi-corp`; the
10
+ * Convex action enforces the gate, the wrapper only forwards arguments.
11
+ *
12
+ * RFC parent: decisions/okf-bridge-phase-1-rfc-2026-06-18.md (commit 6613610).
13
+ * ADR: decisions/adr-okf-exporter-arch.md (commit 2cd357e).
14
+ *
15
+ * Orchestrator: Sigma — VantagePeers | 2026-06-19
16
+ */
17
+ import { ErrorCode, McpError } from "@modelcontextprotocol/sdk/types.js";
18
+ import { z } from "zod";
19
+ // ─────────────────────────────────────────────────────────────────────────────
20
+ // Zod input schema (RFC §3.1)
21
+ // ─────────────────────────────────────────────────────────────────────────────
22
+ export const exportOkfBundleArgsSchema = {
23
+ namespace: z
24
+ .string()
25
+ .describe("OKF export namespace. Phase 1 verrouillé to 'project/elpi-corp'."),
26
+ types: z
27
+ .array(z.string())
28
+ .nullable()
29
+ .optional()
30
+ .describe("Optional type filter — null/omitted exports all 3 families. " +
31
+ "Tokens: 'memory-*' (all subtypes), 'memory-<sub>' (literal), " +
32
+ "'briefing-note', 'task'."),
33
+ format: z
34
+ .enum(["tarball", "tree"])
35
+ .describe("Bundle format. Phase 1 supports 'tarball' only; 'tree' is reserved " +
36
+ "for Phase 2."),
37
+ since: z
38
+ .string()
39
+ .nullable()
40
+ .optional()
41
+ .describe("Optional ISO 8601 timestamp — only entries updated on/after are " +
42
+ "included. Anticipation Phase 2."),
43
+ urlTtl: z
44
+ .number()
45
+ .int()
46
+ .positive()
47
+ .optional()
48
+ .describe("Optional signed URL TTL in seconds (default 3600 = 1 hour). The " +
49
+ "storage object is purged at TTL expiry."),
50
+ };
51
+ // ─────────────────────────────────────────────────────────────────────────────
52
+ // Registration
53
+ // ─────────────────────────────────────────────────────────────────────────────
54
+ /**
55
+ * Register the `export_okf_bundle` MCP tool against an McpServer instance.
56
+ *
57
+ * Call this from `tools.ts` (or directly from `server.ts`) alongside the other
58
+ * `server.tool(...)` registrations.
59
+ */
60
+ export function registerExportOkfBundle(server, convex) {
61
+ server.tool("export_okf_bundle", "Export a VantagePeers namespace as an OKF v0.1 bundle (tarball). " +
62
+ "WHEN: use to ship a snapshot to Knowledge Catalog / RAG bridge / audit. " +
63
+ "EXAMPLE: export_okf_bundle namespace='project/elpi-corp' format='tarball'.", exportOkfBundleArgsSchema, {
64
+ readOnlyHint: true,
65
+ openWorldHint: false,
66
+ destructiveHint: false,
67
+ title: "Export OKF bundle",
68
+ }, async ({ namespace, types, format, since, urlTtl }) => {
69
+ try {
70
+ const result = (await convex.action("okfBundleNode:exportOkfBundle", {
71
+ namespace,
72
+ types: types ?? null,
73
+ format,
74
+ since: since ?? null,
75
+ urlTtl,
76
+ }));
77
+ return {
78
+ content: [
79
+ {
80
+ type: "text",
81
+ text: JSON.stringify(result, null, 2),
82
+ },
83
+ ],
84
+ };
85
+ }
86
+ catch (error) {
87
+ if (error instanceof McpError)
88
+ throw error;
89
+ const message = error instanceof Error ? error.message : String(error);
90
+ // Surface structured OKF_* error codes verbatim — the action emits
91
+ // them as prefix tokens in the Error message.
92
+ console.error("[export_okf_bundle] action failed", {
93
+ namespace,
94
+ format,
95
+ errorMessage: message,
96
+ });
97
+ throw new McpError(ErrorCode.InternalError, message);
98
+ }
99
+ });
100
+ }
@@ -156,8 +156,8 @@ export declare const storeMemoryOutputSchema: z.ZodObject<{
156
156
  memoryId: z.ZodString;
157
157
  namespace: z.ZodString;
158
158
  type: z.ZodEnum<{
159
- project: "project";
160
159
  user: "user";
160
+ project: "project";
161
161
  feedback: "feedback";
162
162
  reference: "reference";
163
163
  episode: "episode";
package/dist/src/tools.js CHANGED
@@ -15,6 +15,7 @@ import { clampLimit, decodeCursor, encodeCursor } from "./paging.js";
15
15
  import { listTasksGate } from "./list-tasks-gate.js";
16
16
  import { normalizeOrchestratorId } from "./normalizeOrchestratorId.js";
17
17
  import { scopeFilterGet, scopeFilterList } from "@vantageos/cloud-identity";
18
+ import { registerExportOkfBundle } from "./tools/exportOkfBundle.js";
18
19
  import { wrapToolResult } from "./ui-resources/stream-marker.js";
19
20
  // ─────────────────────────────────────────────────────────────────────────────
20
21
  // VP_EMIT_UI_MARKERS gate
@@ -6496,4 +6497,8 @@ export function registerTools(server, convex, oauthCtx) {
6496
6497
  return mcpConvexError(error);
6497
6498
  }
6498
6499
  });
6500
+ // ── export_okf_bundle (T3 — OKF Phase 1) ────────────────────────────────────
6501
+ // Thin proxy to convex action `okfBundle:exportOkfBundle`. Registered last
6502
+ // so its argument schema does not pollute other tool handlers' closures.
6503
+ registerExportOkfBundle(server, convex);
6499
6504
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vantage-peers-mcp",
3
- "version": "2.12.0",
3
+ "version": "2.12.1",
4
4
  "description": "MCP server for VantagePeers — shared memory, messaging, and task coordination for AI agent teams",
5
5
  "type": "module",
6
6
  "main": "./dist/server.js",