@grampixel/mcp-server 0.0.0-stage → 1.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.
Files changed (3) hide show
  1. package/README.md +47 -2
  2. package/index.mjs +114 -0
  3. package/package.json +26 -4
package/README.md CHANGED
@@ -1,3 +1,48 @@
1
- # Temporary Holding Version
1
+ # GramPixel MCP Server
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Workspace-scoped Model Context Protocol (MCP) server for GramPixel.
4
+
5
+ Allows AI assistants (Cursor, Claude Desktop, Claude Code, Windsurf, Antigravity, etc.) to:
6
+ - Audit your workspace setup status and guide you step-by-step in the right order
7
+ - Configure custom tracking domains & verify DNS/TLS
8
+ - Connect Telegram bots, channels, groups, managers, and Mini Apps
9
+ - Create and update visual block-based pre-landings
10
+ - Generate smart tracking links with UTM macros
11
+ - Configure Meta CAPI, TikTok Events API, Google Ads Offline Conversions, and S2S postbacks
12
+ - Send test events and inspect delivery logs & workspace stats
13
+
14
+ ## Security & Access Control
15
+ - Authenticated **strictly** with your user workspace API key (`pk_live_...`).
16
+ - Strictly locked to the single workspace and scopes (`setup:read`, `setup:write`, `links:*`, `webhooks:*`, `stats:read`, `events:write`) configured for that key.
17
+ - Read-only workspace members cannot run write tools even if the key has write scopes.
18
+ - Bot tokens, ad platform tokens, and credentials are never returned in MCP responses.
19
+
20
+ ## Quick Setup via `npx`
21
+
22
+ ### Cursor / Claude Desktop / Windsurf / Antigravity
23
+
24
+ ```json
25
+ {
26
+ "mcpServers": {
27
+ "grampixel": {
28
+ "command": "npx",
29
+ "args": ["-y", "@grampixel/mcp-server"],
30
+ "env": {
31
+ "GRAMPIXEL_API_KEY": "pk_live_YOUR_API_KEY"
32
+ }
33
+ }
34
+ }
35
+ }
36
+ ```
37
+
38
+ ### Claude Code CLI
39
+
40
+ ```bash
41
+ claude mcp add grampixel -- npx -y @grampixel/mcp-server --api-key pk_live_YOUR_API_KEY
42
+ ```
43
+
44
+ ### Direct CLI Test
45
+
46
+ ```bash
47
+ npx -y @grampixel/mcp-server --api-key pk_live_YOUR_API_KEY
48
+ ```
package/index.mjs ADDED
@@ -0,0 +1,114 @@
1
+ #!/usr/bin/env node
2
+ import readline from 'node:readline';
3
+
4
+ const argv = process.argv.slice(2);
5
+
6
+ function readCliOption(names) {
7
+ for (let i = 0; i < argv.length; i += 1) {
8
+ const arg = argv[i];
9
+ for (const name of names) {
10
+ if (arg === name && argv[i + 1]) {
11
+ return argv[i + 1].trim();
12
+ }
13
+ if (arg.startsWith(`${name}=`)) {
14
+ return arg.slice(name.length + 1).trim();
15
+ }
16
+ }
17
+ }
18
+ return '';
19
+ }
20
+
21
+ if (argv.includes('--help') || argv.includes('-h')) {
22
+ process.stdout.write(
23
+ [
24
+ 'GramPixel MCP Server (@grampixel/mcp-server)',
25
+ '',
26
+ 'Usage:',
27
+ ' npx -y @grampixel/mcp-server --api-key pk_live_YOUR_API_KEY',
28
+ ' GRAMPIXEL_API_KEY=pk_live_YOUR_API_KEY npx -y @grampixel/mcp-server',
29
+ '',
30
+ 'Options:',
31
+ ' --api-key, --key <key> Workspace API key (or set GRAMPIXEL_API_KEY)',
32
+ ' --workspace, --workspace-id Optional workspace ID lock check',
33
+ ' -h, --help Show help',
34
+ ' -v, --version Show version',
35
+ '',
36
+ ].join('\n')
37
+ );
38
+ process.exit(0);
39
+ }
40
+
41
+ if (argv.includes('--version') || argv.includes('-v')) {
42
+ process.stdout.write('1.0.0\n');
43
+ process.exit(0);
44
+ }
45
+
46
+ const API_URL = (process.env.GRAMPIXEL_API_URL || 'https://api.grampixel.com/v1').replace(/\/+$/, '');
47
+ const MCP_ENDPOINT = `${API_URL}/mcp`;
48
+ const API_KEY = (readCliOption(['--api-key', '--key']) || process.env.GRAMPIXEL_API_KEY || '').trim();
49
+ const WORKSPACE_ID = (readCliOption(['--workspace', '--workspace-id']) || process.env.GRAMPIXEL_WORKSPACE_ID || '').trim();
50
+
51
+ if (!API_KEY) {
52
+ process.stderr.write(
53
+ '[grampixel-mcp] Error: API key is required. Pass --api-key pk_live_... or set GRAMPIXEL_API_KEY.\n'
54
+ );
55
+ process.exit(1);
56
+ }
57
+
58
+ const rl = readline.createInterface({
59
+ input: process.stdin,
60
+ crlfDelay: Infinity,
61
+ });
62
+
63
+ function writeMessage(payload) {
64
+ process.stdout.write(`${JSON.stringify(payload)}\n`);
65
+ }
66
+
67
+ rl.on('line', async (line) => {
68
+ const trimmed = line.trim();
69
+ if (!trimmed) return;
70
+
71
+ let msg;
72
+ try {
73
+ msg = JSON.parse(trimmed);
74
+ } catch {
75
+ return;
76
+ }
77
+
78
+ // Notifications without an id do not expect a JSON-RPC response on stdout
79
+ const isNotification = msg.id === undefined || msg.id === null;
80
+
81
+ try {
82
+ const headers = {
83
+ 'Content-Type': 'application/json',
84
+ 'x-api-key': API_KEY,
85
+ };
86
+ if (WORKSPACE_ID) {
87
+ headers['x-workspace-id'] = WORKSPACE_ID;
88
+ }
89
+
90
+ const resp = await fetch(MCP_ENDPOINT, {
91
+ method: 'POST',
92
+ headers,
93
+ body: JSON.stringify(msg),
94
+ });
95
+
96
+ if (resp.status === 202 || isNotification) {
97
+ return;
98
+ }
99
+
100
+ const data = await resp.json();
101
+ writeMessage(data);
102
+ } catch (err) {
103
+ if (!isNotification) {
104
+ writeMessage({
105
+ jsonrpc: '2.0',
106
+ id: msg.id,
107
+ error: {
108
+ code: -32603,
109
+ message: err instanceof Error ? err.message : 'Failed to connect to GramPixel MCP service',
110
+ },
111
+ });
112
+ }
113
+ }
114
+ });
package/package.json CHANGED
@@ -1,6 +1,28 @@
1
1
  {
2
2
  "name": "@grampixel/mcp-server",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "1.0.0",
4
+ "description": "Workspace-scoped Model Context Protocol (MCP) server for GramPixel setup, visual pre-landings, diagnostics, and S2S configuration.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "bin": {
8
+ "grampixel-mcp": "index.mjs"
9
+ },
10
+ "files": [
11
+ "index.mjs",
12
+ "README.md"
13
+ ],
14
+ "keywords": [
15
+ "grampixel",
16
+ "mcp",
17
+ "model-context-protocol",
18
+ "telegram",
19
+ "attribution",
20
+ "capi"
21
+ ],
22
+ "scripts": {
23
+ "start": "node ./index.mjs"
24
+ },
25
+ "engines": {
26
+ "node": ">=18.0.0"
27
+ }
28
+ }