@andespindola/brainlink 0.1.0-beta.144 → 0.1.0-beta.145
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/dist/mcp/runtime.js +20 -0
- package/dist/mcp/server.js +8 -10
- package/dist/mcp/tools.js +14 -0
- package/package.json +1 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { dirname, join } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
let cachedRuntimeMetadata = null;
|
|
5
|
+
const readPackageMetadata = () => {
|
|
6
|
+
const packagePath = join(dirname(fileURLToPath(import.meta.url)), '../../package.json');
|
|
7
|
+
return JSON.parse(readFileSync(packagePath, 'utf8'));
|
|
8
|
+
};
|
|
9
|
+
export const getRuntimeMetadata = () => {
|
|
10
|
+
if (cachedRuntimeMetadata) {
|
|
11
|
+
return cachedRuntimeMetadata;
|
|
12
|
+
}
|
|
13
|
+
const metadata = readPackageMetadata();
|
|
14
|
+
cachedRuntimeMetadata = {
|
|
15
|
+
name: metadata.name ?? 'brainlink',
|
|
16
|
+
version: metadata.version ?? '0.0.0'
|
|
17
|
+
};
|
|
18
|
+
return cachedRuntimeMetadata;
|
|
19
|
+
};
|
|
20
|
+
export const getRuntimeVersion = () => getRuntimeMetadata().version;
|
package/dist/mcp/server.js
CHANGED
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { fileURLToPath } from 'node:url';
|
|
5
|
-
import { addNoteInputSchema, addFileInputSchema, addFileTool, addNoteTool, volatileAddInputSchema, volatileAddTool, volatileClearInputSchema, volatileClearTool, dedupeInputSchema, dedupeResolveInputSchema, dedupeResolveTool, dedupeTool, brokenLinksInputSchema, brokenLinksTool, bootstrapInputSchema, bootstrapTool, contextInputSchema, contextTool, graphInputSchema, graphTool, indexInputSchema, indexTool, orphansInputSchema, orphansTool, policyInputSchema, policyTool, recommendationsInputSchema, recommendationsTool, searchInputSchema, searchTool, statsInputSchema, statsTool, syncInputSchema, syncTool, validateInputSchema, validateTool } from './tools.js';
|
|
6
|
-
const readPackageVersion = () => {
|
|
7
|
-
const packagePath = join(dirname(fileURLToPath(import.meta.url)), '../../package.json');
|
|
8
|
-
const metadata = JSON.parse(readFileSync(packagePath, 'utf8'));
|
|
9
|
-
return metadata.version ?? '0.0.0';
|
|
10
|
-
};
|
|
2
|
+
import { addNoteInputSchema, addFileInputSchema, addFileTool, addNoteTool, volatileAddInputSchema, volatileAddTool, volatileClearInputSchema, volatileClearTool, dedupeInputSchema, dedupeResolveInputSchema, dedupeResolveTool, dedupeTool, brokenLinksInputSchema, brokenLinksTool, bootstrapInputSchema, bootstrapTool, contextInputSchema, contextTool, graphInputSchema, graphTool, indexInputSchema, indexTool, orphansInputSchema, orphansTool, policyInputSchema, policyTool, recommendationsInputSchema, recommendationsTool, searchInputSchema, searchTool, statsInputSchema, statsTool, syncInputSchema, syncTool, validateInputSchema, validateTool, versionInputSchema, versionTool } from './tools.js';
|
|
3
|
+
import { getRuntimeVersion } from './runtime.js';
|
|
11
4
|
export const createBrainlinkMcpServer = () => {
|
|
12
5
|
const server = new McpServer({
|
|
13
6
|
name: 'brainlink',
|
|
14
7
|
title: 'Brainlink',
|
|
15
|
-
version:
|
|
8
|
+
version: getRuntimeVersion(),
|
|
16
9
|
description: 'Local-first Markdown memory tools for AI agents.'
|
|
17
10
|
});
|
|
18
11
|
server.registerTool('brainlink_bootstrap', {
|
|
@@ -25,6 +18,11 @@ export const createBrainlinkMcpServer = () => {
|
|
|
25
18
|
description: 'Read or update bootstrap enforcement policy and inspect bootstrap readiness for the current vault/agent.',
|
|
26
19
|
inputSchema: policyInputSchema
|
|
27
20
|
}, policyTool);
|
|
21
|
+
server.registerTool('brainlink_version', {
|
|
22
|
+
title: 'Read Brainlink Runtime Version',
|
|
23
|
+
description: 'Return the current Brainlink MCP runtime package version and metadata.',
|
|
24
|
+
inputSchema: versionInputSchema
|
|
25
|
+
}, versionTool);
|
|
28
26
|
server.registerTool('brainlink_recommendations', {
|
|
29
27
|
title: 'Brainlink Recommended MCP Workflow',
|
|
30
28
|
description: 'Return a plug-and-play action plan for this vault/agent, including policy, bootstrap, context retrieval and durable write guidance.',
|
package/dist/mcp/tools.js
CHANGED
|
@@ -13,6 +13,7 @@ import { loadBrainlinkConfig } from '../infrastructure/config.js';
|
|
|
13
13
|
import { assertVaultAllowed } from '../infrastructure/file-system-vault.js';
|
|
14
14
|
import { addVolatileMemory, clearVolatileMemory } from '../infrastructure/volatile-memory.js';
|
|
15
15
|
import { getBootstrapPolicy, getBootstrapSessionStatus, getContextSessionStatus, setBootstrapPolicy, touchBootstrapSession, touchContextSession } from '../infrastructure/session-state.js';
|
|
16
|
+
import { getRuntimeMetadata } from './runtime.js';
|
|
16
17
|
const positiveInteger = (fallback) => z
|
|
17
18
|
.number()
|
|
18
19
|
.int()
|
|
@@ -319,6 +320,10 @@ export const policyInputSchema = {
|
|
|
319
320
|
.describe('Run automatic bootstrap during MCP server startup using configured default vault/agent.'),
|
|
320
321
|
staleAfterMinutes: positiveInteger(120).describe('Bootstrap freshness window in minutes before read tools require a new bootstrap.')
|
|
321
322
|
};
|
|
323
|
+
export const versionInputSchema = {
|
|
324
|
+
...vaultInput,
|
|
325
|
+
...agentInput
|
|
326
|
+
};
|
|
322
327
|
export const recommendationsInputSchema = {
|
|
323
328
|
...vaultInput,
|
|
324
329
|
...agentInput,
|
|
@@ -759,12 +764,21 @@ export const policyTool = async (input) => {
|
|
|
759
764
|
return jsonResult(withNextActions({
|
|
760
765
|
vault: context.vault,
|
|
761
766
|
agent: context.agent,
|
|
767
|
+
runtime: getRuntimeMetadata(),
|
|
762
768
|
policy,
|
|
763
769
|
bootstrapStatus,
|
|
764
770
|
contextStatus,
|
|
765
771
|
...(input.preset ? { presetApplied: input.preset } : {})
|
|
766
772
|
}, withContextAction));
|
|
767
773
|
};
|
|
774
|
+
export const versionTool = async (input) => {
|
|
775
|
+
const context = await resolveExecutionContext(input);
|
|
776
|
+
return jsonResult({
|
|
777
|
+
vault: context.vault,
|
|
778
|
+
agent: context.agent,
|
|
779
|
+
runtime: getRuntimeMetadata()
|
|
780
|
+
});
|
|
781
|
+
};
|
|
768
782
|
export const recommendationsTool = async (input) => {
|
|
769
783
|
const context = await resolveExecutionContext(input);
|
|
770
784
|
const policy = await getBootstrapPolicy();
|
package/package.json
CHANGED