@theronap/cortex-mcp 0.9.21 → 0.9.22

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 +21 -2
  2. package/package.json +1 -1
package/lib/server.mjs CHANGED
@@ -213,13 +213,32 @@ export async function runServer(version) {
213
213
  'project_status',
214
214
  {
215
215
  title: 'Project status',
216
- description: 'Status of a specific project by key (e.g. checkout-v2). Returns only what you can see.',
216
+ description: 'Status of a specific project by key (e.g. checkout-v2). Returns the AUTHORED wiki page (the synthesized understanding) when one exists, falling back to the records-derived line. Returns only what you can see.',
217
217
  inputSchema: { key: z.string().describe('project key, e.g. checkout-v2') },
218
218
  },
219
219
  async ({ key }) => {
220
+ // Prefer the AUTHORED page (synthesized understanding, sovereign over records). Freshest tier leads,
221
+ // each dated, so diverged tiers read as "newest first" instead of an undated stale/fresh blend.
222
+ try {
223
+ const res = await fetchCortex(`${BASE}/api/brain/page?kind=project&key=${encodeURIComponent(key)}`,
224
+ { headers: { Authorization: `Bearer ${TOKEN}` } })
225
+ if (res.ok) {
226
+ const page = await res.json()
227
+ if (page?.authored && Array.isArray(page.tiers) && page.tiers.length) {
228
+ const day = (d) => (d ? String(d).slice(0, 10) : '')
229
+ const blocks = page.tiers.map((t) => {
230
+ const secs = (t.sections ?? []).map((s) => `### ${s.heading}\n${s.body}`).join('\n\n')
231
+ const head = `[${t.tier}${day(t.updated_at) ? ` · authored ${day(t.updated_at)}` : ''}${t.validity && t.validity !== 'current' ? ` · ${t.validity}` : ''}]`
232
+ return [head, t.summary, secs].filter(Boolean).join('\n')
233
+ })
234
+ return { content: [{ type: 'text', text: `# ${page.title ?? key} (authored page)\n\n${blocks.join('\n\n---\n\n')}` }] }
235
+ }
236
+ }
237
+ } catch { /* fall through to the records-derived line */ }
238
+ // Fallback: no authored page yet — surface the records-derived line from the context snapshot.
220
239
  const text = await fetchContext()
221
240
  const line = text.split('\n').find((l) => l.includes(`**${key}**`) || l.includes(key))
222
- return { content: [{ type: 'text', text: line ? `Project ${key}:\n${line.trim()}` : `No visible project "${key}".` }] }
241
+ return { content: [{ type: 'text', text: line ? `Project ${key} (records-derived; not yet authored):\n${line.trim()}` : `No visible project "${key}".` }] }
223
242
  },
224
243
  )
225
244
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theronap/cortex-mcp",
3
- "version": "0.9.21",
3
+ "version": "0.9.22",
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": {