+25
-4
@@ -10,8 +10,29 @@ /* server.ts — a minimal MCP server over a folder of markdown. | ||
| import { listFiles, readFile, search } from "./brain.js"; | ||
| const READ_ONLY_CLOSED_WORLD = { | ||
| readOnlyHint: true, | ||
| destructiveHint: false, | ||
| idempotentHint: true, | ||
| openWorldHint: false, | ||
| }; | ||
| export function createServer(root) { | ||
| const server = new McpServer({ name: "br8n", version: "0.1.0" }); | ||
| server.tool("brain_list", "List every markdown file in the brain (relative path, size, last modified).", {}, async () => ({ content: [{ type: "text", text: JSON.stringify(await listFiles(root), null, 2) }] })); | ||
| server.tool("brain_read", "Read one file from the brain by relative path (e.g. decisions/2026-03-change-orders.md).", { path: z.string().describe("relative path inside the brain") }, async ({ path }) => ({ content: [{ type: "text", text: await readFile(root, path) }] })); | ||
| server.tool("brain_search", "Literal, case-insensitive search across the brain. Returns file, line number and the matching line, so answers can cite the source.", { query: z.string().min(1), limit: z.number().int().min(1).max(200).optional() }, async ({ query, limit }) => ({ content: [{ type: "text", text: JSON.stringify(await search(root, query, limit ?? 50), null, 2) }] })); | ||
| const server = new McpServer({ name: "br8n", version: "0.1.2" }); | ||
| server.registerTool("brain_list", { | ||
| description: "List every markdown file in the brain (relative path, size, last modified).", | ||
| inputSchema: {}, | ||
| annotations: READ_ONLY_CLOSED_WORLD, | ||
| }, async () => ({ content: [{ type: "text", text: JSON.stringify(await listFiles(root), null, 2) }] })); | ||
| server.registerTool("brain_read", { | ||
| description: "Read one file from the brain by relative path (e.g. decisions/2026-03-change-orders.md).", | ||
| inputSchema: { path: z.string().describe("relative path inside the brain") }, | ||
| annotations: READ_ONLY_CLOSED_WORLD, | ||
| }, async ({ path }) => ({ content: [{ type: "text", text: await readFile(root, path) }] })); | ||
| server.registerTool("brain_search", { | ||
| description: "Literal, case-insensitive search across the brain. Returns file, line number and the matching line, so answers can cite the source.", | ||
| inputSchema: { | ||
| query: z.string().min(1), | ||
| limit: z.number().int().min(1).max(200).optional(), | ||
| }, | ||
| annotations: READ_ONLY_CLOSED_WORLD, | ||
| }, async ({ query, limit }) => ({ content: [{ type: "text", text: JSON.stringify(await search(root, query, limit ?? 50), null, 2) }] })); | ||
| return server; | ||
| } |
+3
-2
| { | ||
| "name": "@br8n/mcp", | ||
| "mcpName": "io.br8n/mcp", | ||
| "version": "0.1.1", | ||
| "version": "0.1.2", | ||
| "description": "br8n \u2014 owned, portable working memory. A plain-files brain template and a tiny MCP server that lets any model read it. Files, not a login.", | ||
@@ -20,4 +20,5 @@ "type": "module", | ||
| "start": "node dist/cli.js", | ||
| "pretest": "npm run build", | ||
| "test": "node --test test/*.test.mjs", | ||
| "prepublishOnly": "npm run build && npm test" | ||
| "prepublishOnly": "npm test" | ||
| }, | ||
@@ -24,0 +25,0 @@ "keywords": [ |
+17
-3
@@ -48,6 +48,20 @@ # br8n | ||
| Configure npm's trusted publisher once for `@br8n/mcp`: | ||
| - Publisher: GitHub Actions | ||
| - Organization: `Branded-Mayhem-Collective-LLC` | ||
| - Repository: `br8n` | ||
| - Workflow: `publish.yml` | ||
| - Allowed action: `npm publish` | ||
| Publish the version already committed to `main`, then update the official MCP Registry: | ||
| ```bash | ||
| npm login && npm publish --access public # 1. publishes @br8n/mcp (org: br8n); package.json carries mcpName | ||
| mcp-publisher login github # 2. GitHub device-flow auth (org member) | ||
| mcp-publisher publish # 3. lists io.github.Branded-Mayhem-Collective-LLC/br8n in the official MCP registry | ||
| gh workflow run publish.yml --ref main -f version=0.1.2 | ||
| gh run watch --exit-status | ||
| mcp-publisher login github | ||
| mcp-publisher publish | ||
| ``` | ||
| The GitHub-hosted workflow uses npm trusted publishing (OIDC), so it requires no long-lived npm token. Change the version argument for future releases. |
12907
6.12%100
25%67
26.42%