TypeScript client for the Scope3 Agentic Platform. Two entry points for two audiences:
- REST consumers (humans, CLI, programmatic) →
Scope3Clientwith typed resource methods - MCP consumers (AI agents) →
Scope3McpClient— thin connection helper with directcallTool/readResource
npm install scope3Obtain your API key from the Scope3 dashboard:
- Production: https://agentic.scope3.com -> Manage API Keys
- Staging: https://agentic.staging.scope3.com -> Manage API Keys
| Environment | URL |
|---|---|
| Production | https://api.agentic.scope3.com |
| Staging | https://api.agentic.staging.scope3.com |
The Scope3Client provides typed resource methods and requires a persona parameter.
import { Scope3Client } from 'scope3';
const client = new Scope3Client({
apiKey: process.env.SCOPE3_API_KEY!,
persona: 'buyer',
});
// List advertisers
const advertisers = await client.advertisers.list();
// Create a bundle for inventory discovery
const bundle = await client.bundles.create({
advertiserId: 'adv-123',
channels: ['display', 'video'],
});
// Discover products in the bundle
const products = await client.bundles.discoverProducts(bundle.data.bundleId);
// Add products to the bundle
await client.bundles.products(bundle.data.bundleId).add({
products: [{ productId: 'prod-1', salesAgentId: 'sa-1', groupId: 'g-1', groupName: 'Group 1' }],
});
// Create and execute a discovery campaign
const campaign = await client.campaigns.createDiscovery({
advertiserId: 'adv-123',
bundleId: bundle.data.bundleId,
name: 'Q1 Campaign',
flightDates: { startDate: '2025-01-15', endDate: '2025-03-31' },
budget: { total: 50000, currency: 'USD' },
});
await client.campaigns.execute(campaign.data.id);const sfClient = new Scope3Client({
apiKey: process.env.SCOPE3_API_KEY!,
persona: 'storefront',
});
// Get your storefront
const sf = await sfClient.storefront.get();
// Create an inventory source (registers an agent)
const source = await sfClient.inventorySources.create({
sourceId: 'my-sales-agent',
name: 'My Sales Agent',
executionType: 'agent',
type: 'SALES',
endpointUrl: 'https://my-agent.example.com/mcp',
protocol: 'MCP',
authenticationType: 'API_KEY',
auth: { type: 'bearer', token: 'my-api-key' },
});
// Check readiness
const readiness = await sfClient.readiness.check();The Scope3McpClient is a thin connection helper for AI agents. It wires up auth and the MCP URL, then exposes callTool(), readResource(), and listTools() as direct passthroughs. The MCP server handles routing and validation — no typed resource wrappers needed.
import { Scope3McpClient } from 'scope3';
const mcp = new Scope3McpClient({
apiKey: process.env.SCOPE3_API_KEY!,
});
await mcp.connect();
// Call tools directly — the v2 buyer surface exposes:
// api_call, ask_about_capability, help, health
const result = await mcp.callTool('api_call', {
method: 'GET',
path: '/api/v2/buyer/advertisers',
});
// Ask what the API can do
const capabilities = await mcp.callTool('ask_about_capability', {
question: 'How do I create a campaign?',
});
// List available tools
const tools = await mcp.listTools();
await mcp.disconnect();const client = new Scope3Client({
apiKey: 'your-api-key', // Required: Bearer token
persona: 'buyer', // Required: 'buyer' | 'storefront'
environment: 'production', // Optional: 'production' (default) | 'staging'
baseUrl: 'https://custom.com', // Optional: overrides environment
timeout: 30000, // Optional: request timeout in ms
debug: false, // Optional: enable debug logging
});const mcp = new Scope3McpClient({
apiKey: 'your-api-key', // Required: Bearer token
environment: 'production', // Optional: 'production' (default) | 'staging'
baseUrl: 'https://custom.com', // Optional: overrides environment
debug: false, // Optional: enable debug logging
});# Configure
scope3 config set apiKey your_api_key_here
scope3 config set environment staging
# Use
scope3 advertisers list
scope3 advertisers get adv-123
scope3 campaigns list --format json
scope3 bundles create --advertiser-id adv-123 --channels display,video
# Override persona per-command
scope3 --persona storefront storefront get
# See all commands
scope3 commandsclient.advertisers-- CRUD and sub-resources (conversionEvents, creativeSets, testCohorts, eventSources, measurementData, catalogs, audiences, syndication, propertyLists)client.campaigns-- list, get, createDiscovery, updateDiscovery, createPerformance, updatePerformance, createAudience, execute, pause, creatives(campaignId)client.bundles-- create, discoverProducts, browseProducts, products(bundleId)client.signals-- Discover signalsclient.reporting-- Get reporting metricsclient.salesAgents-- List sales agents, register accountsclient.tasks-- Get task statusclient.propertyListChecks-- Run and retrieve property list check reports
client.storefront-- get, create, update, deleteclient.inventorySources-- list, get, create, update, deleteclient.agents-- list, get, updateclient.readiness-- checkclient.billing-- get, connect, status, transactions, payouts, onboardingUrlclient.notifications-- list, markAsRead, acknowledge, markAllAsRead
// Get parsed skill documentation
const skill = await client.getSkill();
console.log(skill.name, skill.version);
console.log(skill.commands); // Available API commandsA WebhookServer class is available for handling AdCP events. See docs/getting-started.md for usage details.
npm install
npm run type-check
npm run build
npm test
npm run lintThe SDK is manually maintained. When the Agentic API changes, update these files:
| What changed | Files to update |
|---|---|
| Request/response shapes | src/types/index.ts |
| Endpoints added/removed | src/resources/ (the relevant resource class) |
| CLI commands | src/cli/commands/ (the relevant command file) |
| Bundled skill.md | src/skill/bundled.ts (copy from API response) |
Steps:
- Check the latest skill.md for your persona:
curl https://api.agentic.scope3.com/api/v2/buyer/skill.md curl https://api.agentic.scope3.com/api/v2/storefront/skill.md
- Compare against
src/skill/bundled.tsand update if needed - Update types in
src/types/index.tsto match any schema changes - Update resource methods in
src/resources/for endpoint changes - Update CLI commands in
src/cli/commands/if applicable - Run
npm testandnpm run buildto verify - Run manual workflow tests:
npm run test:buyer,npm run test:storefront
export SCOPE3_API_KEY=your_key
npm run test:buyer # Buyer workflow
npm run test:storefront # Storefront workflow
npm run test:all # All workflowsThis project uses Changesets for version management. When making changes that should be released, run npm run changeset and follow the prompts to describe your change. The changeset file is committed with your PR.
MIT