@bendyline/gezel-mcp 0.1.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.
@@ -0,0 +1,21 @@
1
+ interface BuiltinToolContract {
2
+ name: string;
3
+ description: string;
4
+ inputSchema: Record<string, unknown>;
5
+ outputSchema?: Record<string, unknown>;
6
+ annotations?: {
7
+ readOnlyHint?: boolean;
8
+ destructiveHint?: boolean;
9
+ idempotentHint?: boolean;
10
+ openWorldHint?: boolean;
11
+ };
12
+ }
13
+ /**
14
+ * Return the exact JSON Schemas exposed by the built-in MCP server's
15
+ * `tools/list` response. This lint-only entry point is deliberately separate
16
+ * from the ordinary inventory export so production sessions do not load MCP
17
+ * client or schema-inspection code.
18
+ */
19
+ declare function loadBuiltinToolContractsForLint(): Promise<BuiltinToolContract[]>;
20
+
21
+ export { type BuiltinToolContract, loadBuiltinToolContractsForLint };
@@ -0,0 +1,71 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/lint-contracts.ts
4
+ var builtinToolContractsPromise;
5
+ function loadBuiltinToolContractsForLint() {
6
+ builtinToolContractsPromise ??= loadBuiltinToolContracts();
7
+ return builtinToolContractsPromise;
8
+ }
9
+ async function loadBuiltinToolContracts() {
10
+ const envKeys = [
11
+ "GEZEL_MCP_NO_MAIN",
12
+ "GEZEL_MCP_SCHEMA_LINT",
13
+ "GEZEL_MCP_ALLOW",
14
+ "GEZEL_MCP_EXCLUDE",
15
+ "GEZEL_MCP_LEGACY_TOOLS",
16
+ "GEZEL_MCP_TOOL_NAMING",
17
+ "GEZEL_SCRIPT_TOOLS",
18
+ "GEZEL_CRAFTBOOK_ID",
19
+ "GEZEL_MAIL_ENABLED",
20
+ "GEZEL_CONNECTORS_ENABLED",
21
+ "GEZEL_PERMISSION_PROMPT"
22
+ ];
23
+ const previous = new Map(envKeys.map((key) => [key, process.env[key]]));
24
+ process.env.GEZEL_MCP_NO_MAIN = "1";
25
+ process.env.GEZEL_MCP_SCHEMA_LINT = "1";
26
+ delete process.env.GEZEL_MCP_ALLOW;
27
+ delete process.env.GEZEL_MCP_EXCLUDE;
28
+ delete process.env.GEZEL_MCP_LEGACY_TOOLS;
29
+ delete process.env.GEZEL_MCP_TOOL_NAMING;
30
+ delete process.env.GEZEL_SCRIPT_TOOLS;
31
+ process.env.GEZEL_CRAFTBOOK_ID = "schema-lint-craftbook";
32
+ process.env.GEZEL_MAIL_ENABLED = "1";
33
+ process.env.GEZEL_CONNECTORS_ENABLED = "1";
34
+ process.env.GEZEL_PERMISSION_PROMPT = "1";
35
+ try {
36
+ const serverModulePath = "./server.js";
37
+ const [{ Client }, { InMemoryTransport }, { server }] = await Promise.all([
38
+ import("@modelcontextprotocol/sdk/client/index.js"),
39
+ import("@modelcontextprotocol/sdk/inMemory.js"),
40
+ import(serverModulePath)
41
+ ]);
42
+ const client = new Client(
43
+ { name: "gezel-prompt-schema-linter", version: "1.0.0" },
44
+ { capabilities: {} }
45
+ );
46
+ const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair();
47
+ await Promise.all([server.connect(serverTransport), client.connect(clientTransport)]);
48
+ try {
49
+ const listing = await client.listTools();
50
+ return listing.tools.map((tool) => ({
51
+ name: tool.name,
52
+ description: tool.description ?? "",
53
+ inputSchema: tool.inputSchema,
54
+ ...tool.outputSchema ? { outputSchema: tool.outputSchema } : {},
55
+ ...tool.annotations ? { annotations: tool.annotations } : {}
56
+ }));
57
+ } finally {
58
+ await client.close().catch(() => void 0);
59
+ await server.close().catch(() => void 0);
60
+ }
61
+ } finally {
62
+ for (const key of envKeys) {
63
+ const value = previous.get(key);
64
+ if (value === void 0) delete process.env[key];
65
+ else process.env[key] = value;
66
+ }
67
+ }
68
+ }
69
+ export {
70
+ loadBuiltinToolContractsForLint
71
+ };
@@ -0,0 +1,24 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+
3
+ /**
4
+ * Gezel MCP Server
5
+ *
6
+ * A stdio-based MCP server that gives Copilot agents access to Gezel's
7
+ * memory system, workspace files, artifacts, and project tools. Spawned by
8
+ * the ChatManager as a local MCP server for each chat session.
9
+ *
10
+ * Configuration is passed via environment variables:
11
+ * GEZEL_BASE_URL — daemon base URL (http(s)://127.0.0.1:<port>)
12
+ * GEZEL_TOKEN — bearer token for the daemon API
13
+ * GEZEL_CERT_PATH — path to the daemon's runtime/cert.pem (under its GEZEL_HOME; default ~/.gezel/runtime) when it serves HTTPS
14
+ * GEZEL_AGENT_ID — the agent this session belongs to
15
+ * GEZEL_PROJECT_ID — the project context
16
+ * GEZEL_SESSION_ID — the chat session this subprocess serves
17
+ * GEZEL_HOME — path to ~/.gezel (for direct memory access)
18
+ * GEZEL_CRAFTBOOK_ID — explicit craftbook-editor context (loads step surgery)
19
+ * GEZEL_MCP_LEGACY_TOOLS=1 — expose compatibility aliases during migration
20
+ */
21
+
22
+ declare const server: McpServer;
23
+
24
+ export { server };