@contextq/mcp 0.0.1 → 2.0.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 HENIART
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,9 +1,165 @@
1
1
  # @contextq/mcp
2
2
 
3
- **This is a name-reservation placeholder. It contains no code and does nothing.**
3
+ MCP server for ContextQ -- exposes the ContextQ knowledge-management API (89 tools: save, search, ingest, goal graphs, agent sessions, relays, and more) as Model Context Protocol tools. A curated ~24-tool default set loads at connection to keep the token cost of `tools/list` low; the rest load on demand or via `CONTEXT_MCP_TOOL_PROFILE=full` -- see below.
4
4
 
5
- The real `@contextq/mcp` is built at
6
- [HENIART/contextq](https://github.com/HENIART/contextq) under `mcp/`
7
- (version 2.0.0 at the time of this reservation) and is not published yet.
5
+ ```bash
6
+ npx -y @contextq/mcp
7
+ ```
8
8
 
9
- Do not depend on this version. Watch the repository for the first real release.
9
+ ## Client configuration
10
+
11
+ Two environment variables are required in every client:
12
+
13
+ | Variable | Description |
14
+ |---|---|
15
+ | `CONTEXT_API_URL` | Base URL of your ContextQ server (e.g. `https://ctx.example.com`) |
16
+ | `CONTEXT_API_KEY` | API key sent as `Authorization: Bearer` on every request |
17
+
18
+ Optional:
19
+
20
+ | Variable | Description |
21
+ |---|---|
22
+ | `CONTEXT_MCP_TOOL_PROFILE` | `default` (default if unset) loads a curated ~24-tool set at connection, well under most hosts' comfortable tool-list budget; `full` loads all ~89 tools from the start. On `default`, the rest stay reachable via the `ctx_tool_groups` (list) / `ctx_load_tool_group` (load) tools without reconnecting -- see `docs/mcp-tools.md` "Discoverability under ToolSearch deferral" |
23
+
24
+ **Setup paths**: Claude Code and Claude Desktop have automated setup via the `contextq init` CLI command. Cursor, Windsurf, and Cline require manual config file editing — see `docs/mcp-setup.md` for the full reference.
25
+
26
+ ### Claude Desktop
27
+
28
+ Add to `claude_desktop_config.json`:
29
+
30
+ ```json
31
+ {
32
+ "mcpServers": {
33
+ "contextq": {
34
+ "command": "npx",
35
+ "args": ["-y", "@contextq/mcp"],
36
+ "env": {
37
+ "CONTEXT_API_KEY": "sk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
38
+ "CONTEXT_API_URL": "https://ctx.example.com"
39
+ }
40
+ }
41
+ }
42
+ }
43
+ ```
44
+
45
+ ### Claude Code
46
+
47
+ ```bash
48
+ claude mcp add contextq \
49
+ -e CONTEXT_API_KEY=sk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx \
50
+ -e CONTEXT_API_URL=https://ctx.example.com \
51
+ -- npx -y @contextq/mcp
52
+ ```
53
+
54
+ ### Cursor
55
+
56
+ Add to your Cursor MCP config (`.cursor/mcp.json` or Settings > MCP):
57
+
58
+ ```json
59
+ {
60
+ "mcpServers": {
61
+ "contextq": {
62
+ "command": "npx",
63
+ "args": ["-y", "@contextq/mcp"],
64
+ "env": {
65
+ "CONTEXT_API_KEY": "sk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
66
+ "CONTEXT_API_URL": "https://ctx.example.com"
67
+ }
68
+ }
69
+ }
70
+ }
71
+ ```
72
+
73
+ ### Windsurf
74
+
75
+ **STATUS (2026-06-02)**: Windsurf was rebranded as Devin Desktop and Cascade was end-of-lifed (2026-07-01). If you have an existing Windsurf install, the configuration below still applies, but new installations should use Devin Desktop instead. Devin Desktop uses the same MCP config format under `.devin/mcp.json`.
76
+
77
+ Add to your Windsurf MCP config (`.windsurf/mcp.json`):
78
+
79
+ ```json
80
+ {
81
+ "mcpServers": {
82
+ "contextq": {
83
+ "command": "npx",
84
+ "args": ["-y", "@contextq/mcp"],
85
+ "env": {
86
+ "CONTEXT_API_KEY": "sk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
87
+ "CONTEXT_API_URL": "https://ctx.example.com"
88
+ }
89
+ }
90
+ }
91
+ }
92
+ ```
93
+
94
+ ## What data is sent and tenant isolation
95
+
96
+ - **Only the requests your agent makes are sent.** The MCP server is a stateless proxy -- it forwards each tool call to the ContextQ API via `CONTEXT_API_URL` and returns the response. No telemetry, no background sync, no usage tracking beyond what your ContextQ server logs.
97
+ - **Tenant-scoped API keys.** Every ContextQ API key is bound to a single tenant. All `/api/*` endpoints enforce tenant isolation -- an API key can only access the tenant it was issued for. Cross-tenant data leaks are impossible at the API layer.
98
+ - **Per-request auth.** Your `CONTEXT_API_KEY` is sent as an `Authorization: Bearer` header on every call. It never appears in tool names, argument schemas, or responses returned to the LLM.
99
+
100
+ ## Client timeout configuration
101
+
102
+ A handful of ContextQ tools run LLM calls, kNN scans, or bulk DB operations server-side and can legitimately take longer than a typical MCP client's default request timeout. If your client aborts before the server responds, you will see a timeout error that looks like a broken tool — it usually isn't. Configure a longer per-server timeout for this MCP server rather than assuming the tool is hung.
103
+
104
+ **Slow-class tools** (recommend a longer timeout, e.g. 120000-180000 ms depending on workspace size):
105
+
106
+ | Tool | Why it's slow |
107
+ |---|---|
108
+ | `ctx_dream` | Clusters a workspace's contexts via vector similarity, then runs one LLM synthesis call per cluster. |
109
+ | `ctx_evolve` | Runs LLM judging over up to 20 nearest-neighbor contexts to decide links/archival. |
110
+ | `ctx_ingest` | Fetches/parses a source and runs LLM claim extraction + kNN diffing. Large or URL-sourced ingests already return `{ jobId, statusUrl }` and expect polling via `ctx_ingest_status` — but small inline ingests still run synchronously and can take several seconds. |
111
+ | `ctx_regenerate_mocs` | Re-clusters all of a tenant's contexts and runs one LLM synthesis call per cluster (admin scope). |
112
+ | `ctx_memory_review_run` | Samples older contexts and asks the LLM to verdict each one (superadmin scope). |
113
+ | `ctx_bulk_update` | Applies a lifecycle/archive patch to up to 200 context ids in one call — bounded, but still slower than a single-row update. |
114
+ | `ctx_audit_cleanup_run` | Deletes up to 5000 `activity_logs` rows in one pass (superadmin scope). |
115
+ | `ctx_snapshot_create` / `ctx_fork_world` / `ctx_diff_world` | Clone or diff a workspace's full memory state (contexts, links, goal graph) — cost scales with workspace size. |
116
+
117
+ Everything else (`ctx_search`, `ctx_get`, `ctx_save`, `ctx_list`, `agent_*`, `goal_*`, `relay_*`, etc.) is ordinary CRUD/search and should complete well within a default client timeout.
118
+
119
+ These numbers are starting points, not guarantees — actual latency depends on your ContextQ server's hardware, workspace size, and configured LLM/embedding provider. Measure against your own deployment before tuning tighter.
120
+
121
+ ### `.mcp.json` per-server `request_timeout_ms`
122
+
123
+ Most MCP clients that support `.mcp.json` (including Claude Code) accept a per-server `request_timeout_ms` to override the client's default request timeout for every tool call on that server:
124
+
125
+ ```json
126
+ {
127
+ "mcpServers": {
128
+ "contextq": {
129
+ "command": "npx",
130
+ "args": ["-y", "@contextq/mcp"],
131
+ "env": {
132
+ "CONTEXT_API_KEY": "sk_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
133
+ "CONTEXT_API_URL": "https://ctx.example.com"
134
+ },
135
+ "request_timeout_ms": 120000
136
+ }
137
+ }
138
+ }
139
+ ```
140
+
141
+ `request_timeout_ms` applies per server, not per tool — if you regularly call slow-class tools, size it for the slowest one you expect to hit, not the average. Claude Code 2.1.206 fixed a bug where this field was silently ignored (a 60s default was applied regardless); confirm your Claude Code version is at least 2.1.206 if the setting doesn't seem to take effect.
142
+
143
+ ### Claude Code idle timeout
144
+
145
+ Independently of `request_timeout_ms`, Claude Code (2.1.187+) also enforces `CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT` — an idle-abort timeout (default around 5 minutes) that fires if an MCP tool call produces no activity for that long. Set it in your shell environment (not `.mcp.json`) when calling slow-class tools against a large workspace:
146
+
147
+ ```bash
148
+ export CLAUDE_CODE_MCP_TOOL_IDLE_TIMEOUT=300000 # milliseconds; raise if ctx_dream/ctx_ingest still time out
149
+ ```
150
+
151
+ Treat both settings as recommendations, not guarantees, of how long any given call will take.
152
+
153
+ ## API version compatibility
154
+
155
+ The 89-tool surface exposed by this MCP server is a direct projection of the ContextQ API (24 loaded by default, the rest via `CONTEXT_MCP_TOOL_PROFILE=full` or on-demand -- see "Client configuration" above). The tool count and signatures drift with the server. Pin compatible versions:
156
+
157
+ | MCP package | ContextQ server API |
158
+ |---|---|
159
+ | `@contextq/mcp@2.x` | ContextQ v2.x (89 tools) |
160
+
161
+ When upgrading your ContextQ server, check the [changelog](https://github.com/HENIART/contextq/releases) and bump the MCP package to the matching major version. A version mismatch may surface unknown tools or break call signatures.
162
+
163
+ ## License
164
+
165
+ MIT
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,210 @@
1
+ #!/usr/bin/env node
2
+ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
3
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
+ import { ListToolsRequestSchema, CallToolRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
5
+ import { readFileSync } from "node:fs";
6
+ import { fileURLToPath } from "node:url";
7
+ import { dirname, join } from "node:path";
8
+ import { getActiveTools, handleToolCall } from "./tools.js";
9
+ // ---------------------------------------------------------------------------
10
+ // MCP package version (read from package.json at runtime)
11
+ // ---------------------------------------------------------------------------
12
+ function readPackageVersion() {
13
+ try {
14
+ const __dirname = dirname(fileURLToPath(import.meta.url));
15
+ const pkg = JSON.parse(readFileSync(join(__dirname, "..", "package.json"), "utf8"));
16
+ return pkg.version ?? "0.0.0";
17
+ }
18
+ catch {
19
+ return "0.0.0";
20
+ }
21
+ }
22
+ const MCP_VERSION = readPackageVersion();
23
+ // Minimum API version this MCP supports. Bump when the MCP depends on
24
+ // API-side features that did not exist in older server releases.
25
+ const MIN_API_VERSION = "0.1.0";
26
+ function parseSemVer(v) {
27
+ const m = v.match(/^(\d+)\.(\d+)\.(\d+)/);
28
+ if (!m)
29
+ return null;
30
+ return { major: Number(m[1]), minor: Number(m[2]), patch: Number(m[3]) };
31
+ }
32
+ function semVerGte(a, b) {
33
+ if (a.major !== b.major)
34
+ return a.major > b.major;
35
+ if (a.minor !== b.minor)
36
+ return a.minor > b.minor;
37
+ return a.patch >= b.patch;
38
+ }
39
+ // ---------------------------------------------------------------------------
40
+ // API version handshake
41
+ //
42
+ // On startup, probes the API's health endpoint to read its version and
43
+ // compares it against MIN_API_VERSION. Mismatches or unreachable APIs
44
+ // produce a warning on stderr but never prevent startup — the tool surface
45
+ // can drift, and connecting an outdated MCP to a newer API (or vice versa)
46
+ // must still work from the MCP side. The warning is the signal.
47
+ // ---------------------------------------------------------------------------
48
+ async function handshake(baseUrl) {
49
+ const base = baseUrl.replace(/\/+$/, "");
50
+ let reachable = false;
51
+ let apiVersion;
52
+ // Quick reachability probe via GET /health (always public, no DB hit).
53
+ try {
54
+ const resp = await fetch(`${base}/health`, { signal: AbortSignal.timeout(3000), redirect: 'manual' });
55
+ if (resp.ok) {
56
+ reachable = true;
57
+ // Some deployments may embed a version key on the simple endpoint.
58
+ const body = (await resp.json().catch(() => null));
59
+ if (body && typeof body.version === "string") {
60
+ apiVersion = body.version;
61
+ }
62
+ }
63
+ }
64
+ catch {
65
+ // /health unreachable — try /health/deep below.
66
+ }
67
+ // Deep health returns a `version` field (git SHA in the current server,
68
+ // may become a semver in future releases).
69
+ if (!apiVersion) {
70
+ try {
71
+ const resp = await fetch(`${base}/health/deep`, { signal: AbortSignal.timeout(3000), redirect: 'manual' });
72
+ if (resp.ok) {
73
+ reachable = true;
74
+ const body = (await resp.json().catch(() => null));
75
+ if (body && typeof body.version === "string") {
76
+ apiVersion = body.version;
77
+ }
78
+ }
79
+ }
80
+ catch {
81
+ // Both endpoints unreachable or version-less.
82
+ }
83
+ }
84
+ if (!reachable) {
85
+ console.error(`[shared-context-mcp] WARNING: API at ${base} is unreachable. ` +
86
+ `The MCP server has started but tools will return errors until the API becomes reachable.`);
87
+ return;
88
+ }
89
+ if (apiVersion) {
90
+ const apiSemVer = parseSemVer(apiVersion);
91
+ const minSemVer = parseSemVer(MIN_API_VERSION);
92
+ if (apiSemVer && minSemVer) {
93
+ if (!semVerGte(apiSemVer, minSemVer)) {
94
+ console.error(`[shared-context-mcp] WARNING: API version ${apiVersion} is older ` +
95
+ `than the minimum supported version ${MIN_API_VERSION}. ` +
96
+ `The MCP server has started but some tools may behave differently.`);
97
+ }
98
+ else {
99
+ console.error(`[shared-context-mcp] API version ${apiVersion} satisfies min version ${MIN_API_VERSION}.`);
100
+ }
101
+ }
102
+ else {
103
+ // Version field exists but is not a semver (e.g. a git SHA).
104
+ // Skip the comparison — can't evaluate.
105
+ console.error(`[shared-context-mcp] API reports version identifier: ${apiVersion} ` +
106
+ `(not a semantic version — compatibility check skipped).`);
107
+ }
108
+ }
109
+ else {
110
+ console.error(`[shared-context-mcp] WARNING: API at ${base} does not report a version. ` +
111
+ `Compatibility with min ${MIN_API_VERSION} was not verified.`);
112
+ }
113
+ }
114
+ // ---------------------------------------------------------------------------
115
+ // Server setup
116
+ // ---------------------------------------------------------------------------
117
+ // T618: Claude Code (2.1.222+) defers a server's tools behind ToolSearch once
118
+ // it exposes many of them -- the model sees tool NAMES only and must find
119
+ // tools by keyword search against name + description. `instructions` is the
120
+ // one channel guaranteed to render into the system prompt regardless of
121
+ // deferral (observable under "MCP Server Instructions" in any CC session
122
+ // connected to this server), so it carries the prefix map + the "load these
123
+ // together" guidance that a per-tool description cannot. Kept short --
124
+ // see docs/mcp-tools.md "Discoverability under ToolSearch deferral" for the
125
+ // keyword heuristic behind individual tool descriptions.
126
+ const SERVER_INSTRUCTIONS = "ContextQ: persistent memory + goal graph for agents. Prefixes: ctx_* = " +
127
+ "knowledge CRUD/search (save/search/get/list a context; use ctx_search to " +
128
+ "recall or check for existing knowledge before re-saving it), agent_* = " +
129
+ "agent session memory (boot/checkpoint/resume/lesson/handoff), goal_* = " +
130
+ "shared goal graph (add/advance/frontier -- durable cross-session tasks), " +
131
+ "relay_* = directed cross-role handoff (open/inbox/claim/advance). At the " +
132
+ "start of tracked work, load ctx_search, ctx_save, and agent_boot together " +
133
+ "in one ToolSearch select call rather than one at a time. T668: only a " +
134
+ "small default tool set is loaded on connection (~24 tools) -- if the " +
135
+ "tool you need isn't in your list, call ctx_tool_groups to see the rest " +
136
+ "(code graph, admin, relay, world-model, saved searches, knowledge graph, " +
137
+ "bulk ingest) and ctx_load_tool_group to load a group into this session.";
138
+ const server = new Server({
139
+ name: "shared-context",
140
+ version: MCP_VERSION,
141
+ }, {
142
+ capabilities: {
143
+ // T668: listChanged:true -- ctx_load_tool_group promotes a group into
144
+ // the active profile at runtime and we notify via
145
+ // notifications/tools/list_changed. Clients that ignore the
146
+ // notification (or never subscribed) still work: handleToolCall
147
+ // dispatches on tool name regardless of the last tools/list result.
148
+ tools: { listChanged: true },
149
+ },
150
+ instructions: SERVER_INSTRUCTIONS,
151
+ });
152
+ // ---------------------------------------------------------------------------
153
+ // Request handlers
154
+ // ---------------------------------------------------------------------------
155
+ server.setRequestHandler(ListToolsRequestSchema, async () => {
156
+ // T668: default/extended tool-profile split -- see tools.ts's
157
+ // getActiveTools()/TOOL_GROUPS doc comment. Starts at the default (or
158
+ // full, via CONTEXT_MCP_TOOL_PROFILE=full) profile and grows as
159
+ // ctx_load_tool_group is called.
160
+ return { tools: getActiveTools() };
161
+ });
162
+ server.setRequestHandler(CallToolRequestSchema, async (req) => {
163
+ const { name, arguments: args, _meta } = req.params;
164
+ // T558: `_meta` already exists on every `tools/call` request in the
165
+ // current protocol -- forward it through so `handleToolCall` can pull out
166
+ // `traceparent`/`tracestate`/`baggage` when a client sends them. Absent
167
+ // on every request today; `handleToolCall`'s own extraction is the
168
+ // silent no-op path.
169
+ const result = await handleToolCall(name, (args ?? {}), _meta);
170
+ // T668: the active tool set just grew -- tell any client that negotiated
171
+ // capabilities.tools.listChanged so it re-fetches tools/list. Best-effort:
172
+ // a client that never subscribed, or a closed transport, must never fail
173
+ // the tool call it rides on.
174
+ if (name === "ctx_load_tool_group" && !result.isError) {
175
+ server.sendToolListChanged().catch(() => { });
176
+ }
177
+ return result;
178
+ });
179
+ // ---------------------------------------------------------------------------
180
+ // Start
181
+ // ---------------------------------------------------------------------------
182
+ async function main() {
183
+ const apiUrl = process.env.CONTEXT_API_URL ?? "http://localhost:38200";
184
+ // Validate CONTEXT_API_URL before connecting. An invalid or non-HTTP URL
185
+ // would cause every tool call to throw a cryptic fetch error; fail fast here.
186
+ try {
187
+ const parsed = new URL(apiUrl);
188
+ if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
189
+ console.error(`[shared-context-mcp] Fatal: CONTEXT_API_URL must use http: or https: protocol, ` +
190
+ `got "${parsed.protocol}". Set CONTEXT_API_URL to a valid API base URL.`);
191
+ process.exit(1);
192
+ }
193
+ }
194
+ catch {
195
+ console.error(`[shared-context-mcp] Fatal: CONTEXT_API_URL "${apiUrl}" is not a valid URL. ` +
196
+ `Set CONTEXT_API_URL to a valid API base URL (e.g. http://localhost:38200).`);
197
+ process.exit(1);
198
+ }
199
+ const transport = new StdioServerTransport();
200
+ await server.connect(transport);
201
+ const apiKey = process.env.CONTEXT_API_KEY;
202
+ console.error(`[shared-context-mcp] Connected (v${MCP_VERSION}). API: ${apiUrl}, Auth: ${apiKey ? 'configured' : 'NONE'}`);
203
+ // Non-fatal: warns on stderr but never blocks startup.
204
+ await handshake(apiUrl);
205
+ }
206
+ main().catch((err) => {
207
+ console.error("[shared-context-mcp] Fatal:", err);
208
+ process.exit(1);
209
+ });
210
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5D,8EAA8E;AAC9E,0DAA0D;AAC1D,8EAA8E;AAE9E,SAAS,kBAAkB;IACzB,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QAC1D,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,SAA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AG,CAAC,CAAC;IAClD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,23 @@
1
+ import type { Tool } from "@modelcontextprotocol/sdk/types.js";
2
+ export declare const tools: Tool[];
3
+ export interface ToolGroup {
4
+ description: string;
5
+ tools: string[];
6
+ }
7
+ export declare const TOOL_GROUPS: Record<string, ToolGroup>;
8
+ export declare const DEFAULT_PROFILE_TOOL_NAMES: Set<string>;
9
+ export type ToolProfile = "default" | "full";
10
+ export declare function getActiveTools(): Tool[];
11
+ export declare function loadToolGroup(group: string): {
12
+ added: string[];
13
+ unknownGroup: boolean;
14
+ };
15
+ type ToolInput = Record<string, unknown>;
16
+ export declare function handleToolCall(name: string, args: ToolInput, meta?: unknown): Promise<{
17
+ content: Array<{
18
+ type: "text";
19
+ text: string;
20
+ }>;
21
+ isError?: boolean;
22
+ }>;
23
+ export {};