@productbrain/mcp 0.0.1-beta.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.
@@ -0,0 +1,32 @@
1
+ # ProductBrain MCP — Environment Variables
2
+ # Copy this file to .env.mcp and fill in your values.
3
+ # In Claude Desktop / Cursor, these are typically set via the MCP config's "env" block.
4
+
5
+ # ── Cloud Mode (recommended) ──────────────────────────────────────────
6
+ #
7
+ # PRODUCTBRAIN_API_KEY — Your API key from SynergyOS Settings → API Keys.
8
+ # Starts with pb_sk_. This is the only required variable.
9
+ #
10
+ # PRODUCTBRAIN_URL — Override the backend URL.
11
+ # Defaults to ProductBrain Cloud. Set to http://localhost:3210
12
+ # for local development.
13
+
14
+ # PRODUCTBRAIN_API_KEY=pb_sk_your_key_here
15
+ # PRODUCTBRAIN_URL=https://earnest-sheep-635.convex.site
16
+
17
+ # ── Self-Hosted Mode ──────────────────────────────────────────────────
18
+ #
19
+ # CONVEX_SITE_URL — Your Convex deployment SITE URL (*.convex.site, NOT *.convex.cloud).
20
+ # MCP_API_KEY — Shared secret matching the Convex dashboard env var.
21
+ # WORKSPACE_SLUG — The workspace slug to operate on.
22
+
23
+ # CONVEX_SITE_URL=https://your-deployment.convex.site
24
+ # MCP_API_KEY=your-secret-api-key
25
+ # WORKSPACE_SLUG=your-workspace-slug
26
+
27
+ # ── Debug (optional) ──────────────────────────────────────────────────
28
+ # MCP_DEBUG=1
29
+
30
+ # ── Analytics (optional) ──────────────────────────────────────────────
31
+ # POSTHOG_MCP_KEY=
32
+ # MCP_USER_ID=
package/README.md ADDED
@@ -0,0 +1,238 @@
1
+ # ProductBrain
2
+
3
+ The single source of truth for product knowledge — glossary, business rules, tensions, decisions, labels, and relations — accessible as an MCP server in [Claude Desktop](https://claude.ai/download), [Cursor](https://cursor.com), and any MCP-compatible AI assistant.
4
+
5
+ ProductBrain connects your AI assistant to your team's knowledge base. Ask questions, capture decisions, and build a living knowledge graph without leaving your editor.
6
+
7
+ ## Quick Start (Cloud)
8
+
9
+ ### Option A: Guided setup (recommended)
10
+
11
+ ```bash
12
+ npx productbrain setup
13
+ ```
14
+
15
+ This opens SynergyOS → Settings → API Keys, prompts you to paste your key, and writes the config for Cursor or Claude Desktop.
16
+
17
+ ### Option B: Manual config
18
+
19
+ **1. Get your API key**
20
+
21
+ Go to **SynergyOS → Settings → API Keys** and click **Generate Key**. Copy the `pb_sk_...` key.
22
+
23
+ **2. Configure your AI assistant**
24
+
25
+ **Claude Desktop** — edit `~/Library/Application Support/Claude/claude_desktop_config.json`:
26
+
27
+ ```json
28
+ {
29
+ "mcpServers": {
30
+ "productbrain": {
31
+ "command": "npx",
32
+ "args": ["-y", "productbrain"],
33
+ "env": {
34
+ "PRODUCTBRAIN_API_KEY": "pb_sk_your_key_here"
35
+ }
36
+ }
37
+ }
38
+ }
39
+ ```
40
+
41
+ **Cursor** — edit `.cursor/mcp.json` in your project:
42
+
43
+ ```json
44
+ {
45
+ "mcpServers": {
46
+ "productbrain": {
47
+ "command": "npx",
48
+ "args": ["-y", "productbrain"],
49
+ "env": {
50
+ "PRODUCTBRAIN_API_KEY": "pb_sk_your_key_here"
51
+ }
52
+ }
53
+ }
54
+ }
55
+ ```
56
+
57
+ **3. Restart your assistant and verify**
58
+
59
+ Ask:
60
+
61
+ > "Use the health tool to check ProductBrain connectivity"
62
+
63
+ You should see your workspace ID, collection count, and latency.
64
+
65
+ ## Self-Hosted Setup
66
+
67
+ If you're running your own Convex deployment, use the three-variable config:
68
+
69
+ ```json
70
+ {
71
+ "mcpServers": {
72
+ "productbrain": {
73
+ "command": "npx",
74
+ "args": ["-y", "productbrain"],
75
+ "env": {
76
+ "CONVEX_SITE_URL": "https://your-deployment.convex.site",
77
+ "MCP_API_KEY": "your-shared-api-key",
78
+ "WORKSPACE_SLUG": "your-workspace-slug"
79
+ }
80
+ }
81
+ }
82
+ }
83
+ ```
84
+
85
+ | Variable | Where to find it |
86
+ |----------|-----------------|
87
+ | `CONVEX_SITE_URL` | Convex dashboard → Settings → URL (use `*.convex.site`, not `*.convex.cloud`) |
88
+ | `MCP_API_KEY` | Must match the `MCP_API_KEY` env var in your Convex deployment |
89
+ | `WORKSPACE_SLUG` | Your workspace slug from the SynergyOS URL |
90
+
91
+ ## Dev vs Production
92
+
93
+ Set `PRODUCTBRAIN_URL` to switch between environments:
94
+
95
+ ```json
96
+ {
97
+ "env": {
98
+ "PRODUCTBRAIN_API_KEY": "pb_sk_your_key_here",
99
+ "PRODUCTBRAIN_URL": "http://localhost:3210"
100
+ }
101
+ }
102
+ ```
103
+
104
+ Omit `PRODUCTBRAIN_URL` to default to production.
105
+
106
+ ## What You Can Do
107
+
108
+ ### Search and explore
109
+
110
+ - *"Search the glossary for 'tension'"*
111
+ - *"List all business rules in the Governance domain"*
112
+ - *"What is the canonical definition of 'supplier'?"*
113
+
114
+ ### Capture knowledge
115
+
116
+ - *"Capture a tension: our MCP entry creation takes too many steps"*
117
+ - *"Draft a decision record for choosing Convex over Supabase"*
118
+ - *"Create a business rule about API key rotation"*
119
+
120
+ ### Navigate the knowledge graph
121
+
122
+ - *"Gather full context around FEAT-001"*
123
+ - *"What entries are related to GT-019?"*
124
+ - *"Suggest links for this new tension"*
125
+
126
+ ### Check quality
127
+
128
+ - *"Run a quality check on TEN-graph-db"*
129
+ - *"Review business rules for the AI & MCP Integration domain"*
130
+ - *"Verify the glossary against the codebase"*
131
+
132
+ ## Tools (20+)
133
+
134
+ | Tool | What it does |
135
+ |------|-------------|
136
+ | `health` | Verify connectivity and get workspace stats |
137
+ | `kb-search` | Full-text search across all knowledge entries |
138
+ | `list-collections` | Browse all collection schemas |
139
+ | `list-entries` | Browse entries with optional filters |
140
+ | `get-entry` | Full record with data, labels, relations, history |
141
+ | `smart-capture` | One-call entry creation with auto-linking and quality scoring |
142
+ | `create-entry` | Create with full field control |
143
+ | `update-entry` | Partial update (merges with existing data) |
144
+ | `gather-context` | Multi-hop graph traversal around an entry |
145
+ | `suggest-links` | Discover potential connections |
146
+ | `relate-entries` | Create typed relations between entries |
147
+ | `find-related` | List direct relations for an entry |
148
+ | `quality-check` | Score an entry against collection-specific criteria |
149
+ | `review-rules` | Surface business rules for a domain |
150
+ | `verify` | Check knowledge entries against the actual codebase |
151
+ | `list-labels` | Browse workspace labels |
152
+ | `manage-labels` | Create, update, or delete labels |
153
+ | `label-entry` | Apply or remove labels from entries |
154
+ | `quick-capture` | Minimal-ceremony entry creation |
155
+ | `mcp-audit` | Session audit log with call statistics |
156
+
157
+ ## Resources
158
+
159
+ | URI | Content |
160
+ |-----|---------|
161
+ | `productbrain://orientation` | System map: architecture, data model, rules, analytics |
162
+ | `productbrain://terminology` | Glossary + standards summary |
163
+ | `productbrain://collections` | All collection schemas with field definitions |
164
+ | `productbrain://{slug}/entries` | All entries in a given collection |
165
+ | `productbrain://labels` | Workspace labels with hierarchy |
166
+
167
+ ## Prompts
168
+
169
+ | Prompt | Purpose |
170
+ |--------|---------|
171
+ | `review-against-rules` | Structured compliance review against business rules |
172
+ | `name-check` | Check variable/field names against the glossary |
173
+ | `draft-decision-record` | Draft a decision record from context |
174
+ | `draft-rule-from-context` | Draft a business rule from an observation |
175
+
176
+ ## Security
177
+
178
+ - **Your data stays yours.** The MCP server connects only to your authenticated Convex deployment. No data is shared with third parties.
179
+ - **API key handling.** Cloud keys (`pb_sk_...`) are SHA-256 hashed before storage. Only the prefix is persisted for display. Keys are sent as Bearer tokens over HTTPS.
180
+ - **Workspace scoping.** Each API key is bound to a single workspace. No cross-workspace access is possible.
181
+ - **Analytics are opt-in.** Set `POSTHOG_MCP_KEY` to enable usage analytics. Omit it entirely to disable all tracking.
182
+
183
+ ## Troubleshooting
184
+
185
+ ### "Missing API key" or "Invalid API key"
186
+
187
+ Your `PRODUCTBRAIN_API_KEY` is missing or incorrect. Generate a new key from SynergyOS Settings → API Keys.
188
+
189
+ ### "CONVEX_SITE_URL environment variable is required"
190
+
191
+ You're using self-hosted mode but missing the `env` block. Make sure all three variables are set.
192
+
193
+ ### "Workspace not found"
194
+
195
+ For self-hosted: check your `WORKSPACE_SLUG`. For cloud: your API key may have been revoked.
196
+
197
+ ### "MCP call network error"
198
+
199
+ The backend is unreachable. If using `PRODUCTBRAIN_URL`, verify the URL is correct and the server is running.
200
+
201
+ ### Server doesn't appear in Claude Desktop / Cursor
202
+
203
+ Restart the application after editing the config file. In Cursor, check the MCP panel (Cmd+Shift+P → "MCP: Show Panel") for startup errors.
204
+
205
+ ### Enable debug logging
206
+
207
+ Set `MCP_DEBUG=1` in your config's `env` block to see audit logs in stderr.
208
+
209
+ ## Development
210
+
211
+ ```bash
212
+ # Clone and install
213
+ git clone https://github.com/synergyai-os/productbrain.git
214
+ cd productbrain
215
+ npm install
216
+
217
+ # Copy env template and fill in your values
218
+ cp .env.mcp.example .env.mcp
219
+
220
+ # Run in dev mode (TypeScript, hot reload)
221
+ npm run dev
222
+
223
+ # Build for production
224
+ npm run build
225
+
226
+ # Run the built version
227
+ npm start
228
+
229
+ # Typecheck
230
+ npm run typecheck
231
+
232
+ # Publish beta
233
+ npm run publish:beta
234
+ ```
235
+
236
+ ## License
237
+
238
+ MIT
@@ -0,0 +1,11 @@
1
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
2
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
3
+ }) : x)(function(x) {
4
+ if (typeof require !== "undefined") return require.apply(this, arguments);
5
+ throw Error('Dynamic require of "' + x + '" is not supported');
6
+ });
7
+
8
+ export {
9
+ __require
10
+ };
11
+ //# sourceMappingURL=chunk-DGUM43GV.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/cli/index.ts
4
+ var subcommand = process.argv[2];
5
+ if (subcommand === "setup") {
6
+ const { runSetup } = await import("../setup-K757L5KR.js");
7
+ await runSetup();
8
+ } else {
9
+ await import("../index.js");
10
+ }
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/cli/index.ts"],"sourcesContent":["#!/usr/bin/env node\n\n/**\n * ProductBrain CLI entry point.\n *\n * Usage:\n * npx productbrain → starts the MCP server (default)\n * npx productbrain setup → guided onboarding flow\n */\n\nexport {};\n\nconst subcommand = process.argv[2];\n\nif (subcommand === \"setup\") {\n const { runSetup } = await import(\"./setup.js\");\n await runSetup();\n} else {\n // Default: start the MCP server\n await import(\"../index.js\");\n}\n"],"mappings":";;;AAYA,IAAM,aAAa,QAAQ,KAAK,CAAC;AAEjC,IAAI,eAAe,SAAS;AAC1B,QAAM,EAAE,SAAS,IAAI,MAAM,OAAO,sBAAY;AAC9C,QAAM,SAAS;AACjB,OAAO;AAEL,QAAM,OAAO,aAAa;AAC5B;","names":[]}