@theronap/agnoclast-mcp 0.9.276 → 0.9.278
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/lib/editors/claude.mjs +7 -8
- package/lib/editors/codex.mjs +5 -5
- package/lib/editors/cursor.mjs +4 -3
- package/lib/found_documents.mjs +14 -1
- package/lib/release_gate.mjs +1 -1
- package/lib/server.mjs +29 -2
- package/package.json +1 -1
package/lib/editors/claude.mjs
CHANGED
|
@@ -10,20 +10,19 @@ import { markCommand, isManagedSubcommand } from '../managed.mjs'
|
|
|
10
10
|
/** Merge the Agnoclast MCP server into a ~/.claude.json object. Pure + idempotent: sets only OUR
|
|
11
11
|
* entry (type:'stdio'), preserves every other server. `spec` = the package@dist-tag string.
|
|
12
12
|
*
|
|
13
|
-
* ⚠ WHICH KEY:
|
|
13
|
+
* ⚠ WHICH KEY: `agnoclast`, always. ADR-0033 C2 (`migrate-key`) moves `cortex` → `agnoclast`. This
|
|
14
14
|
* used to write `cortex` unconditionally, so a re-run of setup on a migrated machine RE-CREATED a
|
|
15
15
|
* `cortex` entry beside the `agnoclast` one: two Agnoclast servers, and the new one at whatever tag
|
|
16
16
|
* setup picked — which is how Theron's machine ended up with `agnoclast`@latest and `cortex`@stable
|
|
17
|
-
* (2026-10-23).
|
|
18
|
-
* `cortex`
|
|
19
|
-
*
|
|
17
|
+
* (2026-10-23). The 10-23 fix kept an existing duplicate as "the person's call"; Theron made that
|
|
18
|
+
* call (2026-10-28): the `cortex` server must not exist. So write `agnoclast` and DELETE `cortex`,
|
|
19
|
+
* on every machine. Safe on a fresh one too: mergeClaudeSettings adds the agnoclast allow rules
|
|
20
|
+
* (MANAGED_ALLOWED_TOOLS) in the same setup run. */
|
|
20
21
|
export function mergeClaudeMcp(existing, spec, token) {
|
|
21
22
|
const cfg = existing && typeof existing === 'object' ? { ...existing } : {}
|
|
22
23
|
cfg.mcpServers = cfg.mcpServers && typeof cfg.mcpServers === 'object' ? { ...cfg.mcpServers } : {}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
cfg.mcpServers[k] = { type: 'stdio', command: 'npx', args: ['-y', spec], env: { CORTEX_TOKEN: token } }
|
|
26
|
-
}
|
|
24
|
+
delete cfg.mcpServers.cortex
|
|
25
|
+
cfg.mcpServers.agnoclast = { type: 'stdio', command: 'npx', args: ['-y', spec], env: { CORTEX_TOKEN: token } }
|
|
27
26
|
return cfg
|
|
28
27
|
}
|
|
29
28
|
|
package/lib/editors/codex.mjs
CHANGED
|
@@ -7,11 +7,11 @@ import { join } from 'node:path'
|
|
|
7
7
|
import { readJson, backupFile, ensureDir, writeJson } from './_fsutil.mjs'
|
|
8
8
|
|
|
9
9
|
/** Merge the Agnoclast MCP server into a Codex config.toml. Pure + idempotent: strips any existing
|
|
10
|
-
* [mcp_servers.
|
|
10
|
+
* [mcp_servers.agnoclast] / [mcp_servers.cortex] tables (+ their .env) (so re-runs update in place rather than
|
|
11
11
|
* duplicating — a duplicate TOML table would break Codex's parser), preserves every other table,
|
|
12
|
-
* and appends a fresh block. Only touches
|
|
12
|
+
* and appends a fresh `agnoclast` block (the legacy `cortex` one is dropped, 2026-10-28). Only touches those tables; never rewrites the user's config. */
|
|
13
13
|
export function mergeCodexToml(text, spec, token) {
|
|
14
|
-
const targets = new Set(['[mcp_servers.cortex]', '[mcp_servers.cortex.env]'])
|
|
14
|
+
const targets = new Set(['[mcp_servers.agnoclast]', '[mcp_servers.agnoclast.env]', '[mcp_servers.cortex]', '[mcp_servers.cortex.env]'])
|
|
15
15
|
const kept = []
|
|
16
16
|
let skipping = false
|
|
17
17
|
for (const line of (text || '').split('\n')) {
|
|
@@ -22,12 +22,12 @@ export function mergeCodexToml(text, spec, token) {
|
|
|
22
22
|
while (kept.length && kept[kept.length - 1].trim() === '') kept.pop() // drop trailing blanks
|
|
23
23
|
const block = [
|
|
24
24
|
'',
|
|
25
|
-
'[mcp_servers.
|
|
25
|
+
'[mcp_servers.agnoclast]',
|
|
26
26
|
'command = "npx"',
|
|
27
27
|
`args = ["-y", "${spec}"]`,
|
|
28
28
|
'startup_timeout_sec = 60', // first npx fetch can be slow; don't time out the server on cold start
|
|
29
29
|
'',
|
|
30
|
-
'[mcp_servers.
|
|
30
|
+
'[mcp_servers.agnoclast.env]',
|
|
31
31
|
`CORTEX_TOKEN = "${token}"`,
|
|
32
32
|
'',
|
|
33
33
|
]
|
package/lib/editors/cursor.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Editor adapter: Cursor. P0-b task 4 (+ review fixes).
|
|
2
|
-
// ~/.cursor/mcp.json uses the same mcpServers.
|
|
2
|
+
// ~/.cursor/mcp.json uses the same mcpServers.agnoclast shape as Claude (minus the `type` field the real
|
|
3
3
|
// Cursor config omits), so wiring Cursor is a pure JSON merge (mergeCursorMcp).
|
|
4
4
|
import { homedir } from 'node:os'
|
|
5
5
|
import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'node:fs'
|
|
@@ -7,12 +7,13 @@ import { join } from 'node:path'
|
|
|
7
7
|
import { backupFile } from './_fsutil.mjs'
|
|
8
8
|
|
|
9
9
|
/** Merge the Agnoclast MCP server into a Cursor mcp.json object. Pure + idempotent: sets only the
|
|
10
|
-
* `cortex`
|
|
10
|
+
* `agnoclast` entry (deleting a legacy `cortex` one), preserves every other server. `spec` is the package@dist-tag STRING — the same
|
|
11
11
|
* convention claude/codex/setup.mjs use, so one install driver can pass a single spec to every adapter. */
|
|
12
12
|
export function mergeCursorMcp(existing, spec, token) {
|
|
13
13
|
const cfg = existing && typeof existing === 'object' ? { ...existing } : {}
|
|
14
14
|
cfg.mcpServers = cfg.mcpServers && typeof cfg.mcpServers === 'object' ? { ...cfg.mcpServers } : {}
|
|
15
|
-
cfg.mcpServers.cortex
|
|
15
|
+
delete cfg.mcpServers.cortex
|
|
16
|
+
cfg.mcpServers.agnoclast = { command: 'npx', args: ['-y', spec], env: { CORTEX_TOKEN: token } }
|
|
16
17
|
return cfg
|
|
17
18
|
}
|
|
18
19
|
|
package/lib/found_documents.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// find_documents' answer (file browser, Theron 2026-10-27): every stored file the caller can see, one block
|
|
2
|
-
// per file — its page
|
|
2
|
+
// per file — its page and brain, the folder people filed it in, and why it matched a search.
|
|
3
3
|
|
|
4
4
|
const TYPE_NAMES = { sheet: 'spreadsheet', doc: 'Word', text: 'text', other: 'other' }
|
|
5
5
|
|
|
@@ -10,8 +10,21 @@ export function formatFoundDocuments(out, query) {
|
|
|
10
10
|
for (const f of files) {
|
|
11
11
|
lines.push(`${f.pinned ? '📌' : '-'} "${f.title}" — id ${f.id} · ${TYPE_NAMES[f.type] ?? f.type} · v${f.version} · ${Math.round(f.sizeBytes / 1024)} KB · ${String(f.updatedAt).slice(0, 10)}${f.updatedBy ? ` by ${f.updatedBy}` : ''}${f.readable === 'ok' ? '' : ' · not readable as text'}`)
|
|
12
12
|
lines.push(` on ${f.page ? `"${f.page.title ?? 'untitled page'}"` : 'no page (its page was deleted)'} · ${f.brain.name}`)
|
|
13
|
+
const inFolder = folderPathText(out.folders ?? [], f.folderId)
|
|
14
|
+
if (inFolder) lines.push(` in folder "${inFolder}" (folder id ${f.folderId})`)
|
|
13
15
|
if (f.match?.in === 'text' && f.match.snippet) lines.push(` matched inside: "${f.match.snippet}"`)
|
|
14
16
|
else if (f.match?.in === 'page') lines.push(' matched its page\'s title')
|
|
15
17
|
}
|
|
16
18
|
return lines.join('\n')
|
|
17
19
|
}
|
|
20
|
+
|
|
21
|
+
// "Finance › Taxes", walking up from a folder; null when the file is not in a folder the caller can see.
|
|
22
|
+
function folderPathText(folders, id) {
|
|
23
|
+
const names = []
|
|
24
|
+
const seen = new Set()
|
|
25
|
+
for (let at = folders.find((x) => x.id === id); at && !seen.has(at.id); at = folders.find((x) => x.id === at.parentId)) {
|
|
26
|
+
seen.add(at.id)
|
|
27
|
+
names.unshift(at.name)
|
|
28
|
+
}
|
|
29
|
+
return names.length ? names.join(' › ') : null
|
|
30
|
+
}
|
package/lib/release_gate.mjs
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
// that web/lib/engine/release.test.ts pins to the server's registry.
|
|
6
6
|
|
|
7
7
|
/** Tools any release flag gates — hidden when the server cannot be asked. Mirror of allGatedTools(). */
|
|
8
|
-
export const GATED_FALLBACK = ['attach_document', 'document_diff', 'export_page', 'find_documents', 'get_document', 'import_document_as_page', 'intake_shadow', 'list_documents', 'my_messages', 'pin_document', 'read_conversation', 'read_document', 'send_message', 'set_manager', 'upload_document_version']
|
|
8
|
+
export const GATED_FALLBACK = ['arrivals', 'attach_document', 'document_diff', 'export_page', 'file_arrival', 'file_document', 'find_documents', 'get_document', 'import_document_as_page', 'intake_shadow', 'list_documents', 'my_messages', 'pin_document', 'read_conversation', 'read_document', 'send_message', 'set_manager', 'upload_document_version']
|
|
9
9
|
|
|
10
10
|
export const RELEASE_FETCH_TIMEOUT_MS = 2500
|
|
11
11
|
|
package/lib/server.mjs
CHANGED
|
@@ -7506,23 +7506,25 @@ function renderNudge(payload) {
|
|
|
7506
7506
|
'find_documents',
|
|
7507
7507
|
{
|
|
7508
7508
|
title: 'Find stored files you can see',
|
|
7509
|
-
description: 'Search every file kept in Agnoclast that you can see, across all pages and brains — no page needed. Matches the file name, the page it lives on, or the words inside it (a match inside the file shows the words around it). Newest first; filter by type, brain, page, pinned, or changed since. Each file names its page
|
|
7509
|
+
description: 'Search every file kept in Agnoclast that you can see, across all pages and brains — no page needed. Matches the file name, the page it lives on, or the words inside it (a match inside the file shows the words around it). Newest first; filter by type, brain, page, folder, pinned, or changed since. Each file names its page and brain, and the folder people filed it in, if any (file_document files one). Then read_document to read one, document_diff to see what changed, get_document to download it. list_documents is the one-page view.',
|
|
7510
7510
|
inputSchema: {
|
|
7511
7511
|
query: z.string().optional().describe('words to find in the file name, its page\'s title, or the text inside the file'),
|
|
7512
7512
|
type: z.enum(['sheet', 'doc', 'text', 'other']).optional().describe('sheet = Excel/spreadsheet, doc = Word, text = CSV/plain text'),
|
|
7513
7513
|
brain: z.string().optional().describe('only this brain (its name or id)'),
|
|
7514
7514
|
page: z.string().optional().describe('only files on this page (a document id)'),
|
|
7515
|
+
folder: z.string().optional().describe('only files in this folder or the folders inside it (a folder id, printed as "folder id …")'),
|
|
7515
7516
|
pinned: z.boolean().optional().describe('true = pinned files only'),
|
|
7516
7517
|
changed_since: z.string().optional().describe('ISO date: only files with a version at or after it'),
|
|
7517
7518
|
limit: z.number().int().min(1).max(500).optional().describe('default 50'),
|
|
7518
7519
|
},
|
|
7519
7520
|
},
|
|
7520
|
-
async ({ query, type, brain, page, pinned, changed_since, limit }) => {
|
|
7521
|
+
async ({ query, type, brain, page, folder, pinned, changed_since, limit }) => {
|
|
7521
7522
|
const q = new URLSearchParams({ limit: String(limit ?? 50) })
|
|
7522
7523
|
if (query) q.set('q', query)
|
|
7523
7524
|
if (type) q.set('type', type)
|
|
7524
7525
|
if (brain) q.set('brain', brain)
|
|
7525
7526
|
if (page) q.set('page', page)
|
|
7527
|
+
if (folder) q.set('folder', folder)
|
|
7526
7528
|
if (pinned !== undefined) q.set('pinned', String(pinned))
|
|
7527
7529
|
if (changed_since) q.set('since', changed_since)
|
|
7528
7530
|
let res
|
|
@@ -7533,6 +7535,31 @@ function renderNudge(payload) {
|
|
|
7533
7535
|
},
|
|
7534
7536
|
)
|
|
7535
7537
|
|
|
7538
|
+
server.registerTool(
|
|
7539
|
+
'file_document',
|
|
7540
|
+
{
|
|
7541
|
+
title: 'Put a stored file in a folder',
|
|
7542
|
+
description: 'File a stored file in one of its brain\'s folders (the folders people make on the Files tab, shared by everyone in the brain), or take it out of its folder. A folder is only a label: it never changes who can open the file — the file\'s page still decides. A file is in at most one folder. Get file_id from find_documents or list_documents; name the folder or pass the "folder id …" find_documents prints.',
|
|
7543
|
+
inputSchema: {
|
|
7544
|
+
file_id: z.string().describe('the stored file\'s id'),
|
|
7545
|
+
folder: z.string().nullable().describe('the folder\'s name (in the file\'s brain) or its id; null to take the file out of its folder'),
|
|
7546
|
+
},
|
|
7547
|
+
},
|
|
7548
|
+
async ({ file_id, folder }) => {
|
|
7549
|
+
let res
|
|
7550
|
+
try {
|
|
7551
|
+
res = await fetchCortex(`${BASE}/api/stored-files/${encodeURIComponent(file_id)}/folder`, {
|
|
7552
|
+
method: 'POST', headers: { Authorization: `Bearer ${TOKEN}`, 'Content-Type': 'application/json' },
|
|
7553
|
+
body: JSON.stringify({ folderId: folder ?? null }),
|
|
7554
|
+
})
|
|
7555
|
+
} catch (e) { return toolError(`Could not file it: ${e.message}`) }
|
|
7556
|
+
if (!res.ok) return docFail('file it', res)
|
|
7557
|
+
const out = await res.json()
|
|
7558
|
+
if (!out.changed) return { content: [{ type: 'text', text: folder ? `It was already in that folder.` : 'It was not in a folder.' }] }
|
|
7559
|
+
return { content: [{ type: 'text', text: folder ? `Filed it in "${folder}" (folder id ${out.folderId}).` : 'Took it out of its folder.' }] }
|
|
7560
|
+
},
|
|
7561
|
+
)
|
|
7562
|
+
|
|
7536
7563
|
server.registerTool(
|
|
7537
7564
|
'read_document',
|
|
7538
7565
|
{
|
package/package.json
CHANGED