@adviverse/mcp 0.1.5 → 0.1.7

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/README.md CHANGED
@@ -25,7 +25,7 @@ The server reads it from the environment:
25
25
 
26
26
  | Env var | Required | Default |
27
27
  |---|---|---|
28
- | `ADVIVERSE_API_KEY` | yes | — (`ak_<prefix>.<secret>`) |
28
+ | `ADVIVERSE_API_KEY` | yes, unless you ran `adviverse login` (then the CLI's saved key is used) | — (`ak_<prefix>.<secret>`) |
29
29
  | `ADVIVERSE_BASE_URL` | no | `https://adviverse.com` |
30
30
 
31
31
  A read-only key makes every mutating tool return a `403 missing scope: write` —
package/dist/http.js CHANGED
@@ -14421,6 +14421,14 @@ var AuthResource = class extends Resource {
14421
14421
  body: { newPassword, ...currentPassword ? { currentPassword } : {} }
14422
14422
  });
14423
14423
  }
14424
+ /** Start an RFC 8628 device login: show `user_code` / `verification_uri_complete`, then poll deviceToken(). */
14425
+ deviceCode(body = {}) {
14426
+ return this.c.request("POST", "/v1/auth/device/code", { body });
14427
+ }
14428
+ /** Poll every `interval` s. Throws AdNetApiError 400 with body.error authorization_pending | slow_down | access_denied | expired_token until approved. */
14429
+ deviceToken(deviceCode) {
14430
+ return this.c.request("POST", "/v1/auth/device/token", { body: { device_code: deviceCode } });
14431
+ }
14424
14432
  login(body) {
14425
14433
  return this.c.request("POST", "/v1/auth/login", { body });
14426
14434
  }
@@ -14743,6 +14751,10 @@ var KeysResource = class extends Resource {
14743
14751
  delete(id) {
14744
14752
  return this.c.request("DELETE", `/v1/keys/${encodeURIComponent(id)}`);
14745
14753
  }
14754
+ /** Revoke the API key this client is using (logout). 400 when authenticated by session. */
14755
+ revokeCurrent() {
14756
+ return this.c.request("DELETE", "/v1/keys/current");
14757
+ }
14746
14758
  };
