opedd-mcp 0.6.10 → 0.6.12

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/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { type Tool } from "@modelcontextprotocol/sdk/types.js";
3
+ export declare const CURRENT_MSA_VERSION = "master-services-agreement-2026-07-22b";
3
4
  export interface Credentials {
4
5
  apiBase: string;
5
6
  buyerEmail?: string;
package/dist/index.js CHANGED
@@ -5,6 +5,12 @@ import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextpro
5
5
  import { pathToFileURL } from "node:url";
6
6
  import { initTelemetry, captureToolCall, shutdownTelemetry } from "./telemetry.js";
7
7
  import { SERVER_VERSION } from "./version.js";
8
+ // ─── Configuration ────────────────────────────────────────────────────────────
9
+ // Current Opedd Master Services Agreement version label. MUST match
10
+ // opedd-backend supabase/functions/_shared/msa-version.ts CURRENT_MSA_VERSION
11
+ // (the backend rejects superseded labels). On an MSA version bump, update this
12
+ // constant and cut a new package release.
13
+ export const CURRENT_MSA_VERSION = "master-services-agreement-2026-07-22b";
8
14
  export function envCredentials() {
9
15
  return {
10
16
  apiBase: process.env.OPEDD_API_URL ?? "https://api.opedd.com",
@@ -322,11 +328,17 @@ function buildTools(has) {
322
328
  "Returns a Stripe client_secret for payment completion + the enterprise_license_id. " +
323
329
  "After payment, an ent_* access key is emailed to buyer_email. " +
324
330
  "Scopes: 'custom' (pass-through publisher_ids), 'platform_wide' (auto-resolve all opted-in publishers), 'filtered' (Phase 10 filter_rules). " +
325
- "License tiers: 'rag' (= ai_retrieval), 'training' (= ai_training, flat-fee not metered), 'inference' (= ai_retrieval), 'full_ai' (writes both retrieval + training records).",
331
+ "License tiers: 'rag' (= ai_retrieval), 'training' (= ai_training, flat-fee not metered), 'inference' (= ai_retrieval), 'full_ai' (writes both retrieval + training records). " +
332
+ "The buyer must accept the Opedd Master Services Agreement (opedd.com/terms) before purchase — set terms_accepted=true to record it.",
326
333
  inputSchema: {
327
334
  type: "object",
328
- required: ["publisher_ids", "buyer_email", "buyer_org"],
335
+ required: ["publisher_ids", "buyer_email", "buyer_org", "terms_accepted"],
329
336
  properties: {
337
+ terms_accepted: {
338
+ type: "boolean",
339
+ description: "REQUIRED. Set true only after the buyer (your principal) has accepted the Opedd Master Services Agreement at opedd.com/terms. " +
340
+ "The current MSA version label is recorded with the licence; purchases without genuine acceptance are rejected (HTTP 400).",
341
+ },
330
342
  publisher_ids: {
331
343
  type: "array",
332
344
  items: { type: "string" },
@@ -794,7 +806,7 @@ export async function dispatchTool(name, args, creds = ENV_CREDS) {
794
806
  }
795
807
  // ── purchase_enterprise_license (Phase 10) ─────────────────────────────
796
808
  case "purchase_enterprise_license": {
797
- const { publisher_ids, buyer_email: pelEmail, buyer_org, billing_type = "annual", license_tier = "rag", duration_months = 12, scope = "custom", filter_rules, buyer_webhook_url, } = args;
809
+ const { publisher_ids, buyer_email: pelEmail, buyer_org, billing_type = "annual", license_tier = "rag", duration_months = 12, scope = "custom", filter_rules, buyer_webhook_url, terms_accepted, } = args;
798
810
  if (!Array.isArray(publisher_ids) || publisher_ids.length === 0) {
799
811
  if (scope === "custom") {
800
812
  return err("publisher_ids array is required for scope='custom'");
@@ -804,6 +816,9 @@ export async function dispatchTool(name, args, creds = ENV_CREDS) {
804
816
  return err("buyer_email is required");
805
817
  if (!buyer_org)
806
818
  return err("buyer_org is required");
819
+ if (terms_accepted !== true) {
820
+ return err("terms_accepted must be true — confirm with the buyer that they accept the Opedd Master Services Agreement (opedd.com/terms) before purchasing.");
821
+ }
807
822
  const body = {
808
823
  publisher_ids: publisher_ids ?? [],
809
824
  buyer_email: pelEmail,
@@ -812,6 +827,12 @@ export async function dispatchTool(name, args, creds = ENV_CREDS) {
812
827
  license_tier,
813
828
  duration_months,
814
829
  scope,
830
+ // Genuine assent moment: the agent asserted terms_accepted=true just
831
+ // now. The backend requires the MSA version label (fail-closed since
832
+ // 2026-07-31) and rejects superseded labels — on an MSA version bump
833
+ // this constant must be updated (new package release) to match
834
+ // opedd-backend _shared/msa-version.ts CURRENT_MSA_VERSION.
835
+ terms_version: CURRENT_MSA_VERSION,
815
836
  ...(filter_rules ? { filter_rules } : {}),
816
837
  ...(buyer_webhook_url ? { buyer_webhook_url } : {}),
817
838
  };
@@ -828,7 +849,6 @@ export async function dispatchTool(name, args, creds = ENV_CREDS) {
828
849
  }
829
850
  const { since, cursor, limit = 50 } = args;
830
851
  const params = new URLSearchParams({
831
- access_key: creds.accessKey,
832
852
  format: "json",
833
853
  limit: String(Math.min(Number(limit) || 50, 200)),
834
854
  });
@@ -836,7 +856,11 @@ export async function dispatchTool(name, args, creds = ENV_CREDS) {
836
856
  params.set("since", since);
837
857
  if (cursor)
838
858
  params.set("cursor", cursor);
839
- const data = await opeddFetch(creds, `/enterprise-license?${params.toString()}`);
859
+ // Security 2026-07-27: enterprise key travels in a header, not the
860
+ // query string (query strings are logged verbatim by proxies/edge).
861
+ const data = await opeddFetch(creds, `/enterprise-license?${params.toString()}`, {
862
+ headers: { "X-Enterprise-Key": creds.accessKey },
863
+ });
840
864
  return ok(data);
841
865
  }
842
866
  // ── stream_feed_ndjson (Phase 11 M3) ───────────────────────────────────
@@ -846,7 +870,6 @@ export async function dispatchTool(name, args, creds = ENV_CREDS) {
846
870
  }
847
871
  const { since, cursor, limit = 200 } = args;
848
872
  const params = new URLSearchParams({
849
- access_key: creds.accessKey,
850
873
  format: "ndjson",
851
874
  limit: String(Math.min(Number(limit) || 200, 1000)),
852
875
  });
@@ -854,7 +877,11 @@ export async function dispatchTool(name, args, creds = ENV_CREDS) {
854
877
  params.set("since", since);
855
878
  if (cursor)
856
879
  params.set("cursor", cursor);
857
- const data = await opeddFetchNdjson(creds, `/enterprise-license?${params.toString()}`);
880
+ // Security 2026-07-27: enterprise key travels in a header, not the
881
+ // query string (query strings are logged verbatim by proxies/edge).
882
+ const data = await opeddFetchNdjson(creds, `/enterprise-license?${params.toString()}`, {
883
+ headers: { "X-Enterprise-Key": creds.accessKey },
884
+ });
858
885
  return ok(data);
859
886
  }
860
887
  // ── get_audit_events (Phase 9.x + 10 M5 attestation) ───────────────────
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opedd-mcp",
3
- "version": "0.6.10",
3
+ "version": "0.6.12",
4
4
  "description": "Licensed, rights-cleared content for AI agents — verifiable license keys, on-chain proof, and EU AI Act attestation. The MCP alternative to unlicensed scraping for RAG and AI search.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",