@theronap/cortex-mcp 0.9.50 → 0.9.51

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 (2) hide show
  1. package/lib/server.mjs +35 -0
  2. package/package.json +9 -3
package/lib/server.mjs CHANGED
@@ -674,6 +674,41 @@ export async function runServer(version) {
674
674
  },
675
675
  )
676
676
 
677
+ server.registerTool(
678
+ 'list_brain_pages',
679
+ {
680
+ title: 'List every authored page in one brain',
681
+ description: 'Enumerate ALL authored pages in ONE brain, by its org id (from my_brains). Unlike my_brains — which ships only a count plus a few sample titles — this returns the FULL page list: one row per node with its kind, validity, tier(s), last-updated date and content hash. Use it to audit a brain, or to VERIFY a brain-to-brain migration — list BOTH brains, diff the page sets, and compare freshness before retiring any original. You can only list a brain you are a member of; reads never widen past your own brains.',
682
+ inputSchema: {
683
+ org_id: z.string().describe('the org id of the brain to enumerate (from my_brains)'),
684
+ },
685
+ },
686
+ async ({ org_id }) => {
687
+ let res
688
+ try {
689
+ res = await fetchCortex(`${BASE}/api/brains/pages?orgId=${encodeURIComponent(org_id)}`, { headers: { Authorization: `Bearer ${TOKEN}` } })
690
+ } catch (e) {
691
+ return { content: [{ type: 'text', text: `Could not list pages: ${e.message}` }] }
692
+ }
693
+ if (!res.ok) {
694
+ const d = classify(res.status, res.headers.get('content-type'), await res.text(), res.headers.get('x-vercel-id'))
695
+ return { content: [{ type: 'text', text: `Could not list pages: ${d.message}` }] }
696
+ }
697
+ const { nodeCount, rowCount, pages } = await res.json()
698
+ if (!pages?.length) return { content: [{ type: 'text', text: `Brain ${org_id} has no authored pages.` }] }
699
+ // One terse line per node: name ·kind· date [NON-CURRENT validity] {non-default tiers}. A migration
700
+ // diff needs the name, the freshness date, and whether a page is already retired or multi-tier.
701
+ const lines = pages.map((p) => {
702
+ const flag = p.validity && p.validity !== 'current' ? ` [${String(p.validity).toUpperCase()}]` : ''
703
+ const tiers = p.tiers?.length && !(p.tiers.length === 1 && p.tiers[0] === 'accessible') ? ` {${p.tiers.join('+')}}` : ''
704
+ const day = p.updatedAt ? String(p.updatedAt).slice(0, 10) : '????-??-??'
705
+ return `${p.name ?? '(unnamed)'} ·${p.kind}· ${day}${flag}${tiers}`
706
+ })
707
+ const header = `${nodeCount} page${nodeCount === 1 ? '' : 's'} in brain ${org_id} (${rowCount} digest rows across tiers):`
708
+ return { content: [{ type: 'text', text: `${header}\n${lines.join('\n')}` }] }
709
+ },
710
+ )
711
+
677
712
  server.registerTool(
678
713
  'set_active_brain',
679
714
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theronap/cortex-mcp",
3
- "version": "0.9.50",
3
+ "version": "0.9.51",
4
4
  "description": "Connect your AI assistant to Cortex — your org's projects, activity, gaps, and directives, scoped to you.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -10,7 +10,8 @@
10
10
  "bin",
11
11
  "lib",
12
12
  "skills",
13
- "!lib/**/*.test.mjs"
13
+ "!lib/**/*.test.mjs",
14
+ "!scripts"
14
15
  ],
15
16
  "engines": {
16
17
  "node": ">=18"
@@ -26,5 +27,10 @@
26
27
  "ai",
27
28
  "org-intelligence"
28
29
  ],
29
- "license": "MIT"
30
+ "license": "MIT",
31
+ "scripts": {
32
+ "release": "node scripts/release.mjs release",
33
+ "promote": "node scripts/release.mjs promote",
34
+ "rollback": "node scripts/release.mjs rollback"
35
+ }
30
36
  }