@apicircle/mcp-server 1.0.8 → 1.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.
package/dist/index.d.cts CHANGED
@@ -1,9 +1,13 @@
1
1
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
2
  import { Transport } from '@modelcontextprotocol/sdk/shared/transport.js';
3
+ export { Transport } from '@modelcontextprotocol/sdk/shared/transport.js';
3
4
  import { z } from 'zod';
4
5
  import { WorkspaceSynced, WorkspaceLocal, MockServer, MockRuntimeEntry, McpToolName } from '@apicircle/shared';
5
6
  import { WorkspaceState, WorkspacePatch } from '@apicircle/core';
6
7
  import { WorkspaceRegistry } from '@apicircle/core/workspace/registry';
8
+ export { MCP_PROMPTS, MCP_PROMPT_CATEGORIES, McpPrompt, McpPromptCategory } from './prompts/mcpPrompts.cjs';
9
+ export { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
10
+ export { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
7
11
 
8
12
  interface WorkspaceProvider {
9
13
  /** Snapshot the current `{ synced, local }` pair. */
@@ -171,6 +175,20 @@ declare class FileBackedWorkspaceProvider implements WorkspaceProvider {
171
175
  }): Promise<WorkspaceState>;
172
176
  }
173
177
 
178
+ declare class GitBackedWorkspaceProvider implements WorkspaceProvider {
179
+ private readonly dir;
180
+ constructor(dir: string);
181
+ read(): Promise<WorkspaceState>;
182
+ apply(patch: WorkspacePatch): Promise<{
183
+ state: WorkspaceState;
184
+ changedIds: string[];
185
+ }>;
186
+ write(next: {
187
+ synced?: WorkspaceSynced;
188
+ local?: WorkspaceLocal;
189
+ }): Promise<WorkspaceState>;
190
+ }
191
+
174
192
  declare class MultiWorkspaceProvider implements Workspaces {
175
193
  private readonly registryRoot;
176
194
  /** Last-known active workspace id. Refreshed every time the lazy
@@ -229,6 +247,52 @@ declare class InProcessMockController implements MockController {
229
247
  }>>;
230
248
  }
231
249
 
250
+ type AiClient = 'claude-desktop' | 'claude-code' | 'codex' | 'cursor' | 'continue' | 'cline' | 'zed' | 'windsurf' | 'github-copilot' | 'chatgpt' | 'generic';
251
+ declare const AI_CLIENTS: readonly AiClient[];
252
+ /**
253
+ * Two byte-identical-but-for-path-escaping renderings of the same snippet.
254
+ *
255
+ * - `forwardSlash`: workspace path uses `/` separators on Windows
256
+ * (`"C:/Users/.../workspaces"`). No backslash escapes needed — easier
257
+ * to read, accepted by Node, Electron, and Windows file APIs.
258
+ * - `escaped`: literal OS path. On Windows that means `\\` escapes
259
+ * inside quoted strings (JSON and TOML both use `\` as the escape
260
+ * character).
261
+ *
262
+ * On POSIX both strings are byte-identical and `identical` is `true` — the
263
+ * UI uses that flag to suppress the variant picker.
264
+ */
265
+ interface ConfigSnippetVariants {
266
+ forwardSlash: string;
267
+ escaped: string;
268
+ identical: boolean;
269
+ }
270
+ /**
271
+ * Build the snippet for a given AI client + workspace path. Most clients
272
+ * use JSON with `mcpServers: { apicircle: ... }`; Codex uses TOML with
273
+ * `[mcp_servers.apicircle]`. The `client` arg selects the format.
274
+ */
275
+ declare function buildSnippetVariants(client: AiClient, binary: string, workspace: string): ConfigSnippetVariants;
276
+ /**
277
+ * Host-environment shape the config-path resolver depends on. Both the
278
+ * desktop main process and the VS Code extension run on Node — they pass
279
+ * the standard `os.homedir()` / `process.platform` / `process.env.APPDATA`
280
+ * values straight through. Tests pin them explicitly.
281
+ */
282
+ interface ConfigPathEnv {
283
+ /** e.g. `os.homedir()` */
284
+ homedir: string;
285
+ /** `process.platform` — one of "darwin" / "win32" / "linux" / ... */
286
+ platform: NodeJS.Platform;
287
+ /** Windows-only: `process.env.APPDATA`, used by Claude Desktop's config. */
288
+ appdata?: string;
289
+ }
290
+ /**
291
+ * Conventional path of the config file for each client on the current OS,
292
+ * or `null` if the client has no fixed location (manual paste).
293
+ */
294
+ declare function resolveAiClientConfigPath(client: AiClient, env: ConfigPathEnv): string | null;
295
+
232
296
  interface CreateMcpServerOptions {
233
297
  /**
234
298
  * Provider for the ACTIVE workspace. Tools that consume `ctx.workspace`
@@ -258,4 +322,4 @@ interface CreateMcpServerOptions {
258
322
  */
259
323
  declare function createMcpServer(options: CreateMcpServerOptions): McpHost;
260
324
 
261
- export { type AnyToolDef, type CreateMcpServerOptions, FileBackedWorkspaceProvider, InMemoryWorkspaceProvider, InProcessMockController, McpHost, type MockController, MultiWorkspaceProvider, SingleWorkspaceAdapter, type StartMockResult, TOOL_REGISTRY, type ToolDef, type ToolHandlerContext, WorkspaceNotFoundError, type WorkspaceProvider, type WorkspaceSummary, type Workspaces, createMcpServer, getTool };
325
+ export { AI_CLIENTS, type AiClient, type AnyToolDef, type ConfigPathEnv, type ConfigSnippetVariants, type CreateMcpServerOptions, FileBackedWorkspaceProvider, GitBackedWorkspaceProvider, InMemoryWorkspaceProvider, InProcessMockController, McpHost, type MockController, MultiWorkspaceProvider, SingleWorkspaceAdapter, type StartMockResult, TOOL_REGISTRY, type ToolDef, type ToolHandlerContext, WorkspaceNotFoundError, type WorkspaceProvider, type WorkspaceSummary, type Workspaces, buildSnippetVariants, createMcpServer, getTool, resolveAiClientConfigPath };
package/dist/index.d.ts CHANGED
@@ -1,9 +1,13 @@
1
1
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
2
  import { Transport } from '@modelcontextprotocol/sdk/shared/transport.js';
3
+ export { Transport } from '@modelcontextprotocol/sdk/shared/transport.js';
3
4
  import { z } from 'zod';
4
5
  import { WorkspaceSynced, WorkspaceLocal, MockServer, MockRuntimeEntry, McpToolName } from '@apicircle/shared';
5
6
  import { WorkspaceState, WorkspacePatch } from '@apicircle/core';
6
7
  import { WorkspaceRegistry } from '@apicircle/core/workspace/registry';
8
+ export { MCP_PROMPTS, MCP_PROMPT_CATEGORIES, McpPrompt, McpPromptCategory } from './prompts/mcpPrompts.js';
9
+ export { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
10
+ export { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
7
11
 
8
12
  interface WorkspaceProvider {
9
13
  /** Snapshot the current `{ synced, local }` pair. */
@@ -171,6 +175,20 @@ declare class FileBackedWorkspaceProvider implements WorkspaceProvider {
171
175
  }): Promise<WorkspaceState>;
172
176
  }
173
177
 
178
+ declare class GitBackedWorkspaceProvider implements WorkspaceProvider {
179
+ private readonly dir;
180
+ constructor(dir: string);
181
+ read(): Promise<WorkspaceState>;
182
+ apply(patch: WorkspacePatch): Promise<{
183
+ state: WorkspaceState;
184
+ changedIds: string[];
185
+ }>;
186
+ write(next: {
187
+ synced?: WorkspaceSynced;
188
+ local?: WorkspaceLocal;
189
+ }): Promise<WorkspaceState>;
190
+ }
191
+
174
192
  declare class MultiWorkspaceProvider implements Workspaces {
175
193
  private readonly registryRoot;
176
194
  /** Last-known active workspace id. Refreshed every time the lazy
@@ -229,6 +247,52 @@ declare class InProcessMockController implements MockController {
229
247
  }>>;
230
248
  }
231
249
 
250
+ type AiClient = 'claude-desktop' | 'claude-code' | 'codex' | 'cursor' | 'continue' | 'cline' | 'zed' | 'windsurf' | 'github-copilot' | 'chatgpt' | 'generic';
251
+ declare const AI_CLIENTS: readonly AiClient[];
252
+ /**
253
+ * Two byte-identical-but-for-path-escaping renderings of the same snippet.
254
+ *
255
+ * - `forwardSlash`: workspace path uses `/` separators on Windows
256
+ * (`"C:/Users/.../workspaces"`). No backslash escapes needed — easier
257
+ * to read, accepted by Node, Electron, and Windows file APIs.
258
+ * - `escaped`: literal OS path. On Windows that means `\\` escapes
259
+ * inside quoted strings (JSON and TOML both use `\` as the escape
260
+ * character).
261
+ *
262
+ * On POSIX both strings are byte-identical and `identical` is `true` — the
263
+ * UI uses that flag to suppress the variant picker.
264
+ */
265
+ interface ConfigSnippetVariants {
266
+ forwardSlash: string;
267
+ escaped: string;
268
+ identical: boolean;
269
+ }
270
+ /**
271
+ * Build the snippet for a given AI client + workspace path. Most clients
272
+ * use JSON with `mcpServers: { apicircle: ... }`; Codex uses TOML with
273
+ * `[mcp_servers.apicircle]`. The `client` arg selects the format.
274
+ */
275
+ declare function buildSnippetVariants(client: AiClient, binary: string, workspace: string): ConfigSnippetVariants;
276
+ /**
277
+ * Host-environment shape the config-path resolver depends on. Both the
278
+ * desktop main process and the VS Code extension run on Node — they pass
279
+ * the standard `os.homedir()` / `process.platform` / `process.env.APPDATA`
280
+ * values straight through. Tests pin them explicitly.
281
+ */
282
+ interface ConfigPathEnv {
283
+ /** e.g. `os.homedir()` */
284
+ homedir: string;
285
+ /** `process.platform` — one of "darwin" / "win32" / "linux" / ... */
286
+ platform: NodeJS.Platform;
287
+ /** Windows-only: `process.env.APPDATA`, used by Claude Desktop's config. */
288
+ appdata?: string;
289
+ }
290
+ /**
291
+ * Conventional path of the config file for each client on the current OS,
292
+ * or `null` if the client has no fixed location (manual paste).
293
+ */
294
+ declare function resolveAiClientConfigPath(client: AiClient, env: ConfigPathEnv): string | null;
295
+
232
296
  interface CreateMcpServerOptions {
233
297
  /**
234
298
  * Provider for the ACTIVE workspace. Tools that consume `ctx.workspace`
@@ -258,4 +322,4 @@ interface CreateMcpServerOptions {
258
322
  */
259
323
  declare function createMcpServer(options: CreateMcpServerOptions): McpHost;
260
324
 
261
- export { type AnyToolDef, type CreateMcpServerOptions, FileBackedWorkspaceProvider, InMemoryWorkspaceProvider, InProcessMockController, McpHost, type MockController, MultiWorkspaceProvider, SingleWorkspaceAdapter, type StartMockResult, TOOL_REGISTRY, type ToolDef, type ToolHandlerContext, WorkspaceNotFoundError, type WorkspaceProvider, type WorkspaceSummary, type Workspaces, createMcpServer, getTool };
325
+ export { AI_CLIENTS, type AiClient, type AnyToolDef, type ConfigPathEnv, type ConfigSnippetVariants, type CreateMcpServerOptions, FileBackedWorkspaceProvider, GitBackedWorkspaceProvider, InMemoryWorkspaceProvider, InProcessMockController, McpHost, type MockController, MultiWorkspaceProvider, SingleWorkspaceAdapter, type StartMockResult, TOOL_REGISTRY, type ToolDef, type ToolHandlerContext, WorkspaceNotFoundError, type WorkspaceProvider, type WorkspaceSummary, type Workspaces, buildSnippetVariants, createMcpServer, getTool, resolveAiClientConfigPath };