sponsored-code-mcp 4.0.0

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/LICENSE ADDED
@@ -0,0 +1,92 @@
1
+ Required Notice: Copyright 2026 Sponsored Code (https://sponsoredcode.com)
2
+ Licensor Line of Business: Sponsored Code — a marketplace for clearly-labeled, paid sponsorships shown in AI developer tools (https://sponsoredcode.com)
3
+
4
+ # PolyForm Shield License 1.0.0
5
+
6
+ <https://polyformproject.org/licenses/shield/1.0.0>
7
+
8
+ ## Acceptance
9
+
10
+ In order to get any license under these terms, you must agree to them as both strict obligations and conditions to all your licenses.
11
+
12
+ ## Copyright License
13
+
14
+ The licensor grants you a copyright license for the software to do everything you might do with the software that would otherwise infringe the licensor's copyright in it for any permitted purpose. However, you may only distribute the software according to [Distribution License](#distribution-license) and make changes or new works based on the software according to [Changes and New Works License](#changes-and-new-works-license).
15
+
16
+ ## Distribution License
17
+
18
+ The licensor grants you an additional copyright license to distribute copies of the software. Your license to distribute covers distributing the software with changes and new works permitted by [Changes and New Works License](#changes-and-new-works-license).
19
+
20
+ ## Notices
21
+
22
+ You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms or the URL for them above, as well as copies of any plain-text lines beginning with `Required Notice:` that the licensor provided with the software. For example:
23
+
24
+ > Required Notice: Copyright Yoyodyne, Inc. (http://example.com)
25
+
26
+ ## Changes and New Works License
27
+
28
+ The licensor grants you an additional copyright license to make changes and new works based on the software for any permitted purpose.
29
+
30
+ ## Patent License
31
+
32
+ The licensor grants you a patent license for the software that covers patent claims the licensor can license, or becomes able to license, that you would infringe by using the software.
33
+
34
+ ## Noncompete
35
+
36
+ Any purpose is a permitted purpose, except for providing any product that competes with the software or any product the licensor or any of its affiliates provides using the software.
37
+
38
+ ## Competition
39
+
40
+ Goods and services compete even when they provide functionality through different kinds of interfaces or for different technical platforms. Applications can compete with services, libraries with plugins, frameworks with development tools, and so on, even if they're written in different programming languages or for different computer architectures. Goods and services compete even when provided free of charge. If you market a product as a practical substitute for the software or another product, it definitely competes.
41
+
42
+ ## New Products
43
+
44
+ If you are using the software to provide a product that does not compete, but the licensor or any of its affiliates brings your product into competition by providing a new version of the software or another product using the software, you may continue using versions of the software available under these terms beforehand to provide your competing product, but not any later versions.
45
+
46
+ ## Discontinued Products
47
+
48
+ You may begin using the software to compete with a product or service that the licensor or any of its affiliates has stopped providing, unless the licensor includes a plain-text line beginning with `Licensor Line of Business:` with the software that mentions that line of business. For example:
49
+
50
+ > Licensor Line of Business: YoyodyneCMS Content Management System (http://example.com/cms)
51
+
52
+ ## Sales of Business
53
+
54
+ If the licensor or any of its affiliates sells a line of business developing the software or using the software to provide a product, the buyer can also enforce [Noncompete](#noncompete) for that product.
55
+
56
+ ## Fair Use
57
+
58
+ You may have "fair use" rights for the software under the law. These terms do not limit them.
59
+
60
+ ## No Other Rights
61
+
62
+ These terms do not allow you to sublicense or transfer any of your licenses to anyone else, or prevent the licensor from granting licenses to anyone else. These terms do not imply any other licenses.
63
+
64
+ ## Patent Defense
65
+
66
+ If you make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
67
+
68
+ ## Violations
69
+
70
+ The first time you are notified in writing that you have violated any of these terms, or done anything with the software not covered by your licenses, your licenses can nonetheless continue if you come into full compliance with these terms, and take practical steps to correct past violations, within 32 days of receiving notice. Otherwise, all your licenses end immediately.
71
+
72
+ ## No Liability
73
+
74
+ ***As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.***
75
+
76
+ ## Definitions
77
+
78
+ The **licensor** is the individual or entity offering these terms, and the **software** is the software the licensor makes available under these terms.
79
+
80
+ A **product** can be a good or service, or a combination of them.
81
+
82
+ **You** refers to the individual or entity agreeing to these terms.
83
+
84
+ **Your company** is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all its affiliates.
85
+
86
+ **Affiliates** means the other organizations than an organization has control over, is under the control of, or is under common control with.
87
+
88
+ **Control** means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
89
+
90
+ **Your licenses** are all the licenses granted to you for the software under these terms.
91
+
92
+ **Use** means anything you do with the software requiring one of your licenses.
package/README.md ADDED
@@ -0,0 +1,74 @@
1
+ <p align="center">
2
+ <a href="https://sponsoredcode.com"><img src="https://sponsoredcode.com/mascot/mcp.webp" alt="Sponsored Code — brand MCP server" width="300" /></a>
3
+ </p>
4
+
5
+ # [<img src="https://sponsoredcode.com/sponsored-code-mark.svg" alt="Sponsored Code" />](https://sponsoredcode.com)
6
+
7
+ [![npm](https://img.shields.io/npm/v/sponsored-code-mcp?color=cb3837&logo=npm)](https://www.npmjs.com/package/sponsored-code-mcp)
8
+ [![license](https://img.shields.io/badge/license-source--available-blue)](./LICENSE)
9
+ [![sponsoredcode.com](https://img.shields.io/badge/web-sponsoredcode.com-111)](https://sponsoredcode.com)
10
+
11
+ ## Brand MCP server
12
+
13
+ Manage your [Sponsored Code](https://sponsoredcode.com) campaigns from Claude — or any Model Context Protocol
14
+ client — right inside the chat. Ask *"how are my ads doing?"* or *"launch a campaign for X"*. It's the brand
15
+ [SDK](https://www.npmjs.com/package/@sponsored-code/sdk) wrapped as an MCP server, and it signs in with an **API key**.
16
+
17
+ Runs over stdio via `npx` — no install, no wallet, no browser.
18
+
19
+ ## Get an API key
20
+
21
+ In the [dashboard](https://sponsoredcode.com/dashboard), open **Settings → API keys** and create a key. You'll
22
+ see the secret (`scode_live_…`) **once** — store it safely. A key is scoped to one team and to **read** and/or
23
+ **write**:
24
+
25
+ - **read** — analytics, impressions, list campaigns
26
+ - **write** — create, pause, and resume campaigns
27
+
28
+ A key can't move funds or change a payout wallet. Revoke it any time from the same screen.
29
+
30
+ ## Configure your client
31
+
32
+ **Any MCP-capable CLI** — Claude Code, Codex, Gemini, and friends all share the same `mcp add` subcommand, so swap the binary for your tool:
33
+
34
+ ```bash
35
+ claude mcp add sponsored-code \
36
+ --env SCODE_API_KEY=scode_live_your_key \
37
+ -- npx -y sponsored-code-mcp
38
+ ```
39
+
40
+ **Claude Desktop** (`claude_desktop_config.json`) or **Cursor** (`~/.cursor/mcp.json`):
41
+
42
+ ```json
43
+ {
44
+ "mcpServers": {
45
+ "sponsored-code": {
46
+ "command": "npx",
47
+ "args": ["-y", "sponsored-code-mcp"],
48
+ "env": { "SCODE_API_KEY": "scode_live_your_key" }
49
+ }
50
+ }
51
+ }
52
+ ```
53
+
54
+ ## Tools
55
+
56
+ | tool | scope | what it does |
57
+ |---|---|---|
58
+ | `whoami` | read | The team and scopes your key resolves to. |
59
+ | `analytics` | read | Impressions, spend, reach, clicks, geography, per-campaign. |
60
+ | `recent_impressions` | read | Your team's most recent impressions. |
61
+ | `list_campaigns` | read | Every campaign in the team and its status. |
62
+ | `create_campaign` | write | Launch a campaign into the live auction. |
63
+ | `set_campaign_status` | write | Pause or resume a campaign. |
64
+
65
+ Analytics are aggregate — the API never exposes an individual developer's wallet or IP.
66
+
67
+ ## Learn more
68
+
69
+ - [Docs → MCP for brands](https://sponsoredcode.com/docs/mcp/brands)
70
+ - [Docs → SDK & API](https://sponsoredcode.com/docs/sdk) — the same actions from your own code.
71
+
72
+ ## License
73
+
74
+ [PolyForm Shield 1.0.0](./LICENSE) — source-available. See [sponsoredcode.com](https://sponsoredcode.com).
package/dist/mcp.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export declare function runMcpServer(): Promise<void>;
package/dist/mcp.js ADDED
@@ -0,0 +1,70 @@
1
+ #!/usr/bin/env node
2
+ // MCP server for the Sponsored Code brand API: campaigns + analytics from Claude or any MCP client, authed
3
+ // by an API key (SCODE_API_KEY). Read tools need a read key; create/status need a write key.
4
+ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
5
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
6
+ import { ListToolsRequestSchema, CallToolRequestSchema } from "@modelcontextprotocol/sdk/types.js";
7
+ import { pathToFileURL } from "node:url";
8
+ import { SponsoredCode } from "@sponsored-code/sdk";
9
+ import { MCP_VERSION } from "./version.js";
10
+ const TOOLS = [
11
+ { name: "whoami", description: "The team and scopes this API key resolves to — verify the key works.", inputSchema: { type: "object", properties: {} } },
12
+ { name: "analytics", description: "Aggregate analytics for the team: impressions, spend, reach, clicks, geography, per-campaign.", inputSchema: { type: "object", properties: {} } },
13
+ { name: "recent_impressions", description: "The team's most recent impressions (newest first).", inputSchema: { type: "object", properties: { limit: { type: "number", description: "1–100, default 20" } } } },
14
+ { name: "list_campaigns", description: "Every campaign in the key's team and its status.", inputSchema: { type: "object", properties: {} } },
15
+ {
16
+ name: "create_campaign",
17
+ description: "Launch a campaign (needs a write-scoped key).",
18
+ inputSchema: {
19
+ type: "object",
20
+ required: ["brand", "tagline", "url"],
21
+ properties: {
22
+ brand: { type: "string" }, tagline: { type: "string" }, url: { type: "string" },
23
+ bidUsdCpm: { type: "number", description: "Max CPM in USD (default 20)" },
24
+ budgetUsd: { type: "number", description: "USDC budget (default 500)" },
25
+ color: { type: "string", description: "Hex color (default #2563eb)" },
26
+ targetCountries: { type: "array", items: { type: "string" }, description: "Restrict serving to these ISO 3166 alpha-2 countries (e.g. [\"US\",\"DE\"]). Omit = everywhere." },
27
+ },
28
+ },
29
+ },
30
+ {
31
+ name: "set_campaign_status",
32
+ description: "Pause or resume one of your team's campaigns (needs a write-scoped key).",
33
+ inputSchema: {
34
+ type: "object",
35
+ required: ["campaignId", "status"],
36
+ properties: {
37
+ campaignId: { type: "string", description: "The campaign id (from list_campaigns)." },
38
+ status: { type: "string", enum: ["active", "paused"] },
39
+ },
40
+ },
41
+ },
42
+ ];
43
+ export async function runMcpServer() {
44
+ process.env.SCODE_NO_UPDATE_CHECK ??= "1"; // an MCP server shouldn't ping the npm registry on startup
45
+ const scode = new SponsoredCode();
46
+ const server = new Server({ name: "sponsored-code", version: MCP_VERSION }, { capabilities: { tools: {} } });
47
+ server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS }));
48
+ server.setRequestHandler(CallToolRequestSchema, async (req) => {
49
+ const args = (req.params.arguments ?? {});
50
+ const ok = (data) => ({ content: [{ type: "text", text: JSON.stringify(data, null, 2) }] });
51
+ try {
52
+ switch (req.params.name) {
53
+ case "whoami": return ok(await scode.whoami());
54
+ case "analytics": return ok(await scode.analytics());
55
+ case "recent_impressions": return ok(await scode.impressions({ limit: Number(args.limit) || undefined }));
56
+ case "list_campaigns": return ok(await scode.campaigns.list());
57
+ case "create_campaign": return ok(await scode.campaigns.create(args));
58
+ case "set_campaign_status": return ok(await scode.campaigns.setStatus(String(args.campaignId ?? ""), String(args.status ?? "")));
59
+ default: throw new Error(`Unknown tool: ${req.params.name}`);
60
+ }
61
+ }
62
+ catch (e) {
63
+ return { isError: true, content: [{ type: "text", text: e instanceof Error ? e.message : String(e) }] };
64
+ }
65
+ });
66
+ await server.connect(new StdioServerTransport());
67
+ }
68
+ if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
69
+ runMcpServer().catch((e) => { console.error(e instanceof Error ? e.message : String(e)); process.exit(1); });
70
+ }
@@ -0,0 +1 @@
1
+ export declare const MCP_VERSION = "4.0.0";
@@ -0,0 +1,2 @@
1
+ // Generated by genversion.mjs at build — do not edit.
2
+ export const MCP_VERSION = "4.0.0";
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "sponsored-code-mcp",
3
+ "version": "4.0.0",
4
+ "type": "module",
5
+ "description": "MCP server for the Sponsored Code brand API — manage campaigns and pull analytics from Claude or any Model Context Protocol client with an API key.",
6
+ "keywords": [
7
+ "sponsored-code",
8
+ "mcp",
9
+ "model-context-protocol",
10
+ "claude",
11
+ "usdc",
12
+ "polygon",
13
+ "ads"
14
+ ],
15
+ "license": "PolyForm-Shield-1.0.0",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/sponsored-code/mcp.git"
19
+ },
20
+ "homepage": "https://sponsoredcode.com",
21
+ "bugs": "https://github.com/sponsored-code/mcp/issues",
22
+ "bin": {
23
+ "sponsored-code-mcp": "dist/mcp.js"
24
+ },
25
+ "main": "./dist/mcp.js",
26
+ "types": "./dist/mcp.d.ts",
27
+ "exports": {
28
+ ".": {
29
+ "types": "./dist/mcp.d.ts",
30
+ "default": "./dist/mcp.js"
31
+ }
32
+ },
33
+ "files": [
34
+ "dist"
35
+ ],
36
+ "dependencies": {
37
+ "@modelcontextprotocol/sdk": "^1.29.0",
38
+ "@sponsored-code/sdk": "^4.0.0"
39
+ },
40
+ "engines": {
41
+ "node": ">=18"
42
+ },
43
+ "scripts": {
44
+ "typecheck": "tsc --noEmit"
45
+ },
46
+ "publishConfig": {
47
+ "access": "public"
48
+ }
49
+ }