opedd-mcp 0.4.0 → 0.4.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/dist/index.js +19 -7
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -8,7 +8,16 @@ const API_BASE = process.env.OPEDD_API_URL ??
|
|
|
8
8
|
"https://api.opedd.com";
|
|
9
9
|
const BUYER_EMAIL = process.env.OPEDD_BUYER_EMAIL;
|
|
10
10
|
const PAYMENT_METHOD_ID = process.env.OPEDD_PAYMENT_METHOD_ID;
|
|
11
|
-
|
|
11
|
+
// B91 v0.4.0 migration (2026-05-26): canonical Bearer auth.
|
|
12
|
+
// OPEDD_PUB_BEARER is the new canonical opedd_pub_<env>_<32-hex> key
|
|
13
|
+
// (issued via POST /publishers-api-keys action=create_api_key).
|
|
14
|
+
// OPEDD_API_KEY retained as backward-compat alias for legacy op_ keys
|
|
15
|
+
// during the dual-mode transition window on the /api endpoint (Phase A
|
|
16
|
+
// shipped opedd-backend 2026-05-26). Backend Phase C will drop the
|
|
17
|
+
// op_ path entirely; users MUST migrate to OPEDD_PUB_BEARER before
|
|
18
|
+
// then. Prefer Bearer if both set.
|
|
19
|
+
const PUB_BEARER = process.env.OPEDD_PUB_BEARER; // canonical opedd_pub_<env>_<32-hex>
|
|
20
|
+
const API_KEY = process.env.OPEDD_API_KEY; // LEGACY op_<32-hex> — retiring per backend Phase C
|
|
12
21
|
const BUYER_TOKEN = process.env.OPEDD_BUYER_TOKEN; // buyer API token (opedd_buyer_live_... or opedd_buyer_test_...)
|
|
13
22
|
const ACCESS_KEY = process.env.OPEDD_ACCESS_KEY; // enterprise access key (ent_*); for /enterprise-license GET feed
|
|
14
23
|
const BUYER_JWT = process.env.OPEDD_BUYER_JWT; // Supabase JWT; for /buyer-audit + /buyer-compliance-report
|
|
@@ -17,7 +26,9 @@ async function opeddFetch(path, options = {}) {
|
|
|
17
26
|
const url = `${API_BASE}${path}`;
|
|
18
27
|
const headers = {
|
|
19
28
|
"Content-Type": "application/json",
|
|
20
|
-
|
|
29
|
+
// B91 v0.4.0 (2026-05-26): canonical Bearer preferred; legacy X-API-Key
|
|
30
|
+
// accepted only as fallback during transition window
|
|
31
|
+
...(PUB_BEARER ? { Authorization: `Bearer ${PUB_BEARER}` } : (API_KEY ? { "X-API-Key": API_KEY } : {})),
|
|
21
32
|
...(options.headers ?? {}),
|
|
22
33
|
};
|
|
23
34
|
const res = await fetch(url, { ...options, headers });
|
|
@@ -35,7 +46,8 @@ async function opeddFetchNdjson(path, options = {}) {
|
|
|
35
46
|
const url = `${API_BASE}${path}`;
|
|
36
47
|
const headers = {
|
|
37
48
|
Accept: "application/x-ndjson",
|
|
38
|
-
|
|
49
|
+
// B91 v0.4.0 (2026-05-26): canonical Bearer preferred; legacy fallback
|
|
50
|
+
...(PUB_BEARER ? { Authorization: `Bearer ${PUB_BEARER}` } : (API_KEY ? { "X-API-Key": API_KEY } : {})),
|
|
39
51
|
...(options.headers ?? {}),
|
|
40
52
|
};
|
|
41
53
|
const res = await fetch(url, { ...options, headers });
|
|
@@ -527,10 +539,10 @@ if (BUYER_JWT) {
|
|
|
527
539
|
});
|
|
528
540
|
}
|
|
529
541
|
// If a publisher API key is configured, expose publisher-specific tooling
|
|
530
|
-
if (API_KEY) {
|
|
542
|
+
if (PUB_BEARER || API_KEY) {
|
|
531
543
|
TOOLS.push({
|
|
532
544
|
name: "list_publisher_content",
|
|
533
|
-
description: "List all licensable articles for the authenticated publisher (requires OPEDD_API_KEY). " +
|
|
545
|
+
description: "List all licensable articles for the authenticated publisher (requires OPEDD_PUB_BEARER, or legacy OPEDD_API_KEY). " +
|
|
534
546
|
"Returns articles with titles, descriptions, pricing, and sales statistics. " +
|
|
535
547
|
"Use article IDs from this list to purchase licenses via purchase_license.",
|
|
536
548
|
inputSchema: {
|
|
@@ -815,8 +827,8 @@ export async function dispatchTool(name, args) {
|
|
|
815
827
|
}
|
|
816
828
|
// ── list_publisher_content ─────────────────────────────────────────────
|
|
817
829
|
case "list_publisher_content": {
|
|
818
|
-
if (!API_KEY) {
|
|
819
|
-
return err("
|
|
830
|
+
if (!PUB_BEARER && !API_KEY) {
|
|
831
|
+
return err("OPEDD_PUB_BEARER env var is required for this tool (canonical Bearer; legacy OPEDD_API_KEY also accepted during transition)");
|
|
820
832
|
}
|
|
821
833
|
const { limit = 20, type, offset = 0 } = args;
|
|
822
834
|
const params = new URLSearchParams({ action: "articles" });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opedd-mcp",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"description": "MCP server for Opedd — discover, purchase, verify, and audit content licenses from AI assistants. Covers Phase 11 buyer-side surfaces + Phase 12 Wave 1 + 3 regulatory surfaces (CDSM Article 4(3) RSL + EU AI Act Article 53 attestation + platform onboarding helper).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
"start": "node dist/index.js",
|
|
13
13
|
"dev": "tsx src/index.ts",
|
|
14
14
|
"test": "vitest run",
|
|
15
|
-
"test:watch": "vitest"
|
|
15
|
+
"test:watch": "vitest",
|
|
16
|
+
"prepublishOnly": "npm run build && npm test"
|
|
16
17
|
},
|
|
17
18
|
"keywords": [
|
|
18
19
|
"mcp",
|