14747
14759
  var BillingResource = class extends Resource {
14748
14760
  constructor(c) {
@@ -15495,13 +15507,17 @@ var PropertiesResource = class extends Resource {
15495
15507
  list(page2) {
15496
15508
  return this.c.request("GET", "/v1/publisher/properties", { query: page2 });
15497
15509
  }
15510
+ get(id) {
15511
+ return this.c.request("GET", `/v1/publisher/properties/${encodeURIComponent(id)}`);
15512
+ }
15498
15513
  create(body, idempotencyKey) {
15499
15514
  return this.c.request("POST", "/v1/publisher/properties", { body, idempotencyKey });
15500
15515
  }
15501
15516
  /** Update a property's editable fields: display name, domain, category, and
15502
15517
  * verification method. Changing the domain resets verification. `category`
15503
15518
  * (a site-niche id) is kept as the publisher's manual choice; 0 hands it back
15504
- * to auto-detection. */
15519
+ * to auto-detection. `contextualWithoutConsent` / `enhancedCapping` write this
15520
+ * property's consent config (same as consent.saveConfig with its propertyId). */
15505
15521
  update(id, body) {
15506
15522
  return this.c.request("PATCH", `/v1/publisher/properties/${encodeURIComponent(id)}`, { body });
15507
15523
  }
@@ -15670,6 +15686,14 @@ var AppsResource = class extends Resource {
15670
15686
  update(id, body) {
15671
15687
  return this.c.request("PATCH", `/v1/publisher/apps/${encodeURIComponent(id)}`, { body });
15672
15688
  }
15689
+ /** Soft-deletes the app and its placements. */
15690
+ delete(id) {
15691
+ return this.c.request("DELETE", `/v1/publisher/apps/${encodeURIComponent(id)}`);
15692
+ }
15693
+ /** Verify via app-ads.txt on the linked developer site (default), or also the store listing. */
15694
+ verify(id, method) {
15695
+ return this.c.request("POST", `/v1/publisher/apps/${encodeURIComponent(id)}/verify`, { body: method ? { method } : {} });
15696
+ }
15673
15697
  /** The generated app-ads.txt content (plain text). */
15674
15698
  appAdsTxt(id) {
15675
15699
  return this.c.request("GET", `/v1/publisher/apps/${encodeURIComponent(id)}/app-ads.txt`, { text: true });
@@ -24455,21 +24479,22 @@ function createServer(client) {
24455
24479
  tool("rotate_terminal_token", "Rotate a terminal serve token by id (its old value stops working immediately). Returns the new token. The switch policy is preserved.", { id: external_exports.string() }, (a) => client.terminal.rotateToken(a.id));
24456
24480
  tool("revoke_terminal_token", "Revoke (delete) a terminal serve token by id.", { id: external_exports.string() }, (a) => client.terminal.revokeToken(a.id));
24457
24481
  tool("list_properties", "List publisher properties (sites, CLIs, apps).", page, (a) => client.properties.list(a));
24482
+ tool("get_property", "Get one property (incl. trust_progress and the resolved consent switches contextual_without_consent / enhanced_capping).", { id: external_exports.string() }, (a) => client.properties.get(a.id));
24458
24483
  tool("create_property", "Register a property. fields: { kind: website|cli|mobile_app|ctv, domain, name?, verificationMethod? }.", { fields, idempotencyKey: idem }, (a) => client.properties.create(a.fields, a.idempotencyKey));
24459
- tool("update_property", "Update a property. fields: { name?, domain?, category? (site-niche id from list_site_niches; manual, 0 = back to auto-detect), verificationMethod?, crossFill? }. Changing the domain resets verification and trust.", { id: external_exports.string(), fields }, (a) => client.properties.update(a.id, a.fields));
24484
+ tool("update_property", "Update a property. fields: { name?, domain?, category? (site-niche id from list_site_niches; manual, 0 = back to auto-detect), verificationMethod?, crossFill?, contextualWithoutConsent? (Ads before consent), enhancedCapping? (Enhanced frequency capping, outside EEA/UK only) }. Changing the domain resets verification and trust.", { id: external_exports.string(), fields }, (a) => client.properties.update(a.id, a.fields));
24460
24485
  tool("get_property_ads_txt", "A property's ads.txt line(s), to publish at https://<domain>/ads.txt.", { id: external_exports.string() }, (a) => client.properties.adsTxt(a.id));
24461
- tool("verify_property", "Trigger ownership verification for a property.", { id: external_exports.string() }, (a) => client.properties.verify(a.id));
24486
+ tool("verify_property", "Trigger ownership verification for a property. On failure returns error + message (why) and check (URL/DNS name, HTTP status, Age, cf-cache-status).", { id: external_exports.string() }, (a) => client.properties.verify(a.id));
24462
24487
  tool("classify_property", "Re-detect a website property's niche from its pages; returns the top-3 niches. Updates category only if it was auto-detected.", { id: external_exports.string() }, (a) => client.properties.classify(a.id));
24463
24488
  tool("list_site_niches", "The site-niche taxonomy (IAB v1 tier-1 ids + names) used by property category and campaign targeting propertyCategoryInclude/Exclude.", {}, () => client.properties.niches());
24464
24489
  tool("set_serving_domain", "Set a first-party ad-serving domain on a property (anti-adblock). The publisher CNAMEs this host to our edge; returns the CNAME target. Pass domain:null to remove.", { id: external_exports.string(), domain: external_exports.string().nullable() }, (a) => client.properties.setServingDomain(a.id, a.domain));
24465
24490
  tool("verify_serving_domain", "Verify a property custom serving domain CNAMEs to our edge (routes traffic + proves control). On success the tag serves first-party.", { id: external_exports.string() }, (a) => client.properties.verifyServingDomain(a.id));
24466
24491
  tool("list_placements", "List ad placements. has_signing_secret says whether signed-tag enforcement is on (the secret itself is only returned by rotate_placement_signing_secret).", page, (a) => client.placements.list(a));
24467
- tool("create_placement", "Create a placement. fields: { propertyId, name, format, floorCpm, \u2026 }.", { fields, idempotencyKey: idem }, (a) => client.placements.create(a.fields, a.idempotencyKey));
24492
+ tool("create_placement", "Create a placement. fields: { propertyId | appId (exactly one; an app id from list_apps works), name, format, floorCpm, \u2026 }. Apps accept banner, native, interstitial, rewarded, app_open, video, audio, carousel, pod, direct_link (no popunder/social_bar/in_page_push).", { fields, idempotencyKey: idem }, (a) => client.placements.create(a.fields, a.idempotencyKey));
24468
24493
  tool("get_placement_tag", "Get the ad tag / install code for a placement (responsive banners also return autoAdsScript, the one-line site-wide auto-ads tag).", { id: external_exports.string() }, (a) => client.placements.tag(a.id));
24469
24494
  tool("rotate_placement_signing_secret", "Generate/rotate a placement signing secret (Layer 3, returned once). With a secret set, the engine only serves /terminal requests carrying a valid HMAC signature.", { id: external_exports.string() }, (a) => client.placements.rotateSigningSecret(a.id));
24470
24495
  tool("disable_placement_signing", "Disable signed-tag enforcement on a placement.", { id: external_exports.string() }, (a) => client.placements.disableSigning(a.id));
24471
24496
  tool("list_combo_presets", "List the static combo / layout presets (each bundles several ad units: standard_combo, leaderboard_pop, social_push, sticky_interstitial, full_monetization).", {}, () => client.placements.comboPresets());
24472
- tool("create_combo", "Provision several ad units as placements on a property at once and get ONE combined embed snippet back (paste once before </body>). Provide EITHER a preset (presetKey) OR a custom set of units [{format,label?,width?,height?}]. fields: { presetKey?, units?, namePrefix?, floorCpm?, revShare?, auctionType?, passbackUrl?, houseOnly?, houseShare?, houseBackfill?, floorFallback? }.", { propertyId: external_exports.string(), fields }, (a) => client.placements.createCombo(a.propertyId, a.fields));
24497
+ tool("create_combo", "Provision several ad units as placements on a property at once and get ONE combined embed snippet back (paste once before </body>). propertyId may be an app id; on apps use presetKey in_app (banner + interstitial), web-only presets are refused. Provide EITHER a preset (presetKey) OR a custom set of units [{format,label?,width?,height?}]. fields: { presetKey?, units?, namePrefix?, floorCpm?, revShare?, auctionType?, passbackUrl?, houseOnly?, houseShare?, houseBackfill?, floorFallback? }.", { propertyId: external_exports.string(), fields }, (a) => client.placements.createCombo(a.propertyId, a.fields));
24473
24498
  tool("get_balance", "Get the account balance (available / held). The balance currency may be a tenant's own platform-token code (not an ISO code).", {}, () => client.finance.balance());
24474
24499
  tool("list_ledger", "List ledger entries.", { limit: external_exports.number().optional(), offset: external_exports.number().optional() }, (a) => client.finance.ledger({ limit: a.limit, offset: a.offset }));
24475
24500
  tool("advertiser_report", "Advertiser spend/performance report.", reportQuery, (a) => client.reporting.advertiser(a));
@@ -24686,14 +24711,14 @@ function createServer(client) {
24686
24711
  tool("send_capi_events", "Ingest server-side conversions. Auth is the CAPI token (from rotate_capi_token), NOT the session key.", { capiToken: external_exports.string(), events: external_exports.array(external_exports.any()) }, (a) => client.capi.send(a.capiToken, a.events));
24687
24712
  tool("track_conversion", "Record a conversion by click id (S2S postback). fields: { clickId|click_id, value?, postbackId? }.", { fields }, (a) => client.track.conversion(a.fields));
24688
24713
  tool("track_event", "Ingest a pixel event server-side (same payload pixel.js sends). fields = event object.", { fields }, (a) => client.track.event(a.fields));
24689
- tool("list_invoices", "List invoices (advertiser sees own; admin can pass accountId).", { accountId: external_exports.string().optional() }, (a) => client.billing.invoices({ accountId: a.accountId }));
24690
- tool("get_invoice", "Get one invoice by id.", { id: external_exports.string() }, (a) => client.billing.invoice(a.id));
24714
+ tool("list_billing_invoices", "List platform billing invoices (advertiser sees own; admin can pass accountId).", { accountId: external_exports.string().optional() }, (a) => client.billing.invoices({ accountId: a.accountId }));
24715
+ tool("get_billing_invoice", "Get one platform billing invoice by id.", { id: external_exports.string() }, (a) => client.billing.invoice(a.id));
24691
24716
  tool("get_statement", "Account financial statement (opening/charges/payments/closing).", { from: external_exports.string().optional(), to: external_exports.string().optional(), accountId: external_exports.string().optional() }, (a) => client.billing.statement(a));
24692
24717
  tool("render_invoice", "Rendered HTML of an invoice.", { id: external_exports.string() }, (a) => client.billing.renderInvoice(a.id));
24693
24718
  tool("generate_invoice", "Generate a draft invoice for an account+period (admin).", { accountId: external_exports.string(), periodStart: external_exports.string(), periodEnd: external_exports.string() }, (a) => client.billing.generateInvoice(a));
24694
24719
  tool("issue_invoice", "Issue a draft invoice (admin).", { id: external_exports.string() }, (a) => client.billing.issueInvoice(a.id));
24695
24720
  tool("pay_invoice", "Pay an invoice (advertiser own; admin any).", { id: external_exports.string() }, (a) => client.billing.payInvoice(a.id));
24696
- tool("void_invoice", "Void an invoice (admin).", { id: external_exports.string() }, (a) => client.billing.voidInvoice(a.id));
24721
+ tool("void_billing_invoice", "Void a platform billing invoice (admin).", { id: external_exports.string() }, (a) => client.billing.voidInvoice(a.id));
24697
24722
  tool("deposit_funds", "Request a deposit / account top-up. fields: { amount, provider?: stripe|card|paypal|crypto|wire|paxum|mock, currency? }. card=Stripe card checkout; wire/paxum are instruction-based \u2014 the response carries where to send funds + a reference, and the balance is credited once receipt is confirmed. Accounts on a tenant network transact in that tenant's own platform token: currency is the token code and amount is denominated in it.", { fields }, (a) => client.finance.deposit(a.fields));
24698
24723
  tool("list_deposits", "List deposit history.", {}, () => client.finance.deposits());
24699
24724
  tool("request_payout", "Request a publisher payout. fields: { amount, method: crypto|paxum|wire, destination? }. crypto\u2192OxaPay, paxum\u2192Paxum wallet email (destination.email), wire\u2192bank transfer (destination bank fields; settled once ops confirms it was sent).", { fields }, (a) => client.finance.requestPayout(a.fields));
@@ -24733,8 +24758,10 @@ function createServer(client) {
24733
24758
  tool("get_identity", "Get an identity you own by canonical id, with only the signals you supplied (404 if you own none of its signals).", { canonicalId: external_exports.string() }, (a) => client.identity.get(a.canonicalId));
24734
24759
  tool("list_apps", "List publisher mobile/CTV apps.", {}, () => client.apps.list());
24735
24760
  tool("get_app", "Get one app by id.", { id: external_exports.string() }, (a) => client.apps.get(a.id));
24736
- tool("create_app", "Register a mobile/CTV app. fields: { kind: mobile_app|ctv, name, bundleId, platform, storeUrl?, appStoreId?, category?, ctvMeta? }.", { fields }, (a) => client.apps.create(a.fields));
24737
- tool("update_app", "Update an app. fields: { appAdsTxt?, skadnetworkIds?, ctvMeta?, storeUrl?, platform? }.", { id: external_exports.string(), fields }, (a) => client.apps.update(a.id, a.fields));
24761
+ tool("create_app", "Register a mobile/CTV app. fields: { kind: mobile_app|ctv, name, bundleId, platform, storeUrl?, appStoreId?, category?, ctvMeta?, developerPropertyId? (your website property whose /app-ads.txt proves the app) }. Starts pending; then verify_app. Test tag tk_test fills before verification.", { fields }, (a) => client.apps.create(a.fields));
24762
+ tool("update_app", "Update an app. fields: { appAdsTxt?, skadnetworkIds?, ctvMeta?, storeUrl?, platform?, developerPropertyId? (website property id; null unlinks) }.", { id: external_exports.string(), fields }, (a) => client.apps.update(a.id, a.fields));
24763
+ tool("delete_app", "Delete an app (soft-deletes it and its placements).", { id: external_exports.string() }, (a) => client.apps.delete(a.id));
24764
+ tool("verify_app", "Verify an app. developer_site (default): the linked, verified developer website must serve /app-ads.txt with 'adviverse.com, <your account id>, DIRECT' (see get_app_ads_txt). store_listing: also checks the apps.apple.com / play.google.com listing. On failure returns error + message saying what to fix.", { id: external_exports.string(), method: external_exports.enum(["developer_site", "store_listing"]).optional() }, (a) => client.apps.verify(a.id, a.method));
24738
24765
  tool("get_app_ads_txt", "An app's generated app-ads.txt content.", { id: external_exports.string() }, (a) => client.apps.appAdsTxt(a.id));
24739
24766
  tool("report_ivt", "Invalid-traffic breakdown.", reportQuery, (a) => client.reporting.ivt(a));
24740
24767
  tool("report_reach", "Reach & frequency (unique users): total reach, average frequency, a frequency-distribution histogram (impressions per user), and daily unique reach.", reportQuery, (a) => client.reporting.reach(a));
package/dist/index.js CHANGED
@@ -6968,6 +6968,9 @@ var require_dist = __commonJS({
6968
6968
 
6969
6969
  // src/index.ts
6970
6970
  init_esm_shims();
6971
+ import { readFileSync } from "fs";
6972
+ import { homedir } from "os";
6973
+ import { join } from "path";
6971
6974
 
6972
6975
  // ../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.29.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
6973
6976
  init_esm_shims();
@@ -13182,6 +13185,14 @@ var AuthResource = class extends Resource {
13182
13185
  body: { newPassword, ...currentPassword ? { currentPassword } : {} }
13183
13186
  });
13184
13187
  }
13188
+ /** Start an RFC 8628 device login: show `user_code` / `verification_uri_complete`, then poll deviceToken(). */
13189
+ deviceCode(body = {}) {
13190
+ return this.c.request("POST", "/v1/auth/device/code", { body });
13191
+ }
13192
+ /** Poll every `interval` s. Throws AdNetApiError 400 with body.error authorization_pending | slow_down | access_denied | expired_token until approved. */
13193
+ deviceToken(deviceCode) {
13194
+ return this.c.request("POST", "/v1/auth/device/token", { body: { device_code: deviceCode } });
13195
+ }
13185
13196
  login(body) {
13186
13197
  return this.c.request("POST", "/v1/auth/login", { body });
13187
13198
  }
@@ -13504,6 +13515,10 @@ var KeysResource = class extends Resource {
13504
13515
  delete(id) {
13505
13516
  return this.c.request("DELETE", `/v1/keys/${encodeURIComponent(id)}`);
13506
13517
  }
13518
+ /** Revoke the API key this client is using (logout). 400 when authenticated by session. */
13519
+ revokeCurrent() {
13520
+ return this.c.request("DELETE", "/v1/keys/current");
13521
+ }
13507
13522
  };
13508
13523
  var BillingResource = class extends Resource {
13509
13524
  constructor(c) {
@@ -14256,13 +14271,17 @@ var PropertiesResource = class extends Resource {
14256
14271
  list(page2) {
14257
14272
  return this.c.request("GET", "/v1/publisher/properties", { query: page2 });
14258
14273
  }
14274
+ get(id) {
14275
+ return this.c.request("GET", `/v1/publisher/properties/${encodeURIComponent(id)}`);
14276
+ }
14259
14277
  create(body, idempotencyKey) {
14260
14278
  return this.c.request("POST", "/v1/publisher/properties", { body, idempotencyKey });
14261
14279
  }
14262
14280
  /** Update a property's editable fields: display name, domain, category, and
14263
14281
  * verification method. Changing the domain resets verification. `category`
14264
14282
  * (a site-niche id) is kept as the publisher's manual choice; 0 hands it back
14265
- * to auto-detection. */
14283
+ * to auto-detection. `contextualWithoutConsent` / `enhancedCapping` write this
14284
+ * property's consent config (same as consent.saveConfig with its propertyId). */
14266
14285
  update(id, body) {
14267
14286
  return this.c.request("PATCH", `/v1/publisher/properties/${encodeURIComponent(id)}`, { body });
14268
14287
  }
@@ -14431,6 +14450,14 @@ var AppsResource = class extends Resource {
14431
14450
  update(id, body) {
14432
14451
  return this.c.request("PATCH", `/v1/publisher/apps/${encodeURIComponent(id)}`, { body });
14433
14452
  }
14453
+ /** Soft-deletes the app and its placements. */
14454
+ delete(id) {
14455
+ return this.c.request("DELETE", `/v1/publisher/apps/${encodeURIComponent(id)}`);
14456
+ }
14457
+ /** Verify via app-ads.txt on the linked developer site (default), or also the store listing. */
14458
+ verify(id, method) {
14459
+ return this.c.request("POST", `/v1/publisher/apps/${encodeURIComponent(id)}/verify`, { body: method ? { method } : {} });
14460
+ }
14434
14461
  /** The generated app-ads.txt content (plain text). */
14435
14462
  appAdsTxt(id) {
14436
14463
  return this.c.request("GET", `/v1/publisher/apps/${encodeURIComponent(id)}/app-ads.txt`, { text: true });
@@ -23216,21 +23243,22 @@ function createServer(client) {
23216
23243
  tool("rotate_terminal_token", "Rotate a terminal serve token by id (its old value stops working immediately). Returns the new token. The switch policy is preserved.", { id: external_exports.string() }, (a) => client.terminal.rotateToken(a.id));
23217
23244
  tool("revoke_terminal_token", "Revoke (delete) a terminal serve token by id.", { id: external_exports.string() }, (a) => client.terminal.revokeToken(a.id));
23218
23245
  tool("list_properties", "List publisher properties (sites, CLIs, apps).", page, (a) => client.properties.list(a));
23246
+ tool("get_property", "Get one property (incl. trust_progress and the resolved consent switches contextual_without_consent / enhanced_capping).", { id: external_exports.string() }, (a) => client.properties.get(a.id));
23219
23247
  tool("create_property", "Register a property. fields: { kind: website|cli|mobile_app|ctv, domain, name?, verificationMethod? }.", { fields, idempotencyKey: idem }, (a) => client.properties.create(a.fields, a.idempotencyKey));
23220
- tool("update_property", "Update a property. fields: { name?, domain?, category? (site-niche id from list_site_niches; manual, 0 = back to auto-detect), verificationMethod?, crossFill? }. Changing the domain resets verification and trust.", { id: external_exports.string(), fields }, (a) => client.properties.update(a.id, a.fields));
23248
+ tool("update_property", "Update a property. fields: { name?, domain?, category? (site-niche id from list_site_niches; manual, 0 = back to auto-detect), verificationMethod?, crossFill?, contextualWithoutConsent? (Ads before consent), enhancedCapping? (Enhanced frequency capping, outside EEA/UK only) }. Changing the domain resets verification and trust.", { id: external_exports.string(), fields }, (a) => client.properties.update(a.id, a.fields));
23221
23249
  tool("get_property_ads_txt", "A property's ads.txt line(s), to publish at https://<domain>/ads.txt.", { id: external_exports.string() }, (a) => client.properties.adsTxt(a.id));
23222
- tool("verify_property", "Trigger ownership verification for a property.", { id: external_exports.string() }, (a) => client.properties.verify(a.id));
23250
+ tool("verify_property", "Trigger ownership verification for a property. On failure returns error + message (why) and check (URL/DNS name, HTTP status, Age, cf-cache-status).", { id: external_exports.string() }, (a) => client.properties.verify(a.id));
23223
23251
  tool("classify_property", "Re-detect a website property's niche from its pages; returns the top-3 niches. Updates category only if it was auto-detected.", { id: external_exports.string() }, (a) => client.properties.classify(a.id));
23224
23252
  tool("list_site_niches", "The site-niche taxonomy (IAB v1 tier-1 ids + names) used by property category and campaign targeting propertyCategoryInclude/Exclude.", {}, () => client.properties.niches());
23225
23253
  tool("set_serving_domain", "Set a first-party ad-serving domain on a property (anti-adblock). The publisher CNAMEs this host to our edge; returns the CNAME target. Pass domain:null to remove.", { id: external_exports.string(), domain: external_exports.string().nullable() }, (a) => client.properties.setServingDomain(a.id, a.domain));
23226
23254
  tool("verify_serving_domain", "Verify a property custom serving domain CNAMEs to our edge (routes traffic + proves control). On success the tag serves first-party.", { id: external_exports.string() }, (a) => client.properties.verifyServingDomain(a.id));
23227
23255
  tool("list_placements", "List ad placements. has_signing_secret says whether signed-tag enforcement is on (the secret itself is only returned by rotate_placement_signing_secret).", page, (a) => client.placements.list(a));
23228
- tool("create_placement", "Create a placement. fields: { propertyId, name, format, floorCpm, \u2026 }.", { fields, idempotencyKey: idem }, (a) => client.placements.create(a.fields, a.idempotencyKey));
23256
+ tool("create_placement", "Create a placement. fields: { propertyId | appId (exactly one; an app id from list_apps works), name, format, floorCpm, \u2026 }. Apps accept banner, native, interstitial, rewarded, app_open, video, audio, carousel, pod, direct_link (no popunder/social_bar/in_page_push).", { fields, idempotencyKey: idem }, (a) => client.placements.create(a.fields, a.idempotencyKey));
23229
23257
  tool("get_placement_tag", "Get the ad tag / install code for a placement (responsive banners also return autoAdsScript, the one-line site-wide auto-ads tag).", { id: external_exports.string() }, (a) => client.placements.tag(a.id));
23230
23258
  tool("rotate_placement_signing_secret", "Generate/rotate a placement signing secret (Layer 3, returned once). With a secret set, the engine only serves /terminal requests carrying a valid HMAC signature.", { id: external_exports.string() }, (a) => client.placements.rotateSigningSecret(a.id));
23231
23259
  tool("disable_placement_signing", "Disable signed-tag enforcement on a placement.", { id: external_exports.string() }, (a) => client.placements.disableSigning(a.id));
23232
23260
  tool("list_combo_presets", "List the static combo / layout presets (each bundles several ad units: standard_combo, leaderboard_pop, social_push, sticky_interstitial, full_monetization).", {}, () => client.placements.comboPresets());
23233
- tool("create_combo", "Provision several ad units as placements on a property at once and get ONE combined embed snippet back (paste once before </body>). Provide EITHER a preset (presetKey) OR a custom set of units [{format,label?,width?,height?}]. fields: { presetKey?, units?, namePrefix?, floorCpm?, revShare?, auctionType?, passbackUrl?, houseOnly?, houseShare?, houseBackfill?, floorFallback? }.", { propertyId: external_exports.string(), fields }, (a) => client.placements.createCombo(a.propertyId, a.fields));
23261
+ tool("create_combo", "Provision several ad units as placements on a property at once and get ONE combined embed snippet back (paste once before </body>). propertyId may be an app id; on apps use presetKey in_app (banner + interstitial), web-only presets are refused. Provide EITHER a preset (presetKey) OR a custom set of units [{format,label?,width?,height?}]. fields: { presetKey?, units?, namePrefix?, floorCpm?, revShare?, auctionType?, passbackUrl?, houseOnly?, houseShare?, houseBackfill?, floorFallback? }.", { propertyId: external_exports.string(), fields }, (a) => client.placements.createCombo(a.propertyId, a.fields));
23234
23262
  tool("get_balance", "Get the account balance (available / held). The balance currency may be a tenant's own platform-token code (not an ISO code).", {}, () => client.finance.balance());
23235
23263
  tool("list_ledger", "List ledger entries.", { limit: external_exports.number().optional(), offset: external_exports.number().optional() }, (a) => client.finance.ledger({ limit: a.limit, offset: a.offset }));
23236
23264
  tool("advertiser_report", "Advertiser spend/performance report.", reportQuery, (a) => client.reporting.advertiser(a));
@@ -23447,14 +23475,14 @@ function createServer(client) {
23447
23475
  tool("send_capi_events", "Ingest server-side conversions. Auth is the CAPI token (from rotate_capi_token), NOT the session key.", { capiToken: external_exports.string(), events: external_exports.array(external_exports.any()) }, (a) => client.capi.send(a.capiToken, a.events));
23448
23476
  tool("track_conversion", "Record a conversion by click id (S2S postback). fields: { clickId|click_id, value?, postbackId? }.", { fields }, (a) => client.track.conversion(a.fields));
23449
23477
  tool("track_event", "Ingest a pixel event server-side (same payload pixel.js sends). fields = event object.", { fields }, (a) => client.track.event(a.fields));
23450
- tool("list_invoices", "List invoices (advertiser sees own; admin can pass accountId).", { accountId: external_exports.string().optional() }, (a) => client.billing.invoices({ accountId: a.accountId }));
23451
- tool("get_invoice", "Get one invoice by id.", { id: external_exports.string() }, (a) => client.billing.invoice(a.id));
23478
+ tool("list_billing_invoices", "List platform billing invoices (advertiser sees own; admin can pass accountId).", { accountId: external_exports.string().optional() }, (a) => client.billing.invoices({ accountId: a.accountId }));
23479
+ tool("get_billing_invoice", "Get one platform billing invoice by id.", { id: external_exports.string() }, (a) => client.billing.invoice(a.id));
23452
23480
  tool("get_statement", "Account financial statement (opening/charges/payments/closing).", { from: external_exports.string().optional(), to: external_exports.string().optional(), accountId: external_exports.string().optional() }, (a) => client.billing.statement(a));
23453
23481
  tool("render_invoice", "Rendered HTML of an invoice.", { id: external_exports.string() }, (a) => client.billing.renderInvoice(a.id));
23454
23482
  tool("generate_invoice", "Generate a draft invoice for an account+period (admin).", { accountId: external_exports.string(), periodStart: external_exports.string(), periodEnd: external_exports.string() }, (a) => client.billing.generateInvoice(a));
23455
23483
  tool("issue_invoice", "Issue a draft invoice (admin).", { id: external_exports.string() }, (a) => client.billing.issueInvoice(a.id));
23456
23484
  tool("pay_invoice", "Pay an invoice (advertiser own; admin any).", { id: external_exports.string() }, (a) => client.billing.payInvoice(a.id));
23457
- tool("void_invoice", "Void an invoice (admin).", { id: external_exports.string() }, (a) => client.billing.voidInvoice(a.id));
23485
+ tool("void_billing_invoice", "Void a platform billing invoice (admin).", { id: external_exports.string() }, (a) => client.billing.voidInvoice(a.id));
23458
23486
  tool("deposit_funds", "Request a deposit / account top-up. fields: { amount, provider?: stripe|card|paypal|crypto|wire|paxum|mock, currency? }. card=Stripe card checkout; wire/paxum are instruction-based \u2014 the response carries where to send funds + a reference, and the balance is credited once receipt is confirmed. Accounts on a tenant network transact in that tenant's own platform token: currency is the token code and amount is denominated in it.", { fields }, (a) => client.finance.deposit(a.fields));
23459
23487
  tool("list_deposits", "List deposit history.", {}, () => client.finance.deposits());
23460
23488
  tool("request_payout", "Request a publisher payout. fields: { amount, method: crypto|paxum|wire, destination? }. crypto\u2192OxaPay, paxum\u2192Paxum wallet email (destination.email), wire\u2192bank transfer (destination bank fields; settled once ops confirms it was sent).", { fields }, (a) => client.finance.requestPayout(a.fields));
@@ -23494,8 +23522,10 @@ function createServer(client) {
23494
23522
  tool("get_identity", "Get an identity you own by canonical id, with only the signals you supplied (404 if you own none of its signals).", { canonicalId: external_exports.string() }, (a) => client.identity.get(a.canonicalId));
23495
23523
  tool("list_apps", "List publisher mobile/CTV apps.", {}, () => client.apps.list());
23496
23524
  tool("get_app", "Get one app by id.", { id: external_exports.string() }, (a) => client.apps.get(a.id));
23497
- tool("create_app", "Register a mobile/CTV app. fields: { kind: mobile_app|ctv, name, bundleId, platform, storeUrl?, appStoreId?, category?, ctvMeta? }.", { fields }, (a) => client.apps.create(a.fields));
23498
- tool("update_app", "Update an app. fields: { appAdsTxt?, skadnetworkIds?, ctvMeta?, storeUrl?, platform? }.", { id: external_exports.string(), fields }, (a) => client.apps.update(a.id, a.fields));
23525
+ tool("create_app", "Register a mobile/CTV app. fields: { kind: mobile_app|ctv, name, bundleId, platform, storeUrl?, appStoreId?, category?, ctvMeta?, developerPropertyId? (your website property whose /app-ads.txt proves the app) }. Starts pending; then verify_app. Test tag tk_test fills before verification.", { fields }, (a) => client.apps.create(a.fields));
23526
+ tool("update_app", "Update an app. fields: { appAdsTxt?, skadnetworkIds?, ctvMeta?, storeUrl?, platform?, developerPropertyId? (website property id; null unlinks) }.", { id: external_exports.string(), fields }, (a) => client.apps.update(a.id, a.fields));
23527
+ tool("delete_app", "Delete an app (soft-deletes it and its placements).", { id: external_exports.string() }, (a) => client.apps.delete(a.id));
23528
+ tool("verify_app", "Verify an app. developer_site (default): the linked, verified developer website must serve /app-ads.txt with 'adviverse.com, <your account id>, DIRECT' (see get_app_ads_txt). store_listing: also checks the apps.apple.com / play.google.com listing. On failure returns error + message saying what to fix.", { id: external_exports.string(), method: external_exports.enum(["developer_site", "store_listing"]).optional() }, (a) => client.apps.verify(a.id, a.method));
23499
23529
  tool("get_app_ads_txt", "An app's generated app-ads.txt content.", { id: external_exports.string() }, (a) => client.apps.appAdsTxt(a.id));
23500
23530
  tool("report_ivt", "Invalid-traffic breakdown.", reportQuery, (a) => client.reporting.ivt(a));
23501
23531
  tool("report_reach", "Reach & frequency (unique users): total reach, average frequency, a frequency-distribution histogram (impressions per user), and daily unique reach.", reportQuery, (a) => client.reporting.reach(a));
@@ -23642,10 +23672,29 @@ function createServer(client) {
23642
23672
  }
23643
23673
 
23644
23674
  // src/index.ts
23645
- var apiKey = process.env.ADVIVERSE_API_KEY;
23646
- var baseUrl = process.env.ADVIVERSE_BASE_URL || "https://adviverse.com";
23675
+ function cliConfigPath() {
23676
+ const env = process.env;
23677
+ const dir = process.platform === "win32" ? env.APPDATA ?? join(homedir(), "AppData", "Roaming") : process.platform === "darwin" ? join(homedir(), "Library", "Application Support") : env.XDG_CONFIG_HOME || join(homedir(), ".config");
23678
+ return join(dir, "adviverse", "config.json");
23679
+ }
23680
+ function cliConfig() {
23681
+ try {
23682
+ return JSON.parse(readFileSync(cliConfigPath(), "utf8"));
23683
+ } catch {
23684
+ return {};
23685
+ }
23686
+ }
23687
+ var saved = process.env.ADVIVERSE_API_KEY ? {} : cliConfig();
23688
+ var apiKey = process.env.ADVIVERSE_API_KEY || saved.api_key;
23689
+ var baseUrl = process.env.ADVIVERSE_BASE_URL || saved.base_url || "https://adviverse.com";
23647
23690
  if (!apiKey) {
23648
- console.error("ADVIVERSE_API_KEY is required (create one in Settings \u2192 API keys).");
23691
+ console.error(
23692
+ `No API key: set ADVIVERSE_API_KEY (Settings \u2192 API keys) or run \`adviverse login\` (looked in ${cliConfigPath()}).`
23693
+ );
23694
+ process.exit(1);
23695
+ }
23696
+ if (saved.expires_at && Date.parse(saved.expires_at) < Date.now()) {
23697
+ console.error(`The saved CLI key expired at ${saved.expires_at}; run \`adviverse login\` again.`);
23649
23698
  process.exit(1);
23650
23699
  }
23651
23700
  async function main() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adviverse/mcp",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "MCP server exposing the Adviverse ad network API as tools for AI agents.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",
@@ -22,8 +22,8 @@
22
22
  "tsup": "^8.3.0",
23
23
  "typescript": "^5.6.2",
24
24
  "@types/node": "^22.0.0",
25
- "@adviverse/sdk": "0.1.5",
26
- "@adnet/shared": "0.1.0"
25
+ "@adnet/shared": "0.1.0",
26
+ "@adviverse/sdk": "0.1.7"
27
27
  },
28
28
  "repository": {
29
29
  "type": "git",