About PlayerOS
PlayerOS SDK is a TypeScript/JavaScript SDK and CLI for the PlayerOS API, a platform for casino operators. It covers player data, campaigns, compliance, privacy, and webhooks, and PlayerOS also provides an MCP server for AI agents.
Key features
- 01Manage player records
- 02Send email and SMS campaigns
- 03Check compliance and record consent
- 04Export or delete privacy data
- 05Manage webhooks and API keys
- 06CLI with JSON output
Use cases
- 01Find or update player profiles
- 02Run campaigns with idempotency keys
- 03Handle consent records and privacy requests
- 04Pipe API results from the CLI into other commands
MCP support
PlayerOS provides an MCP server at `https://api.playeros.ai/api/mcp`, with 25 tools and discoverable resources for AI agents.
Configuration
Remote servers need no local install. Pick your client, then copy the config or install in one click.
https://api.playeros.ai/api/mcpclaude mcp add --transport http playeros-sdk https://api.playeros.ai/api/mcp{"mcpServers":{"playeros-sdk":{"type":"http","url":"https://api.playeros.ai/api/mcp"}}}Open in Cursor{"servers":{"playeros-sdk":{"type":"http","url":"https://api.playeros.ai/api/mcp"}}}Open in VS Code{"mcpServers":{"playeros-sdk":{"type":"http","url":"https://api.playeros.ai/api/mcp"}}}{"mcpServers":{"playeros-sdk":{"serverUrl":"https://api.playeros.ai/api/mcp"}}}Run commands in a terminal; paste JSON into the client’s MCP config and restart. Servers that need sign-in will prompt on first connect.
Tools
25| Parameter | Type | Required | Description |
|---|---|---|---|
| limit | integer | No | Max rows (default 25, max 200). |
| status | string | No | Exact status filter, e.g. 'active'. |
| email_contains | string | No | Case-insensitive email substring. |
| order | string | No | Order clause, e.g. 'created_at.desc'. |
Details
From the project READMEPlayerOS SDK
Official TypeScript/JavaScript SDK and CLI for the PlayerOS API — the casino marketing platform for gaming operators (unified player database, multi-channel campaigns, journey automation, and TCPA/CCPA/GDPR compliance).
- Docs: https://playeros.ai/api-docs · Markdown
- OpenAPI 3.1: https://playeros.ai/openapi.json
- MCP server (for AI agents): https://api.playeros.ai/api/mcp · manifest
- Auth guide: https://playeros.ai/auth.md
Zero runtime dependencies. Node 18+ (uses built-in fetch).
Install
npm install @playeros/sdk
Authenticate
Create a property-scoped API key (pk_…) in Settings → API & MCP
(https://playeros.ai/dashboard/mcp). Keys carry read and/or write scopes and are
bound to one property. Send it as X-Api-Key (the SDK does this for you).
Quickstart
import { PlayerOS } from "@playeros/sdk";
const playeros = new PlayerOS({ apiKey: process.env.PLAYEROS_API_KEY! });
// List players
const { data: players, totalCount } = await playeros.players.list({ limit: 50, q: "gold" });
// Create a player (gaming-native fields)
await playeros.players.create({ email: "[email protected]", tier: "Gold", adt: 250, coin_in: 18000 });
// Send a campaign — pass an idempotencyKey so retries never double-send
await playeros.campaigns.sendEmail(
{ campaignId: "…", propertyId: "…" },
{ idempotencyKey: crypto.randomUUID() }
);
Resources
| Group | Methods |
|---|---|
players | list, get, create, update, delete, validateBatch |
validationJobs | get (poll an async batch job) |
campaigns | sendEmail, sendSms (both accept { idempotencyKey }) |
compliance | check, recordConsent |
privacy | exportData, deleteData (CCPA / GDPR) |
webhooks | list, create |
apiKeys | create, list, revoke (admin; needs a dashboard JWT) |
Every call returns { data, status, requestId, totalCount?, rateLimit, idempotencyReplayed? }.
Errors
Non-2xx responses throw PlayerOSError with a stable .code you can branch on:
import { PlayerOSError } from "@playeros/sdk";
try {
await playeros.players.create({ /* … */ });
} catch (e) {
if (e instanceof PlayerOSError) {
if (e.code === "insufficient_scope") { /* use a write-scoped key */ }
if (e.status === 429) await sleep((e.retryAfter ?? 1) * 1000); // then retry
console.error(e.status, e.code, e.requestId);
}
}
Honor the rateLimit (X-RateLimit-*) hints and back off on 429.
CLI
The package ships a playeros command:
export PLAYEROS_API_KEY=pk_live_…
playeros players list --limit 25
playeros players get <id>
playeros players create --data '{"email":"[email protected]","tier":"Gold"}'
playeros campaigns send <campaignId> --property <propertyId> --idempotency-key $(uuidgen)
playeros compliance check --data '{"propertyId":"…","playerId":"…","channel":"sms"}'
playeros --help
Output is JSON on stdout — pipe to jq. Run one-off without installing: npx @playeros/sdk --help.
For AI agents
See AGENTS.md. PlayerOS also exposes a Model Context Protocol
server at https://api.playeros.ai/api/mcp with 25 tools and discoverable resources.
License
MIT © PlayerOS
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.