@equationalapplications/mcp-server 0.0.0-stage → 7.16.0
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/LICENSE +21 -0
- package/README.md +159 -2
- package/contract/synapsetree-openapi.subset.json +3842 -0
- package/dist/cli.js +4771 -0
- package/dist/cli.js.map +1 -0
- package/dist/cli.mjs +4769 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/index.d.mts +113 -0
- package/dist/index.d.ts +113 -0
- package/dist/index.js +4406 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +4391 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +65 -3
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
type OperationId = 'queryMemory' | 'rememberFact' | 'supersedeFact' | 'ingestDocument' | 'createEvent' | 'traverseGraph' | 'listNamespaces' | 'whoami' | 'registerAgentIdentity' | 'oauthToken' | 'oauthRevoke';
|
|
5
|
+
declare const OPERATION_IDS: readonly OperationId[];
|
|
6
|
+
/** memory:admin operations withheld from agents (SynapseTree ruling D3). Never called, never vendored. */
|
|
7
|
+
declare const WITHHELD_OPERATION_IDS: readonly string[];
|
|
8
|
+
interface Operation {
|
|
9
|
+
operationId: OperationId;
|
|
10
|
+
method: 'GET' | 'POST';
|
|
11
|
+
path: string;
|
|
12
|
+
scope: 'read' | 'read_write' | null;
|
|
13
|
+
/** Top-level request-body property names (union across oneOf/anyOf/allOf branches). */
|
|
14
|
+
requestProperties: string[];
|
|
15
|
+
/** Properties required in every branch. */
|
|
16
|
+
requiredProperties: string[];
|
|
17
|
+
queryParameters: string[];
|
|
18
|
+
pathParameters: string[];
|
|
19
|
+
acceptsIdempotencyKey: boolean;
|
|
20
|
+
}
|
|
21
|
+
declare const OPERATIONS: Readonly<Record<OperationId, Operation>>;
|
|
22
|
+
declare const CONTRACT_INFO: {
|
|
23
|
+
version: string;
|
|
24
|
+
operations: string[];
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
declare const DEFAULT_BASE_URL = "https://api.synapsetree.dev";
|
|
28
|
+
interface ClientOptions {
|
|
29
|
+
/** Optional only so `auth --email` can register and poll; every other operation needs it. */
|
|
30
|
+
apiKey?: string;
|
|
31
|
+
baseUrl: string;
|
|
32
|
+
userAgent: string;
|
|
33
|
+
fetch?: typeof fetch;
|
|
34
|
+
sleep?: (ms: number) => Promise<void>;
|
|
35
|
+
random?: () => number;
|
|
36
|
+
}
|
|
37
|
+
interface CallInput {
|
|
38
|
+
path?: Record<string, string>;
|
|
39
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
40
|
+
body?: Record<string, unknown>;
|
|
41
|
+
form?: Record<string, string | undefined>;
|
|
42
|
+
timeoutMs?: number;
|
|
43
|
+
}
|
|
44
|
+
interface CallResult<T> {
|
|
45
|
+
status: number;
|
|
46
|
+
data: T;
|
|
47
|
+
requestId?: string;
|
|
48
|
+
rateLimit?: string;
|
|
49
|
+
rateLimitPolicy?: string;
|
|
50
|
+
idempotentReplayed: boolean;
|
|
51
|
+
}
|
|
52
|
+
declare class SynapseTreeClient {
|
|
53
|
+
readonly baseUrl: string;
|
|
54
|
+
private readonly apiKey?;
|
|
55
|
+
private readonly userAgent;
|
|
56
|
+
private readonly fetchImpl;
|
|
57
|
+
private readonly sleep;
|
|
58
|
+
private readonly random;
|
|
59
|
+
constructor(opts: ClientOptions);
|
|
60
|
+
get hasKey(): boolean;
|
|
61
|
+
call<T = unknown>(opId: OperationId, input?: CallInput): Promise<CallResult<T>>;
|
|
62
|
+
private send;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
interface SynapseTreeErrorInit {
|
|
66
|
+
status: number;
|
|
67
|
+
code: string;
|
|
68
|
+
detail?: string;
|
|
69
|
+
requestId?: string;
|
|
70
|
+
retryAfterSeconds?: number;
|
|
71
|
+
}
|
|
72
|
+
/** A SynapseTree API error (problem+json, an OAuth error body, or a gateway rejection). */
|
|
73
|
+
declare class SynapseTreeError extends Error {
|
|
74
|
+
readonly status: number;
|
|
75
|
+
readonly code: string;
|
|
76
|
+
readonly detail?: string;
|
|
77
|
+
readonly requestId?: string;
|
|
78
|
+
readonly retryAfterSeconds?: number;
|
|
79
|
+
constructor(init: SynapseTreeErrorInit);
|
|
80
|
+
}
|
|
81
|
+
/** A local mistake: missing configuration or bad input. Never an HTTP failure. */
|
|
82
|
+
declare class UsageError extends Error {
|
|
83
|
+
constructor(message: string);
|
|
84
|
+
}
|
|
85
|
+
/** One paragraph a model can act on. Never throws. */
|
|
86
|
+
declare function toolErrorText(err: unknown): string;
|
|
87
|
+
|
|
88
|
+
interface ToolContext {
|
|
89
|
+
client: SynapseTreeClient;
|
|
90
|
+
defaultNamespace?: string;
|
|
91
|
+
}
|
|
92
|
+
interface ToolDefinition<S extends z.ZodObject<z.ZodRawShape> = z.ZodObject<z.ZodRawShape>> {
|
|
93
|
+
name: string;
|
|
94
|
+
/** The text the model reads. Spec §8 wording is verbatim. */
|
|
95
|
+
description: string;
|
|
96
|
+
operation: OperationId;
|
|
97
|
+
inputSchema: S;
|
|
98
|
+
handler: (input: z.output<S>, ctx: ToolContext) => Promise<unknown>;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
declare const SERVER_NAME = "synapsetree";
|
|
102
|
+
/** Registers exactly the eight tools (spec §8). No resources, prompts, or sampling. */
|
|
103
|
+
declare function createServer(ctx: ToolContext): McpServer;
|
|
104
|
+
|
|
105
|
+
/** The only place tools are enumerated. Order is the spec §8 table. Adding an entry is a spec amendment (R4). */
|
|
106
|
+
declare const TOOLS: readonly ToolDefinition[];
|
|
107
|
+
declare const TOOL_NAMES: readonly string[];
|
|
108
|
+
|
|
109
|
+
/** Injected by tsup `define` at build time; `0.0.0-dev` under vitest and tsc. */
|
|
110
|
+
declare const VERSION: string;
|
|
111
|
+
|
|
112
|
+
export { CONTRACT_INFO, DEFAULT_BASE_URL, OPERATIONS, OPERATION_IDS, SERVER_NAME, SynapseTreeClient, SynapseTreeError, TOOLS, TOOL_NAMES, UsageError, VERSION, WITHHELD_OPERATION_IDS, createServer, toolErrorText };
|
|
113
|
+
export type { CallInput, CallResult, ClientOptions, Operation, OperationId, ToolContext, ToolDefinition };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
type OperationId = 'queryMemory' | 'rememberFact' | 'supersedeFact' | 'ingestDocument' | 'createEvent' | 'traverseGraph' | 'listNamespaces' | 'whoami' | 'registerAgentIdentity' | 'oauthToken' | 'oauthRevoke';
|
|
5
|
+
declare const OPERATION_IDS: readonly OperationId[];
|
|
6
|
+
/** memory:admin operations withheld from agents (SynapseTree ruling D3). Never called, never vendored. */
|
|
7
|
+
declare const WITHHELD_OPERATION_IDS: readonly string[];
|
|
8
|
+
interface Operation {
|
|
9
|
+
operationId: OperationId;
|
|
10
|
+
method: 'GET' | 'POST';
|
|
11
|
+
path: string;
|
|
12
|
+
scope: 'read' | 'read_write' | null;
|
|
13
|
+
/** Top-level request-body property names (union across oneOf/anyOf/allOf branches). */
|
|
14
|
+
requestProperties: string[];
|
|
15
|
+
/** Properties required in every branch. */
|
|
16
|
+
requiredProperties: string[];
|
|
17
|
+
queryParameters: string[];
|
|
18
|
+
pathParameters: string[];
|
|
19
|
+
acceptsIdempotencyKey: boolean;
|
|
20
|
+
}
|
|
21
|
+
declare const OPERATIONS: Readonly<Record<OperationId, Operation>>;
|
|
22
|
+
declare const CONTRACT_INFO: {
|
|
23
|
+
version: string;
|
|
24
|
+
operations: string[];
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
declare const DEFAULT_BASE_URL = "https://api.synapsetree.dev";
|
|
28
|
+
interface ClientOptions {
|
|
29
|
+
/** Optional only so `auth --email` can register and poll; every other operation needs it. */
|
|
30
|
+
apiKey?: string;
|
|
31
|
+
baseUrl: string;
|
|
32
|
+
userAgent: string;
|
|
33
|
+
fetch?: typeof fetch;
|
|
34
|
+
sleep?: (ms: number) => Promise<void>;
|
|
35
|
+
random?: () => number;
|
|
36
|
+
}
|
|
37
|
+
interface CallInput {
|
|
38
|
+
path?: Record<string, string>;
|
|
39
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
40
|
+
body?: Record<string, unknown>;
|
|
41
|
+
form?: Record<string, string | undefined>;
|
|
42
|
+
timeoutMs?: number;
|
|
43
|
+
}
|
|
44
|
+
interface CallResult<T> {
|
|
45
|
+
status: number;
|
|
46
|
+
data: T;
|
|
47
|
+
requestId?: string;
|
|
48
|
+
rateLimit?: string;
|
|
49
|
+
rateLimitPolicy?: string;
|
|
50
|
+
idempotentReplayed: boolean;
|
|
51
|
+
}
|
|
52
|
+
declare class SynapseTreeClient {
|
|
53
|
+
readonly baseUrl: string;
|
|
54
|
+
private readonly apiKey?;
|
|
55
|
+
private readonly userAgent;
|
|
56
|
+
private readonly fetchImpl;
|
|
57
|
+
private readonly sleep;
|
|
58
|
+
private readonly random;
|
|
59
|
+
constructor(opts: ClientOptions);
|
|
60
|
+
get hasKey(): boolean;
|
|
61
|
+
call<T = unknown>(opId: OperationId, input?: CallInput): Promise<CallResult<T>>;
|
|
62
|
+
private send;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
interface SynapseTreeErrorInit {
|
|
66
|
+
status: number;
|
|
67
|
+
code: string;
|
|
68
|
+
detail?: string;
|
|
69
|
+
requestId?: string;
|
|
70
|
+
retryAfterSeconds?: number;
|
|
71
|
+
}
|
|
72
|
+
/** A SynapseTree API error (problem+json, an OAuth error body, or a gateway rejection). */
|
|
73
|
+
declare class SynapseTreeError extends Error {
|
|
74
|
+
readonly status: number;
|
|
75
|
+
readonly code: string;
|
|
76
|
+
readonly detail?: string;
|
|
77
|
+
readonly requestId?: string;
|
|
78
|
+
readonly retryAfterSeconds?: number;
|
|
79
|
+
constructor(init: SynapseTreeErrorInit);
|
|
80
|
+
}
|
|
81
|
+
/** A local mistake: missing configuration or bad input. Never an HTTP failure. */
|
|
82
|
+
declare class UsageError extends Error {
|
|
83
|
+
constructor(message: string);
|
|
84
|
+
}
|
|
85
|
+
/** One paragraph a model can act on. Never throws. */
|
|
86
|
+
declare function toolErrorText(err: unknown): string;
|
|
87
|
+
|
|
88
|
+
interface ToolContext {
|
|
89
|
+
client: SynapseTreeClient;
|
|
90
|
+
defaultNamespace?: string;
|
|
91
|
+
}
|
|
92
|
+
interface ToolDefinition<S extends z.ZodObject<z.ZodRawShape> = z.ZodObject<z.ZodRawShape>> {
|
|
93
|
+
name: string;
|
|
94
|
+
/** The text the model reads. Spec §8 wording is verbatim. */
|
|
95
|
+
description: string;
|
|
96
|
+
operation: OperationId;
|
|
97
|
+
inputSchema: S;
|
|
98
|
+
handler: (input: z.output<S>, ctx: ToolContext) => Promise<unknown>;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
declare const SERVER_NAME = "synapsetree";
|
|
102
|
+
/** Registers exactly the eight tools (spec §8). No resources, prompts, or sampling. */
|
|
103
|
+
declare function createServer(ctx: ToolContext): McpServer;
|
|
104
|
+
|
|
105
|
+
/** The only place tools are enumerated. Order is the spec §8 table. Adding an entry is a spec amendment (R4). */
|
|
106
|
+
declare const TOOLS: readonly ToolDefinition[];
|
|
107
|
+
declare const TOOL_NAMES: readonly string[];
|
|
108
|
+
|
|
109
|
+
/** Injected by tsup `define` at build time; `0.0.0-dev` under vitest and tsc. */
|
|
110
|
+
declare const VERSION: string;
|
|
111
|
+
|
|
112
|
+
export { CONTRACT_INFO, DEFAULT_BASE_URL, OPERATIONS, OPERATION_IDS, SERVER_NAME, SynapseTreeClient, SynapseTreeError, TOOLS, TOOL_NAMES, UsageError, VERSION, WITHHELD_OPERATION_IDS, createServer, toolErrorText };
|
|
113
|
+
export type { CallInput, CallResult, ClientOptions, Operation, OperationId, ToolContext, ToolDefinition };
|