@codespar/mcp
Advanced tools
@@ -0,2 +1,5 @@ | ||
| /** | ||
| * @codespar/mcp basic tests for 0.2.0. | ||
| */ | ||
| export {}; | ||
| //# sourceMappingURL=mcp.test.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"mcp.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/mcp.test.ts"],"names":[],"mappings":""} | ||
| {"version":3,"file":"mcp.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/mcp.test.ts"],"names":[],"mappings":"AAAA;;GAEG"} |
@@ -1,63 +0,71 @@ | ||
| import { describe, it, expect, vi } from "vitest"; | ||
| /** | ||
| * @codespar/mcp basic tests for 0.2.0. | ||
| */ | ||
| import { describe, it, expect } from "vitest"; | ||
| import { getMcpConfig, getClaudeDesktopConfig, getCursorConfig } from "../index.js"; | ||
| /* ── Fixtures ── */ | ||
| function mockSession() { | ||
| function fakeSession() { | ||
| return { | ||
| id: "sess_abc", | ||
| id: "ses_demo", | ||
| userId: "user_1", | ||
| servers: [], | ||
| createdAt: new Date(), | ||
| status: "active", | ||
| mcp: { | ||
| url: "https://mcp.codespar.dev/sess_abc", | ||
| headers: { Authorization: "Bearer tok_123" }, | ||
| url: "https://api.codespar.dev/v1/sessions/ses_demo/mcp", | ||
| headers: { Authorization: "Bearer csk_live_x" }, | ||
| }, | ||
| tools: () => [], | ||
| findTools: vi.fn(), | ||
| execute: vi.fn(), | ||
| loop: vi.fn(), | ||
| send: vi.fn(), | ||
| authorize: vi.fn(), | ||
| connections: vi.fn(), | ||
| close: vi.fn(), | ||
| async tools() { | ||
| return []; | ||
| }, | ||
| async findTools() { | ||
| return []; | ||
| }, | ||
| async execute(toolName) { | ||
| return { success: true, data: null, error: null, duration: 0, server: "", tool: toolName }; | ||
| }, | ||
| async loop() { | ||
| return { success: true, results: [], duration: 0, completedSteps: 0, totalSteps: 0 }; | ||
| }, | ||
| async send() { | ||
| return { message: "", tool_calls: [], iterations: 0 }; | ||
| }, | ||
| async *sendStream() { | ||
| // empty | ||
| }, | ||
| async authorize() { | ||
| return { connected: false }; | ||
| }, | ||
| async connections() { | ||
| return []; | ||
| }, | ||
| async close() { | ||
| // noop | ||
| }, | ||
| }; | ||
| } | ||
| /* ── Tests ── */ | ||
| describe("getMcpConfig", () => { | ||
| it("returns url and headers from session", () => { | ||
| const config = getMcpConfig(mockSession()); | ||
| expect(config.url).toBe("https://mcp.codespar.dev/sess_abc"); | ||
| expect(config.headers).toEqual({ Authorization: "Bearer tok_123" }); | ||
| describe("@codespar/mcp", () => { | ||
| it("getMcpConfig surfaces session.mcp", () => { | ||
| const session = fakeSession(); | ||
| const cfg = getMcpConfig(session); | ||
| expect(cfg.url).toBe("https://api.codespar.dev/v1/sessions/ses_demo/mcp"); | ||
| expect(cfg.headers.Authorization).toBe("Bearer csk_live_x"); | ||
| }); | ||
| }); | ||
| describe("getClaudeDesktopConfig", () => { | ||
| it("returns valid config structure with default server name", () => { | ||
| const config = getClaudeDesktopConfig(mockSession()); | ||
| expect(config.mcpServers).toBeDefined(); | ||
| expect(config.mcpServers.codespar).toBeDefined(); | ||
| expect(config.mcpServers.codespar.command).toBe("npx"); | ||
| expect(config.mcpServers.codespar.args).toContain("@codespar/mcp"); | ||
| expect(config.mcpServers.codespar.args).toContain("--session"); | ||
| expect(config.mcpServers.codespar.args).toContain("sess_abc"); | ||
| it("getClaudeDesktopConfig wraps in mcpServers shape", () => { | ||
| const session = fakeSession(); | ||
| const cfg = getClaudeDesktopConfig(session); | ||
| expect(cfg.mcpServers.codespar).toBeDefined(); | ||
| expect(cfg.mcpServers.codespar.command).toBe("npx"); | ||
| expect(cfg.mcpServers.codespar.args).toContain("ses_demo"); | ||
| expect(cfg.mcpServers.codespar.env?.MCP_URL).toBe(session.mcp.url); | ||
| }); | ||
| it("accepts custom server name", () => { | ||
| const config = getClaudeDesktopConfig(mockSession(), "my-server"); | ||
| expect(config.mcpServers["my-server"]).toBeDefined(); | ||
| expect(config.mcpServers["codespar"]).toBeUndefined(); | ||
| it("getClaudeDesktopConfig accepts custom server name", () => { | ||
| const session = fakeSession(); | ||
| const cfg = getClaudeDesktopConfig(session, "myorg"); | ||
| expect(cfg.mcpServers.myorg).toBeDefined(); | ||
| }); | ||
| it("includes MCP_URL in env", () => { | ||
| const config = getClaudeDesktopConfig(mockSession()); | ||
| expect(config.mcpServers.codespar.env?.MCP_URL).toBe("https://mcp.codespar.dev/sess_abc"); | ||
| it("getCursorConfig matches getMcpConfig", () => { | ||
| const session = fakeSession(); | ||
| expect(getCursorConfig(session)).toEqual(getMcpConfig(session)); | ||
| }); | ||
| it("includes session headers in env", () => { | ||
| const config = getClaudeDesktopConfig(mockSession()); | ||
| expect(config.mcpServers.codespar.env?.Authorization).toBe("Bearer tok_123"); | ||
| }); | ||
| }); | ||
| describe("getCursorConfig", () => { | ||
| it("returns url and headers", () => { | ||
| const config = getCursorConfig(mockSession()); | ||
| expect(config.url).toBe("https://mcp.codespar.dev/sess_abc"); | ||
| expect(config.headers).toEqual({ Authorization: "Bearer tok_123" }); | ||
| }); | ||
| }); | ||
| //# sourceMappingURL=mcp.test.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"mcp.test.js","sourceRoot":"","sources":["../../src/__tests__/mcp.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAGpF,oBAAoB;AAEpB,SAAS,WAAW;IAClB,OAAO;QACL,EAAE,EAAE,UAAU;QACd,MAAM,EAAE,QAAQ;QAChB,OAAO,EAAE,EAAE;QACX,SAAS,EAAE,IAAI,IAAI,EAAE;QACrB,GAAG,EAAE;YACH,GAAG,EAAE,mCAAmC;YACxC,OAAO,EAAE,EAAE,aAAa,EAAE,gBAAgB,EAAE;SAC7C;QACD,KAAK,EAAE,GAAG,EAAE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,CAAC,GAAG,CAAC,UAAU,CAAC,QAAS,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mDAAmD,EAAE,GAAG,EAAE;QAC3D,MAAM,OAAO,GAAG,WAAW,EAAE,CAAC;QAC9B,MAAM,GAAG,GAAG,sBAAsB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACrD,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;IAC7C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;QAC9C,MAAM,OAAO,GAAG,WAAW,EAAE,CAAC;QAC9B,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;IAClE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"} |
+21
-17
| /** | ||
| * @codespar/mcp — MCP transport for IDE integration | ||
| * @codespar/mcp — MCP transport config helper | ||
| * | ||
| * Provides MCP server URLs and config for connecting | ||
| * Claude Desktop, Cursor, VS Code, and other MCP clients | ||
| * to a CodeSpar session. | ||
| * Generates Model Context Protocol configuration files for connecting | ||
| * external MCP clients (Claude Desktop, Cursor, VS Code) to a CodeSpar | ||
| * session. | ||
| * | ||
| * **Status (0.2.0):** Config files are generated correctly. The runtime | ||
| * MCP endpoint on the backend is planned for Marco 3 — until then, the | ||
| * generated configs reference an endpoint that returns 404. This package | ||
| * is shipped now so devs can wire their tooling and have it work the | ||
| * moment the backend MCP transport ships. | ||
| * | ||
| * @example | ||
| * ```ts | ||
| * import { CodeSpar } from "@codespar/sdk"; | ||
| * import { getMcpConfig, getClaudeDesktopConfig } from "@codespar/mcp"; | ||
| * import { getClaudeDesktopConfig, getCursorConfig } from "@codespar/mcp"; | ||
| * | ||
| * const cs = new CodeSpar({ apiKey: "ak_..." }); | ||
| * const session = await cs.create("user_123", { preset: "brazilian" }); | ||
| * const cs = new CodeSpar({ apiKey: "csk_live_..." }); | ||
| * const session = await cs.create("user_123", { servers: ["zoop"] }); | ||
| * | ||
| * // Get MCP URL and headers for any client | ||
| * const { url, headers } = getMcpConfig(session); | ||
| * | ||
| * // Get Claude Desktop config JSON | ||
| * const config = getClaudeDesktopConfig(session); | ||
| * const claudeDesktop = getClaudeDesktopConfig(session); | ||
| * // → drop into ~/Library/Application Support/Claude/claude_desktop_config.json | ||
| * ``` | ||
@@ -40,3 +43,6 @@ */ | ||
| * Generate Claude Desktop configuration for a CodeSpar session. | ||
| * Output goes in ~/Library/Application Support/Claude/claude_desktop_config.json | ||
| * | ||
| * Output goes in: | ||
| * macOS: ~/Library/Application Support/Claude/claude_desktop_config.json | ||
| * Windows: %APPDATA%\Claude\claude_desktop_config.json | ||
| */ | ||
@@ -48,7 +54,5 @@ export declare function getClaudeDesktopConfig(session: Session, serverName?: string): { | ||
| * Generate Cursor / VS Code MCP configuration. | ||
| * Both tools accept the same `{ url, headers }` shape. | ||
| */ | ||
| export declare function getCursorConfig(session: Session): { | ||
| url: string; | ||
| headers: Record<string, string>; | ||
| }; | ||
| export declare function getCursorConfig(session: Session): McpConfig; | ||
| //# sourceMappingURL=index.d.ts.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAE7C,MAAM,WAAW,SAAS;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC;AAED,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CA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E3D"} |
+21
-17
| /** | ||
| * @codespar/mcp — MCP transport for IDE integration | ||
| * @codespar/mcp — MCP transport config helper | ||
| * | ||
| * Provides MCP server URLs and config for connecting | ||
| * Claude Desktop, Cursor, VS Code, and other MCP clients | ||
| * to a CodeSpar session. | ||
| * Generates Model Context Protocol configuration files for connecting | ||
| * external MCP clients (Claude Desktop, Cursor, VS Code) to a CodeSpar | ||
| * session. | ||
| * | ||
| * **Status (0.2.0):** Config files are generated correctly. The runtime | ||
| * MCP endpoint on the backend is planned for Marco 3 — until then, the | ||
| * generated configs reference an endpoint that returns 404. This package | ||
| * is shipped now so devs can wire their tooling and have it work the | ||
| * moment the backend MCP transport ships. | ||
| * | ||
| * @example | ||
| * ```ts | ||
| * import { CodeSpar } from "@codespar/sdk"; | ||
| * import { getMcpConfig, getClaudeDesktopConfig } from "@codespar/mcp"; | ||
| * import { getClaudeDesktopConfig, getCursorConfig } from "@codespar/mcp"; | ||
| * | ||
| * const cs = new CodeSpar({ apiKey: "ak_..." }); | ||
| * const session = await cs.create("user_123", { preset: "brazilian" }); | ||
| * const cs = new CodeSpar({ apiKey: "csk_live_..." }); | ||
| * const session = await cs.create("user_123", { servers: ["zoop"] }); | ||
| * | ||
| * // Get MCP URL and headers for any client | ||
| * const { url, headers } = getMcpConfig(session); | ||
| * | ||
| * // Get Claude Desktop config JSON | ||
| * const config = getClaudeDesktopConfig(session); | ||
| * const claudeDesktop = getClaudeDesktopConfig(session); | ||
| * // → drop into ~/Library/Application Support/Claude/claude_desktop_config.json | ||
| * ``` | ||
@@ -35,3 +38,6 @@ */ | ||
| * Generate Claude Desktop configuration for a CodeSpar session. | ||
| * Output goes in ~/Library/Application Support/Claude/claude_desktop_config.json | ||
| * | ||
| * Output goes in: | ||
| * macOS: ~/Library/Application Support/Claude/claude_desktop_config.json | ||
| * Windows: %APPDATA%\Claude\claude_desktop_config.json | ||
| */ | ||
@@ -54,9 +60,7 @@ export function getClaudeDesktopConfig(session, serverName = "codespar") { | ||
| * Generate Cursor / VS Code MCP configuration. | ||
| * Both tools accept the same `{ url, headers }` shape. | ||
| */ | ||
| export function getCursorConfig(session) { | ||
| return { | ||
| url: session.mcp.url, | ||
| headers: session.mcp.headers, | ||
| }; | ||
| return getMcpConfig(session); | ||
| } | ||
| //# sourceMappingURL=index.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAeH;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,OAAgB;IAC3C,OAAO;QACL,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG;QACpB,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO;KAC7B,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CACpC,OAAgB,EAChB,UAAU,GAAG,UAAU;IAEvB,OAAO;QACL,UAAU,EAAE;YACV,CAAC,UAAU,CAAC,EAAE;gBACZ,OAAO,EAAE,KAAK;gBACd,IAAI,EAAE,CAAC,IAAI,EAAE,eAAe,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,CAAC;gBACtD,GAAG,EAAE;oBACH,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG;oBACxB,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO;iBACvB;aACF;SACF;KACF,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,OAAgB;IAC9C,OAAO;QACL,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG;QACpB,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO;KAC7B,CAAC;AACJ,CAAC"} | ||
| {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAeH;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,OAAgB;IAC3C,OAAO;QACL,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG;QACpB,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,OAAO;KAC7B,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,sBAAsB,CACpC,OAAgB,EAChB,UAAU,GAAG,UAAU;IAEvB,OAAO;QACL,UAAU,EAAE;YACV,CAAC,UAAU,CAAC,EAAE;gBACZ,OAAO,EAAE,KAAK;gBACd,IAAI,EAAE,CAAC,IAAI,EAAE,eAAe,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,CAAC;gBACtD,GAAG,EAAE;oBACH,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG;oBACxB,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO;iBACvB;aACF;SACF;KACF,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,OAAgB;IAC9C,OAAO,YAAY,CAAC,OAAO,CAAC,CAAC;AAC/B,CAAC"} |
+3
-3
| { | ||
| "name": "@codespar/mcp", | ||
| "version": "0.1.0", | ||
| "version": "0.2.0", | ||
| "description": "MCP transport for CodeSpar — connect Claude Desktop, Cursor, VS Code to CodeSpar sessions", | ||
@@ -40,6 +40,6 @@ "type": "module", | ||
| "peerDependencies": { | ||
| "@codespar/sdk": "^0.1.0" | ||
| "@codespar/sdk": "^0.2.0" | ||
| }, | ||
| "devDependencies": { | ||
| "@codespar/sdk": "0.1.0", | ||
| "@codespar/sdk": "0.2.0", | ||
| "@types/node": "^25.6.0", | ||
@@ -46,0 +46,0 @@ "typescript": "^5.8.0", |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
13140
2.84%192
10.98%