@intlayer/mcp 8.9.6 → 8.9.8

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.
@@ -1,7 +1,7 @@
1
- import { createMCPClient } from "@ai-sdk/mcp";
2
1
  import { dirname as dirname$1 } from "node:path";
3
2
  import { fileURLToPath } from "node:url";
4
3
  import { isESModule } from "@intlayer/config/utils";
4
+ import { createMCPClient } from "@ai-sdk/mcp";
5
5
 
6
6
  //#region src/client/client.ts
7
7
  const dirname = isESModule ? dirname$1(fileURLToPath(import.meta.url)) : __dirname;
@@ -1 +1 @@
1
- {"version":3,"file":"client.mjs","names":["pathDirname"],"sources":["../../../src/client/client.ts"],"sourcesContent":["import { dirname as pathDirname } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { createMCPClient, type MCPClient } from '@ai-sdk/mcp';\nimport { isESModule } from '@intlayer/config/utils';\n\nexport type { MCPClient };\n\nexport const dirname: string = isESModule\n ? pathDirname(fileURLToPath(import.meta.url))\n : __dirname;\n\nexport const loadMCPTools = async (\n serverURL: string\n): Promise<{ client: MCPClient; tools: Record<string, any> }> => {\n const client = await createMCPClient({\n transport: { type: 'http', url: serverURL },\n });\n const tools = await client.tools();\n return { client, tools };\n};\n"],"mappings":";;;;;;AAOA,MAAa,UAAkB,aAC3BA,UAAY,cAAc,OAAO,KAAK,IAAI,CAAC,GAC3C;AAEJ,MAAa,eAAe,OAC1B,cAC+D;CAC/D,MAAM,SAAS,MAAM,gBAAgB,EACnC,WAAW;EAAE,MAAM;EAAQ,KAAK;EAAW,EAC5C,CAAC;CAEF,OAAO;EAAE;EAAQ,aADG,OAAO,OAAO;EACV"}
1
+ {"version":3,"file":"client.mjs","names":["pathDirname"],"sources":["../../../src/client/client.ts"],"sourcesContent":["import { dirname as pathDirname } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { createMCPClient, type MCPClient } from '@ai-sdk/mcp';\nimport { isESModule } from '@intlayer/config/utils';\n\nexport type { MCPClient };\n\nexport const dirname: string = isESModule\n ? pathDirname(fileURLToPath(import.meta.url))\n : __dirname;\n\nexport const loadMCPTools = async (\n serverURL: string\n): Promise<{ client: MCPClient; tools: Record<string, any> }> => {\n const client = await createMCPClient({\n transport: { type: 'http', url: serverURL },\n });\n const tools = await client.tools();\n return { client, tools };\n};\n"],"mappings":";;;;;;AAOA,MAAa,UAAkB,aAC3BA,UAAY,cAAc,OAAO,KAAK,GAAG,CAAC,IAC1C;AAEJ,MAAa,eAAe,OAC1B,cAC+D;CAC/D,MAAM,SAAS,MAAM,gBAAgB,EACnC,WAAW;EAAE,MAAM;EAAQ,KAAK;CAAU,EAC5C,CAAC;CAED,OAAO;EAAE;EAAQ,aADG,OAAO,MAAM;CACV;AACzB"}
@@ -1 +1 @@
1
- {"version":3,"file":"sse.mjs","names":[],"sources":["../../../src/client/sse.ts"],"sourcesContent":["import { createMCPClient, type MCPClient } from '@ai-sdk/mcp';\n\nconst main = async () => {\n const mcpServerURL = process.env.MCP_SERVER_URL ?? 'http://localhost:3000/';\n\n console.info(`Connecting to server - ${mcpServerURL}`);\n\n let mcpClient: MCPClient | undefined;\n try {\n mcpClient = await createMCPClient({\n transport: {\n type: 'http',\n url: mcpServerURL,\n },\n });\n console.info('Connected to MCP server');\n\n await new Promise<void>((resolve) => {\n process.once('SIGINT', resolve);\n process.once('SIGTERM', resolve);\n });\n } catch (error) {\n console.error('Failed to connect to MCP server: ', error);\n throw error;\n } finally {\n await mcpClient?.close();\n console.info('Connection closed.');\n }\n};\n\nmain();\n"],"mappings":";;;AAEA,MAAM,OAAO,YAAY;CACvB,MAAM,eAAe,QAAQ,IAAI,kBAAkB;CAEnD,QAAQ,KAAK,0BAA0B,eAAe;CAEtD,IAAI;CACJ,IAAI;EACF,YAAY,MAAM,gBAAgB,EAChC,WAAW;GACT,MAAM;GACN,KAAK;GACN,EACF,CAAC;EACF,QAAQ,KAAK,0BAA0B;EAEvC,MAAM,IAAI,SAAe,YAAY;GACnC,QAAQ,KAAK,UAAU,QAAQ;GAC/B,QAAQ,KAAK,WAAW,QAAQ;IAChC;UACK,OAAO;EACd,QAAQ,MAAM,qCAAqC,MAAM;EACzD,MAAM;WACE;EACR,MAAM,WAAW,OAAO;EACxB,QAAQ,KAAK,qBAAqB;;;AAItC,MAAM"}
1
+ {"version":3,"file":"sse.mjs","names":[],"sources":["../../../src/client/sse.ts"],"sourcesContent":["import { createMCPClient, type MCPClient } from '@ai-sdk/mcp';\n\nconst main = async () => {\n const mcpServerURL = process.env.MCP_SERVER_URL ?? 'http://localhost:3000/';\n\n console.info(`Connecting to server - ${mcpServerURL}`);\n\n let mcpClient: MCPClient | undefined;\n try {\n mcpClient = await createMCPClient({\n transport: {\n type: 'http',\n url: mcpServerURL,\n },\n });\n console.info('Connected to MCP server');\n\n await new Promise<void>((resolve) => {\n process.once('SIGINT', resolve);\n process.once('SIGTERM', resolve);\n });\n } catch (error) {\n console.error('Failed to connect to MCP server: ', error);\n throw error;\n } finally {\n await mcpClient?.close();\n console.info('Connection closed.');\n }\n};\n\nmain();\n"],"mappings":";;;AAEA,MAAM,OAAO,YAAY;CACvB,MAAM,eAAe,QAAQ,IAAI,kBAAkB;CAEnD,QAAQ,KAAK,0BAA0B,cAAc;CAErD,IAAI;CACJ,IAAI;EACF,YAAY,MAAM,gBAAgB,EAChC,WAAW;GACT,MAAM;GACN,KAAK;EACP,EACF,CAAC;EACD,QAAQ,KAAK,yBAAyB;EAEtC,MAAM,IAAI,SAAe,YAAY;GACnC,QAAQ,KAAK,UAAU,OAAO;GAC9B,QAAQ,KAAK,WAAW,OAAO;EACjC,CAAC;CACH,SAAS,OAAO;EACd,QAAQ,MAAM,qCAAqC,KAAK;EACxD,MAAM;CACR,UAAU;EACR,MAAM,WAAW,MAAM;EACvB,QAAQ,KAAK,oBAAoB;CACnC;AACF;AAEA,KAAK"}
@@ -3,10 +3,10 @@ import { loadAPITools } from "../tools/api.mjs";
3
3
  import { loadInstallSkillsTool } from "../tools/installSkills.mjs";
4
4
  import { loadDocsTools } from "../tools/docs.mjs";
5
5
  import { dirname as dirname$1, resolve } from "node:path";
6
- import { fileURLToPath } from "node:url";
7
- import { isESModule } from "@intlayer/config/utils";
8
6
  import z from "zod";
9
7
  import { readFileSync } from "node:fs";
8
+ import { fileURLToPath } from "node:url";
9
+ import { isESModule } from "@intlayer/config/utils";
10
10
 
11
11
  //#region src/server/server.ts
12
12
  const dirname = isESModule ? dirname$1(fileURLToPath(import.meta.url)) : __dirname;
@@ -1 +1 @@
1
- {"version":3,"file":"server.mjs","names":["pathDirname"],"sources":["../../../src/server/server.ts"],"sourcesContent":["import { readFileSync } from 'node:fs';\nimport { dirname as pathDirname, resolve } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { isESModule } from '@intlayer/config/utils';\nimport z from 'zod';\nimport { loadAPITools } from '../tools/api';\nimport { loadCLITools } from '../tools/cli';\nimport { loadDocsTools } from '../tools/docs';\nimport { loadInstallSkillsTool } from '../tools/installSkills';\n\nexport const dirname: string = isESModule\n ? pathDirname(fileURLToPath(import.meta.url))\n : __dirname;\n\nconst packageJson: Record<string, any> = JSON.parse(\n readFileSync(resolve(dirname, '../../../package.json'), 'utf8')\n);\n\ntype ToolResult = {\n content: { type: string; text: string }[];\n isError?: boolean;\n};\n\ntype StoredTool = {\n name: string;\n description?: string;\n annotations?: Record<string, any>;\n inputSchema: Record<string, any>;\n handler: (params: any) => Promise<ToolResult>;\n};\n\nexport interface McpTransport {\n start(server: McpServer): Promise<void>;\n}\n\nexport class McpServer {\n private readonly _tools = new Map<string, StoredTool>();\n private readonly _info: { name: string; version: string };\n\n constructor(info: { name: string; version: string }) {\n this._info = info;\n }\n\n registerTool(\n name: string,\n config: {\n title?: string;\n description?: string;\n inputSchema?: Record<string, any>;\n annotations?: Record<string, any>;\n },\n handler: (params: any) => Promise<ToolResult>\n ): void {\n const shape = config.inputSchema ?? {};\n let inputSchema: Record<string, any>;\n try {\n inputSchema = z.toJSONSchema(z.object(shape)) as Record<string, any>;\n } catch {\n inputSchema = { type: 'object', properties: {} };\n }\n this._tools.set(name, {\n name,\n description: config.description,\n annotations: config.annotations,\n inputSchema,\n handler,\n });\n }\n\n async handleMessage(message: any): Promise<any> {\n const { id, method, params } = message;\n const isNotification = id === undefined;\n\n switch (method) {\n case 'initialize':\n return {\n jsonrpc: '2.0',\n id,\n result: {\n protocolVersion: '2024-11-05',\n capabilities: { tools: {} },\n serverInfo: this._info,\n },\n };\n\n case 'tools/list':\n return {\n jsonrpc: '2.0',\n id,\n result: {\n tools: Array.from(this._tools.values()).map((t) => ({\n name: t.name,\n description: t.description,\n inputSchema: t.inputSchema,\n ...(t.annotations && { annotations: t.annotations }),\n })),\n },\n };\n\n case 'tools/call': {\n const { name, arguments: args } = params ?? {};\n const tool = this._tools.get(name);\n if (!tool) {\n if (isNotification) return null;\n return {\n jsonrpc: '2.0',\n id,\n error: { code: -32601, message: `Tool not found: ${name}` },\n };\n }\n try {\n const result = await tool.handler(args ?? {});\n if (isNotification) return null;\n return { jsonrpc: '2.0', id, result };\n } catch (error) {\n if (isNotification) return null;\n return {\n jsonrpc: '2.0',\n id,\n error: {\n code: -32000,\n message: error instanceof Error ? error.message : String(error),\n },\n };\n }\n }\n\n case 'ping':\n if (isNotification) return null;\n return { jsonrpc: '2.0', id, result: {} };\n\n default:\n if (isNotification) return null;\n return {\n jsonrpc: '2.0',\n id,\n error: { code: -32601, message: `Method not found: ${method}` },\n };\n }\n }\n\n async connect(transport: McpTransport): Promise<void> {\n await transport.start(this);\n }\n}\n\ntype LoadServer = (options: { isLocal: boolean }) => McpServer;\n\nexport const loadServer: LoadServer = ({ isLocal }) => {\n const server = new McpServer({\n name: 'intlayer',\n version: packageJson.version,\n });\n\n if (isLocal) {\n try {\n loadCLITools(server);\n loadInstallSkillsTool(server);\n } catch (error) {\n console.error('Error loading CLI tools:', error);\n }\n }\n\n try {\n loadDocsTools(server);\n } catch (error) {\n console.error('Error loading docs tools:', error);\n }\n\n try {\n loadAPITools(server);\n } catch (error) {\n console.error('Error loading API tools:', error);\n }\n\n return server;\n};\n"],"mappings":";;;;;;;;;;;AAUA,MAAa,UAAkB,aAC3BA,UAAY,cAAc,OAAO,KAAK,IAAI,CAAC,GAC3C;AAEJ,MAAM,cAAmC,KAAK,MAC5C,aAAa,QAAQ,SAAS,wBAAwB,EAAE,OAAO,CAChE;AAmBD,IAAa,YAAb,MAAuB;CACrB,AAAiB,yBAAS,IAAI,KAAyB;CACvD,AAAiB;CAEjB,YAAY,MAAyC;EACnD,KAAK,QAAQ;;CAGf,aACE,MACA,QAMA,SACM;EACN,MAAM,QAAQ,OAAO,eAAe,EAAE;EACtC,IAAI;EACJ,IAAI;GACF,cAAc,EAAE,aAAa,EAAE,OAAO,MAAM,CAAC;UACvC;GACN,cAAc;IAAE,MAAM;IAAU,YAAY,EAAE;IAAE;;EAElD,KAAK,OAAO,IAAI,MAAM;GACpB;GACA,aAAa,OAAO;GACpB,aAAa,OAAO;GACpB;GACA;GACD,CAAC;;CAGJ,MAAM,cAAc,SAA4B;EAC9C,MAAM,EAAE,IAAI,QAAQ,WAAW;EAC/B,MAAM,iBAAiB,OAAO;EAE9B,QAAQ,QAAR;GACE,KAAK,cACH,OAAO;IACL,SAAS;IACT;IACA,QAAQ;KACN,iBAAiB;KACjB,cAAc,EAAE,OAAO,EAAE,EAAE;KAC3B,YAAY,KAAK;KAClB;IACF;GAEH,KAAK,cACH,OAAO;IACL,SAAS;IACT;IACA,QAAQ,EACN,OAAO,MAAM,KAAK,KAAK,OAAO,QAAQ,CAAC,CAAC,KAAK,OAAO;KAClD,MAAM,EAAE;KACR,aAAa,EAAE;KACf,aAAa,EAAE;KACf,GAAI,EAAE,eAAe,EAAE,aAAa,EAAE,aAAa;KACpD,EAAE,EACJ;IACF;GAEH,KAAK,cAAc;IACjB,MAAM,EAAE,MAAM,WAAW,SAAS,UAAU,EAAE;IAC9C,MAAM,OAAO,KAAK,OAAO,IAAI,KAAK;IAClC,IAAI,CAAC,MAAM;KACT,IAAI,gBAAgB,OAAO;KAC3B,OAAO;MACL,SAAS;MACT;MACA,OAAO;OAAE,MAAM;OAAQ,SAAS,mBAAmB;OAAQ;MAC5D;;IAEH,IAAI;KACF,MAAM,SAAS,MAAM,KAAK,QAAQ,QAAQ,EAAE,CAAC;KAC7C,IAAI,gBAAgB,OAAO;KAC3B,OAAO;MAAE,SAAS;MAAO;MAAI;MAAQ;aAC9B,OAAO;KACd,IAAI,gBAAgB,OAAO;KAC3B,OAAO;MACL,SAAS;MACT;MACA,OAAO;OACL,MAAM;OACN,SAAS,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;OAChE;MACF;;;GAIL,KAAK;IACH,IAAI,gBAAgB,OAAO;IAC3B,OAAO;KAAE,SAAS;KAAO;KAAI,QAAQ,EAAE;KAAE;GAE3C;IACE,IAAI,gBAAgB,OAAO;IAC3B,OAAO;KACL,SAAS;KACT;KACA,OAAO;MAAE,MAAM;MAAQ,SAAS,qBAAqB;MAAU;KAChE;;;CAIP,MAAM,QAAQ,WAAwC;EACpD,MAAM,UAAU,MAAM,KAAK;;;AAM/B,MAAa,cAA0B,EAAE,cAAc;CACrD,MAAM,SAAS,IAAI,UAAU;EAC3B,MAAM;EACN,SAAS,YAAY;EACtB,CAAC;CAEF,IAAI,SACF,IAAI;EACF,aAAa,OAAO;EACpB,sBAAsB,OAAO;UACtB,OAAO;EACd,QAAQ,MAAM,4BAA4B,MAAM;;CAIpD,IAAI;EACF,cAAc,OAAO;UACd,OAAO;EACd,QAAQ,MAAM,6BAA6B,MAAM;;CAGnD,IAAI;EACF,aAAa,OAAO;UACb,OAAO;EACd,QAAQ,MAAM,4BAA4B,MAAM;;CAGlD,OAAO"}
1
+ {"version":3,"file":"server.mjs","names":["pathDirname"],"sources":["../../../src/server/server.ts"],"sourcesContent":["import { readFileSync } from 'node:fs';\nimport { dirname as pathDirname, resolve } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport { isESModule } from '@intlayer/config/utils';\nimport z from 'zod';\nimport { loadAPITools } from '../tools/api';\nimport { loadCLITools } from '../tools/cli';\nimport { loadDocsTools } from '../tools/docs';\nimport { loadInstallSkillsTool } from '../tools/installSkills';\n\nexport const dirname: string = isESModule\n ? pathDirname(fileURLToPath(import.meta.url))\n : __dirname;\n\nconst packageJson: Record<string, any> = JSON.parse(\n readFileSync(resolve(dirname, '../../../package.json'), 'utf8')\n);\n\ntype ToolResult = {\n content: { type: string; text: string }[];\n isError?: boolean;\n};\n\ntype StoredTool = {\n name: string;\n description?: string;\n annotations?: Record<string, any>;\n inputSchema: Record<string, any>;\n handler: (params: any) => Promise<ToolResult>;\n};\n\nexport interface McpTransport {\n start(server: McpServer): Promise<void>;\n}\n\nexport class McpServer {\n private readonly _tools = new Map<string, StoredTool>();\n private readonly _info: { name: string; version: string };\n\n constructor(info: { name: string; version: string }) {\n this._info = info;\n }\n\n registerTool(\n name: string,\n config: {\n title?: string;\n description?: string;\n inputSchema?: Record<string, any>;\n annotations?: Record<string, any>;\n },\n handler: (params: any) => Promise<ToolResult>\n ): void {\n const shape = config.inputSchema ?? {};\n let inputSchema: Record<string, any>;\n try {\n inputSchema = z.toJSONSchema(z.object(shape)) as Record<string, any>;\n } catch {\n inputSchema = { type: 'object', properties: {} };\n }\n this._tools.set(name, {\n name,\n description: config.description,\n annotations: config.annotations,\n inputSchema,\n handler,\n });\n }\n\n async handleMessage(message: any): Promise<any> {\n const { id, method, params } = message;\n const isNotification = id === undefined;\n\n switch (method) {\n case 'initialize':\n return {\n jsonrpc: '2.0',\n id,\n result: {\n protocolVersion: '2024-11-05',\n capabilities: { tools: {} },\n serverInfo: this._info,\n },\n };\n\n case 'tools/list':\n return {\n jsonrpc: '2.0',\n id,\n result: {\n tools: Array.from(this._tools.values()).map((t) => ({\n name: t.name,\n description: t.description,\n inputSchema: t.inputSchema,\n ...(t.annotations && { annotations: t.annotations }),\n })),\n },\n };\n\n case 'tools/call': {\n const { name, arguments: args } = params ?? {};\n const tool = this._tools.get(name);\n if (!tool) {\n if (isNotification) return null;\n return {\n jsonrpc: '2.0',\n id,\n error: { code: -32601, message: `Tool not found: ${name}` },\n };\n }\n try {\n const result = await tool.handler(args ?? {});\n if (isNotification) return null;\n return { jsonrpc: '2.0', id, result };\n } catch (error) {\n if (isNotification) return null;\n return {\n jsonrpc: '2.0',\n id,\n error: {\n code: -32000,\n message: error instanceof Error ? error.message : String(error),\n },\n };\n }\n }\n\n case 'ping':\n if (isNotification) return null;\n return { jsonrpc: '2.0', id, result: {} };\n\n default:\n if (isNotification) return null;\n return {\n jsonrpc: '2.0',\n id,\n error: { code: -32601, message: `Method not found: ${method}` },\n };\n }\n }\n\n async connect(transport: McpTransport): Promise<void> {\n await transport.start(this);\n }\n}\n\ntype LoadServer = (options: { isLocal: boolean }) => McpServer;\n\nexport const loadServer: LoadServer = ({ isLocal }) => {\n const server = new McpServer({\n name: 'intlayer',\n version: packageJson.version,\n });\n\n if (isLocal) {\n try {\n loadCLITools(server);\n loadInstallSkillsTool(server);\n } catch (error) {\n console.error('Error loading CLI tools:', error);\n }\n }\n\n try {\n loadDocsTools(server);\n } catch (error) {\n console.error('Error loading docs tools:', error);\n }\n\n try {\n loadAPITools(server);\n } catch (error) {\n console.error('Error loading API tools:', error);\n }\n\n return server;\n};\n"],"mappings":";;;;;;;;;;;AAUA,MAAa,UAAkB,aAC3BA,UAAY,cAAc,OAAO,KAAK,GAAG,CAAC,IAC1C;AAEJ,MAAM,cAAmC,KAAK,MAC5C,aAAa,QAAQ,SAAS,uBAAuB,GAAG,MAAM,CAChE;AAmBA,IAAa,YAAb,MAAuB;CACrB,AAAiB,yBAAS,IAAI,IAAwB;CACtD,AAAiB;CAEjB,YAAY,MAAyC;EACnD,KAAK,QAAQ;CACf;CAEA,aACE,MACA,QAMA,SACM;EACN,MAAM,QAAQ,OAAO,eAAe,CAAC;EACrC,IAAI;EACJ,IAAI;GACF,cAAc,EAAE,aAAa,EAAE,OAAO,KAAK,CAAC;EAC9C,QA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O;KAAE,SAAS;KAAO;KAAI,QAAQ,CAAC;IAAE;GAE1C;IACE,IAAI,gBAAgB,OAAO;IAC3B,OAAO;KACL,SAAS;KACT;KACA,OAAO;MAAE,MAAM;MAAQ,SAAS,qBAAqB;KAAS;IAChE;EACJ;CACF;CAEA,MAAM,QAAQ,WAAwC;EACpD,MAAM,UAAU,MAAM,IAAI;CAC5B;AACF;AAIA,MAAa,cAA0B,EAAE,cAAc;CACrD,MAAM,SAAS,IAAI,UAAU;EAC3B,MAAM;EACN,SAAS,YAAY;CACvB,CAAC;CAED,IAAI,SACF,IAAI;EACF,aAAa,MAAM;EACnB,sBAAsB,MAAM;CAC9B,SAAS,OAAO;EACd,QAAQ,MAAM,4BAA4B,KAAK;CACjD;CAGF,IAAI;EACF,cAAc,MAAM;CACtB,SAAS,OAAO;EACd,QAAQ,MAAM,6BAA6B,KAAK;CAClD;CAEA,IAAI;EACF,aAAa,MAAM;CACrB,SAAS,OAAO;EACd,QAAQ,MAAM,4BAA4B,KAAK;CACjD;CAEA,OAAO;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"sse.mjs","names":[],"sources":["../../../src/server/sse.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { randomUUID } from 'node:crypto';\nimport fastifyCors from '@fastify/cors';\nimport fastifyHelmet from '@fastify/helmet';\nimport dotenv from 'dotenv';\nimport Fastify from 'fastify';\nimport { loadServer, type McpServer } from './server';\n\nconst startServer = async () => {\n const app = Fastify();\n\n const env = process.env.NODE_ENV || 'development';\n\n dotenv.config({\n path: [`.env.${env}.local`, `.env.${env}`, '.env.local', '.env'],\n quiet: true,\n });\n\n await app.register(fastifyHelmet, {\n contentSecurityPolicy: false,\n global: true,\n });\n\n await app.register(fastifyCors, {\n origin: '*',\n methods: ['GET', 'POST', 'DELETE', 'OPTIONS'],\n allowedHeaders: ['Content-Type', 'mcp-session-id'],\n });\n\n const sessions = new Map<string, McpServer>();\n\n app.post('/', async (request, reply) => {\n const sessionId = request.headers['mcp-session-id'] as string | undefined;\n\n let server: McpServer;\n let currentSessionId: string;\n\n if (sessionId && sessions.has(sessionId)) {\n server = sessions.get(sessionId)!;\n currentSessionId = sessionId;\n } else if (!sessionId) {\n currentSessionId = randomUUID();\n server = loadServer({ isLocal: false });\n sessions.set(currentSessionId, server);\n reply.header('mcp-session-id', currentSessionId);\n } else {\n return reply.status(400).send({ messages: 'Bad session id.' });\n }\n\n try {\n const response = await server.handleMessage(request.body);\n if (response !== null && response !== undefined) {\n return reply.send(response);\n }\n return reply.status(202).send();\n } catch (error) {\n return reply.status(500).send({\n jsonrpc: '2.0',\n id: (request.body as any)?.id ?? null,\n error: { code: -32000, message: ['Internal server error', error] },\n });\n }\n });\n\n app.get('/', async (request, reply) => {\n const sessionId = request.headers['mcp-session-id'] as string | undefined;\n if (!sessionId || !sessions.has(sessionId)) {\n return reply.status(400).send({ messages: 'Bad session id.' });\n }\n return reply.status(200).send();\n });\n\n app.delete('/', async (request, reply) => {\n const sessionId = request.headers['mcp-session-id'] as string | undefined;\n if (!sessionId || !sessions.has(sessionId)) {\n return reply.status(400).send({ messages: 'Bad session id.' });\n }\n sessions.delete(sessionId);\n return reply.status(200).send();\n });\n\n app.get('/health', async (_request, reply) => {\n return reply.send('OK');\n });\n\n const PORT = Number(process.env.PORT) || 3000;\n await app.listen({ port: PORT, host: '0.0.0.0' });\n console.info(`MCP Streamable HTTP Server listening on port ${PORT}`);\n};\n\nstartServer();\n"],"mappings":";;;;;;;;;AASA,MAAM,cAAc,YAAY;CAC9B,MAAM,MAAM,SAAS;CAErB,MAAM;CAEN,OAAO,OAAO;EACZ,MAAM;GAAC,QAAQ,IAAI;GAAS,QAAQ;GAAO;GAAc;GAAO;EAChE,OAAO;EACR,CAAC;CAEF,MAAM,IAAI,SAAS,eAAe;EAChC,uBAAuB;EACvB,QAAQ;EACT,CAAC;CAEF,MAAM,IAAI,SAAS,aAAa;EAC9B,QAAQ;EACR,SAAS;GAAC;GAAO;GAAQ;GAAU;GA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,IAAI,CAAC,KAAK,EAAE,UAAU,mBAAmB,CAAC;EAEhE,SAAS,OAAO,UAAU;EAC1B,OAAO,MAAM,OAAO,IAAI,CAAC,MAAM;GAC/B;CAEF,IAAI,IAAI,WAAW,OAAO,UAAU,UAAU;EAC5C,OAAO,MAAM,KAAK,KAAK;GACvB;CAEF,MAAM,OAAO,OAAO,QAAQ,IAAI,KAAK,IAAI;CACzC,MAAM,IAAI,OAAO;EAAE,MAAM;EAAM,MAAM;EAAW,CAAC;CACjD,QAAQ,KAAK,gDAAgD,OAAO;;AAGtE,aAAa"}
1
+ {"version":3,"file":"sse.mjs","names":[],"sources":["../../../src/server/sse.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { randomUUID } from 'node:crypto';\nimport fastifyCors from '@fastify/cors';\nimport fastifyHelmet from '@fastify/helmet';\nimport dotenv from 'dotenv';\nimport Fastify from 'fastify';\nimport { loadServer, type McpServer } from './server';\n\nconst startServer = async () => {\n const app = Fastify();\n\n const env = process.env.NODE_ENV || 'development';\n\n dotenv.config({\n path: [`.env.${env}.local`, `.env.${env}`, '.env.local', '.env'],\n quiet: true,\n });\n\n await app.register(fastifyHelmet, {\n contentSecurityPolicy: false,\n global: true,\n });\n\n await app.register(fastifyCors, {\n origin: '*',\n methods: ['GET', 'POST', 'DELETE', 'OPTIONS'],\n allowedHeaders: ['Content-Type', 'mcp-session-id'],\n });\n\n const sessions = new Map<string, McpServer>();\n\n app.post('/', async (request, reply) => {\n const sessionId = request.headers['mcp-session-id'] as string | undefined;\n\n let server: McpServer;\n let currentSessionId: string;\n\n if (sessionId && sessions.has(sessionId)) {\n server = sessions.get(sessionId)!;\n currentSessionId = sessionId;\n } else if (!sessionId) {\n currentSessionId = randomUUID();\n server = loadServer({ isLocal: false });\n sessions.set(currentSessionId, server);\n reply.header('mcp-session-id', currentSessionId);\n } else {\n return reply.status(400).send({ messages: 'Bad session id.' });\n }\n\n try {\n const response = await server.handleMessage(request.body);\n if (response !== null && response !== undefined) {\n return reply.send(response);\n }\n return reply.status(202).send();\n } catch (error) {\n return reply.status(500).send({\n jsonrpc: '2.0',\n id: (request.body as any)?.id ?? null,\n error: { code: -32000, message: ['Internal server error', error] },\n });\n }\n });\n\n app.get('/', async (request, reply) => {\n const sessionId = request.headers['mcp-session-id'] as string | undefined;\n if (!sessionId || !sessions.has(sessionId)) {\n return reply.status(400).send({ messages: 'Bad session id.' });\n }\n return reply.status(200).send();\n });\n\n app.delete('/', async (request, reply) => {\n const sessionId = request.headers['mcp-session-id'] as string | undefined;\n if (!sessionId || !sessions.has(sessionId)) {\n return reply.status(400).send({ messages: 'Bad session id.' });\n }\n sessions.delete(sessionId);\n return reply.status(200).send();\n });\n\n app.get('/health', async (_request, reply) => {\n return reply.send('OK');\n });\n\n const PORT = Number(process.env.PORT) || 3000;\n await app.listen({ port: PORT, host: '0.0.0.0' });\n console.info(`MCP Streamable HTTP Server listening on port ${PORT}`);\n};\n\nstartServer();\n"],"mappings":";;;;;;;;;AASA,MAAM,cAAc,YAAY;CAC9B,MAAM,MAAM,QAAQ;CAEpB,MAAM;CAEN,OAAO,OAAO;EACZ,MAAM;GAAC,QAAQ,IAAI;GAAS,QAAQ;GAAO;GAAc;EAAM;EAC/D,OAAO;CACT,CAAC;CAED,MAAM,IAAI,SAAS,eAAe;EAChC,uBAAuB;EACvB,QAAQ;CACV,CAAC;CAED,MAAM,IAAI,SAAS,aAAa;EAC9B,QAAQ;EACR,SAAS;GAAC;GAAO;GAAQ;GAAU;EAAS;EAC5C,gBAAgB,CAAC,gBAAgB,gBAAgB;CACnD,CAAC;CAED,MAAM,2BAAW,IAAI,IAAuB;CAE5C,IAAI,KAAK,KAAK,OAAO,SAAS,UAAU;EACtC,MAAM,YAAY,QAAQ,QAAQ;EAElC,IAAI;EACJ,IAAI;EAEJ,IAAI,aAAa,SAAS,IAAI,SAAS,GAAG;GACxC,SAAS,SAAS,IAAI,SAAS;GAC/B,mBAAmB;EACrB,OAAO,IAAI,CAAC,WAAW;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AAO;EAAE,MAAM;EAAM,MAAM;CAAU,CAAC;CAChD,QAAQ,KAAK,gDAAgD,MAAM;AACrE;AAEA,YAAY"}
@@ -1 +1 @@
1
- {"version":3,"file":"stdio.mjs","names":[],"sources":["../../../src/server/stdio.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport * as readline from 'node:readline';\nimport { loadServer, type McpServer, type McpTransport } from './server';\n\nclass StdioTransport implements McpTransport {\n async start(server: McpServer): Promise<void> {\n const rl = readline.createInterface({\n input: process.stdin,\n terminal: false,\n });\n\n const send = (message: any) => {\n process.stdout.write(`${JSON.stringify(message)}\\n`);\n };\n\n rl.on('line', async (line) => {\n const trimmed = line.trim();\n if (!trimmed) return;\n try {\n const message = JSON.parse(trimmed);\n const response = await server.handleMessage(message);\n if (response !== null && response !== undefined) {\n send(response);\n }\n } catch {\n send({\n jsonrpc: '2.0',\n id: null,\n error: { code: -32700, message: 'Parse error' },\n });\n }\n });\n\n console.error('Intlayer MCP Server running on stdio');\n\n await new Promise<void>((resolve) => {\n rl.on('close', resolve);\n });\n }\n}\n\nconst server = loadServer({ isLocal: true });\n\nconst main = async () => {\n const transport = new StdioTransport();\n await server.connect(transport);\n};\n\nmain().catch((error) => {\n console.error('Fatal error in main():', error);\n process.exit(1);\n});\n"],"mappings":";;;;;AAKA,IAAM,iBAAN,MAA6C;CAC3C,MAAM,MAAM,QAAkC;EAC5C,MAAM,KAAK,SAAS,gBAAgB;GAClC,OAAO,QAAQ;GACf,UAAU;GACX,CAAC;EAEF,MAAM,QAAQ,YAAiB;GAC7B,QAAQ,OAAO,MAAM,GAAG,KAAK,UAAU,QAAQ,CAAC,IAAI;;EAGtD,GAAG,GAAG,QAAQ,OAAO,SAAS;GAC5B,MAAM,UAAU,KAAK,MAAM;GAC3B,IAAI,CAAC,SAAS;GACd,IAAI;IACF,MAAM,UAAU,KAAK,MAAM,QAAQ;IACnC,MAAM,WAAW,MAAM,OAAO,cAAc,QAAQ;IACpD,IAAI,aAAa,QAAQ,aAAa,QACpC,KAAK,SAAS;WAEV;IACN,KAAK;KACH,SAAS;KACT,IAAI;KACJ,OAAO;MAAE,MAAM;MAAQ,SAAS;MAAe;KAChD,CAAC;;IAEJ;EAEF,QAAQ,MAAM,uCAAuC;EAErD,MAAM,IAAI,SAAe,YAAY;GACnC,GAAG,GAAG,SAAS,QAAQ;IACvB;;;AAIN,MAAM,SAAS,WAAW,EAAE,SAAS,MAAM,CAAC;AAE5C,MAAM,OAAO,YAAY;CACvB,MAAM,YAAY,IAAI,gBAAgB;CACtC,MAAM,OAAO,QAAQ,UAAU;;AAGjC,MAAM,CAAC,OAAO,UAAU;CACtB,QAAQ,MAAM,0BAA0B,MAAM;CAC9C,QAAQ,KAAK,EAAE;EACf"}
1
+ {"version":3,"file":"stdio.mjs","names":[],"sources":["../../../src/server/stdio.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport * as readline from 'node:readline';\nimport { loadServer, type McpServer, type McpTransport } from './server';\n\nclass StdioTransport implements McpTransport {\n async start(server: McpServer): Promise<void> {\n const rl = readline.createInterface({\n input: process.stdin,\n terminal: false,\n });\n\n const send = (message: any) => {\n process.stdout.write(`${JSON.stringify(message)}\\n`);\n };\n\n rl.on('line', async (line) => {\n const trimmed = line.trim();\n if (!trimmed) return;\n try {\n const message = JSON.parse(trimmed);\n const response = await server.handleMessage(message);\n if (response !== null && response !== undefined) {\n send(response);\n }\n } catch {\n send({\n jsonrpc: '2.0',\n id: null,\n error: { code: -32700, message: 'Parse error' },\n });\n }\n });\n\n console.error('Intlayer MCP Server running on stdio');\n\n await new Promise<void>((resolve) => {\n rl.on('close', resolve);\n });\n }\n}\n\nconst server = loadServer({ isLocal: true });\n\nconst main = async () => {\n const transport = new StdioTransport();\n await server.connect(transport);\n};\n\nmain().catch((error) => {\n console.error('Fatal error in main():', error);\n process.exit(1);\n});\n"],"mappings":";;;;;AAKA,IAAM,iBAAN,MAA6C;CAC3C,MAAM,MAAM,QAAkC;EAC5C,MAAM,KAAK,SAAS,gBAAgB;GAClC,OAAO,QAAQ;GACf,UAAU;EACZ,CAAC;EAED,MAAM,QAAQ,YAAiB;GAC7B,QAAQ,OAAO,MAAM,GAAG,KAAK,UAAU,OAAO,EAAE,GAAG;EACrD;EAEA,GAAG,GAAG,QAAQ,OAAO,SAAS;GAC5B,MAAM,UAAU,KAAK,KAAK;GAC1B,IAAI,CAAC,SAAS;GACd,IAAI;IACF,MAAM,UAAU,KAAK,MAAM,OAAO;IAClC,MAAM,WAAW,MAAM,OAAO,cAAc,OAAO;IACnD,IAAI,aAAa,QAAQ,aAAa,QACpC,KAAK,QAAQ;GAEjB,QAAQ;IACN,KAAK;KACH,SAAS;KACT,IAAI;KACJ,OAAO;MAAE,MAAM;MAAQ,SAAS;KAAc;IAChD,CAAC;GACH;EACF,CAAC;EAED,QAAQ,MAAM,sCAAsC;EAEpD,MAAM,IAAI,SAAe,YAAY;GACnC,GAAG,GAAG,SAAS,OAAO;EACxB,CAAC;CACH;AACF;AAEA,MAAM,SAAS,WAAW,EAAE,SAAS,KAAK,CAAC;AAE3C,MAAM,OAAO,YAAY;CACvB,MAAM,YAAY,IAAI,eAAe;CACrC,MAAM,OAAO,QAAQ,SAAS;AAChC;AAEA,KAAK,EAAE,OAAO,UAAU;CACtB,QAAQ,MAAM,0BAA0B,KAAK;CAC7C,QAAQ,KAAK,CAAC;AAChB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"api.mjs","names":[],"sources":["../../../src/tools/api.ts"],"sourcesContent":["import { getIntlayerAPI } from '@intlayer/api';\nimport { default as config } from '@intlayer/config/built';\nimport z from 'zod';\nimport type { McpServer } from './docs';\n\ntype LoadAPITools = (server: McpServer) => void;\n\nconst authSchema = {\n clientId: z\n .string()\n .optional()\n .describe(\n 'Intlayer OAuth2 client ID (access key). Falls back to INTLAYER_CLIENT_ID env var.'\n ),\n clientSecret: z\n .string()\n .optional()\n .describe(\n 'Intlayer OAuth2 client secret. Falls back to INTLAYER_CLIENT_SECRET env var.'\n ),\n};\n\nconst getAPI = async (clientId?: string, clientSecret?: string) => {\n const resolvedClientId = clientId ?? config.editor.clientId;\n const resolvedClientSecret = clientSecret ?? config.editor.clientSecret;\n\n if (!resolvedClientId || !resolvedClientSecret) {\n throw new Error(\n 'Intlayer credentials not found. Provide clientId/clientSecret or set INTLAYER_CLIENT_ID/INTLAYER_CLIENT_SECRET.'\n );\n }\n\n const configWithCreds = {\n ...config,\n editor: {\n ...config.editor,\n clientId: resolvedClientId,\n clientSecret: resolvedClientSecret,\n },\n };\n\n const tempAPI = getIntlayerAPI({}, configWithCreds);\n const tokenResult = await tempAPI.oAuth.getOAuth2AccessToken();\n const token = (tokenResult as any)?.data?.access_token as string | undefined;\n\n if (!token) {\n throw new Error(\n 'Failed to obtain OAuth2 access token. Check your credentials.'\n );\n }\n\n return getIntlayerAPI(\n { headers: { Authorization: `Bearer ${token}` } },\n config\n );\n};\n\nconst ok = (data: unknown) => ({\n content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }],\n});\n\nconst fail = (label: string, error: unknown) => ({\n content: [\n {\n type: 'text' as const,\n text: `${label} failed: ${error instanceof Error ? error.message : String(error)}`,\n },\n ],\n isError: true as const,\n});\n\nexport const loadAPITools: LoadAPITools = (server) => {\n // ── Dictionaries ──────────────────────────────────────────────────────────\n\n server.registerTool(\n 'intlayer-dictionaries-list',\n {\n title: 'List Dictionaries',\n description:\n 'List all dictionaries for the selected project. Returns keys, IDs, and metadata.',\n inputSchema: {\n ...authSchema,\n page: z.number().optional().describe('Page number (1-based)'),\n pageSize: z.number().optional().describe('Items per page'),\n },\n annotations: { readOnlyHint: true },\n },\n async ({ clientId, clientSecret, page, pageSize }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.dictionary.getDictionaries({\n page,\n pageSize,\n });\n return ok(result);\n } catch (error) {\n return fail('List dictionaries', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-dictionary-get',\n {\n title: 'Get Dictionary',\n description: 'Get a dictionary by its key, including its full content.',\n inputSchema: {\n ...authSchema,\n dictionaryKey: z.string().describe('The dictionary key'),\n },\n annotations: { readOnlyHint: true },\n },\n async ({ clientId, clientSecret, dictionaryKey }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.dictionary.getDictionary(dictionaryKey);\n return ok(result);\n } catch (error) {\n return fail('Get dictionary', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-dictionary-create',\n {\n title: 'Create Dictionary',\n description: 'Create a new dictionary in the selected project.',\n inputSchema: {\n ...authSchema,\n key: z.string().describe('Unique key for the dictionary'),\n title: z.string().optional().describe('Human-readable title'),\n description: z\n .string()\n .optional()\n .describe('Description of the dictionary'),\n content: z\n .record(z.string(), z.unknown())\n .optional()\n .describe('Initial content as JSON object'),\n },\n annotations: { destructiveHint: false },\n },\n async ({ clientId, clientSecret, key, title, description, content }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.dictionary.addDictionary({\n key,\n title,\n description,\n content,\n });\n return ok(result);\n } catch (error) {\n return fail('Create dictionary', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-dictionary-update',\n {\n title: 'Update Dictionary',\n description: 'Update an existing dictionary content or metadata.',\n inputSchema: {\n ...authSchema,\n id: z.string().describe('Dictionary ID'),\n key: z.string().optional().describe('New key for the dictionary'),\n title: z.string().optional().describe('New title'),\n description: z.string().optional().describe('New description'),\n content: z\n .record(z.string(), z.unknown())\n .optional()\n .describe('Updated content as JSON object'),\n },\n annotations: { destructiveHint: true },\n },\n async ({\n clientId,\n clientSecret,\n id,\n key,\n title,\n description,\n content,\n }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.dictionary.updateDictionary({\n id,\n key,\n title,\n description,\n content,\n });\n return ok(result);\n } catch (error) {\n return fail('Update dictionary', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-dictionary-delete',\n {\n title: 'Delete Dictionary',\n description:\n 'Delete a dictionary by its ID. This action is irreversible.',\n inputSchema: {\n ...authSchema,\n dictionaryId: z.string().describe('Dictionary ID to delete'),\n },\n annotations: { destructiveHint: true },\n },\n async ({ clientId, clientSecret, dictionaryId }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.dictionary.deleteDictionary(dictionaryId);\n return ok(result);\n } catch (error) {\n return fail('Delete dictionary', error);\n }\n }\n );\n\n // ── Tags ──────────────────────────────────────────────────────────────────\n\n server.registerTool(\n 'intlayer-tags-list',\n {\n title: 'List Tags',\n description: 'List all tags for the selected organization.',\n inputSchema: {\n ...authSchema,\n page: z.number().optional().describe('Page number (1-based)'),\n pageSize: z.number().optional().describe('Items per page'),\n },\n annotations: { readOnlyHint: true },\n },\n async ({ clientId, clientSecret, page, pageSize }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.tag.getTags({ page, pageSize });\n return ok(result);\n } catch (error) {\n return fail('List tags', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-tag-create',\n {\n title: 'Create Tag',\n description:\n 'Create a new tag in the organization. Tags can be used to group dictionaries and provide AI context.',\n inputSchema: {\n ...authSchema,\n key: z.string().describe('Unique tag key'),\n name: z.string().optional().describe('Display name for the tag'),\n description: z.string().optional().describe('Description of the tag'),\n color: z.string().optional().describe('Tag color (hex code)'),\n instructions: z\n .string()\n .optional()\n .describe('AI instructions to apply when this tag is used'),\n },\n annotations: { destructiveHint: false },\n },\n async ({\n clientId,\n clientSecret,\n key,\n name,\n description,\n color,\n instructions,\n }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.tag.addTag({\n key,\n name,\n description,\n color,\n instructions,\n });\n return ok(result);\n } catch (error) {\n return fail('Create tag', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-tag-update',\n {\n title: 'Update Tag',\n description: 'Update an existing tag.',\n inputSchema: {\n ...authSchema,\n tagId: z.string().describe('Tag ID to update'),\n key: z.string().optional().describe('New key'),\n name: z.string().optional().describe('New display name'),\n description: z.string().optional().describe('New description'),\n color: z.string().optional().describe('New color (hex code)'),\n instructions: z.string().optional().describe('New AI instructions'),\n },\n annotations: { destructiveHint: true },\n },\n async ({\n clientId,\n clientSecret,\n tagId,\n key,\n name,\n description,\n color,\n instructions,\n }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.tag.updateTag(tagId, {\n key,\n name,\n description,\n color,\n instructions,\n });\n return ok(result);\n } catch (error) {\n return fail('Update tag', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-tag-delete',\n {\n title: 'Delete Tag',\n description: 'Delete a tag by its ID.',\n inputSchema: {\n ...authSchema,\n tagId: z.string().describe('Tag ID to delete'),\n },\n annotations: { destructiveHint: true },\n },\n async ({ clientId, clientSecret, tagId }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.tag.deleteTag(tagId);\n return ok(result);\n } catch (error) {\n return fail('Delete tag', error);\n }\n }\n );\n\n // ── Organizations ─────────────────────────────────────────────────────────\n\n server.registerTool(\n 'intlayer-organizations-list',\n {\n title: 'List Organizations',\n description: 'List all organizations the authenticated user belongs to.',\n inputSchema: {\n ...authSchema,\n page: z.number().optional().describe('Page number (1-based)'),\n pageSize: z.number().optional().describe('Items per page'),\n },\n annotations: { readOnlyHint: true },\n },\n async ({ clientId, clientSecret, page, pageSize }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.organization.getOrganizations({\n page,\n pageSize,\n });\n return ok(result);\n } catch (error) {\n return fail('List organizations', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-organization-select',\n {\n title: 'Select Organization',\n description:\n 'Select an organization as the current active organization. Required before accessing organization-specific resources.',\n inputSchema: {\n ...authSchema,\n organizationId: z.string().describe('Organization ID to select'),\n },\n annotations: { destructiveHint: false },\n },\n async ({ clientId, clientSecret, organizationId }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result =\n await api.organization.selectOrganization(organizationId);\n return ok(result);\n } catch (error) {\n return fail('Select organization', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-organization-update',\n {\n title: 'Update Organization',\n description: 'Update the selected organization name or settings.',\n inputSchema: {\n ...authSchema,\n name: z.string().optional().describe('New organization name'),\n customInstructions: z\n .string()\n .optional()\n .describe('Custom AI instructions for this organization'),\n },\n annotations: { destructiveHint: true },\n },\n async ({ clientId, clientSecret, name, customInstructions }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.organization.updateOrganization({\n name,\n customInstructions,\n });\n return ok(result);\n } catch (error) {\n return fail('Update organization', error);\n }\n }\n );\n\n // ── Projects ──────────────────────────────────────────────────────────────\n\n server.registerTool(\n 'intlayer-cms-projects-list',\n {\n title: 'List CMS Projects',\n description:\n 'List all Intlayer CMS projects for the selected organization. These are server-side projects, not local project directories.',\n inputSchema: {\n ...authSchema,\n page: z.number().optional().describe('Page number (1-based)'),\n pageSize: z.number().optional().describe('Items per page'),\n },\n annotations: { readOnlyHint: true },\n },\n async ({ clientId, clientSecret, page, pageSize }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.project.getProjects({ page, pageSize });\n return ok(result);\n } catch (error) {\n return fail('List CMS projects', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-cms-project-select',\n {\n title: 'Select CMS Project',\n description:\n 'Select a CMS project as the current active project. Required before accessing project-specific dictionaries.',\n inputSchema: {\n ...authSchema,\n projectId: z.string().describe('Project ID to select'),\n },\n annotations: { destructiveHint: false },\n },\n async ({ clientId, clientSecret, projectId }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.project.selectProject(projectId);\n return ok(result);\n } catch (error) {\n return fail('Select CMS project', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-cms-project-create',\n {\n title: 'Create CMS Project',\n description: 'Create a new CMS project in the selected organization.',\n inputSchema: {\n ...authSchema,\n name: z.string().describe('Project name'),\n },\n annotations: { destructiveHint: false },\n },\n async ({ clientId, clientSecret, name }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.project.addProject({ name });\n return ok(result);\n } catch (error) {\n return fail('Create CMS project', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-cms-project-update',\n {\n title: 'Update CMS Project',\n description: 'Update the selected CMS project settings.',\n inputSchema: {\n ...authSchema,\n name: z.string().optional().describe('New project name'),\n },\n annotations: { destructiveHint: true },\n },\n async ({ clientId, clientSecret, name }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.project.updateProject({ name });\n return ok(result);\n } catch (error) {\n return fail('Update CMS project', error);\n }\n }\n );\n};\n"],"mappings":";;;;;AAOA,MAAM,aAAa;CACjB,UAAU,EACP,QAAQ,CACR,UAAU,CACV,SACC,oFACD;CACH,cAAc,EACX,QAAQ,CACR,UAAU,CACV,SACC,+EACD;CACJ;AAED,MAAM,SAAS,OAAO,UAAmB,iBAA0B;CACjE,MAAM,mBAAmB,YAAY,OAAO,OAAO;CACnD,MAAM,uBAAuB,gBAAgB,OAAO,OAAO;CAE3D,IAAI,CAAC,oBAAoB,CAAC,sBACxB,MAAM,IAAI,MACR,kHACD;CAcH,MAAM,SAAS,MAFC,eAAe,EAAE,EAAE;EARjC,GAAG;EACH,QAAQ;GACN,GAAG,OAAO;GACV,UAAU;GACV,cAAc;GACf;EAG+C,CACjB,CAAC,MAAM,sBAAsB,GAC1B,MAAM;CAE1C,IAAI,CAAC,OACH,MAAM,IAAI,MACR,gEACD;CAGH,OAAO,eACL,EAAE,SAAS,EAAE,eAAe,UAAU,SAAS,EAAE,EACjD,OACD;;AAGH,MAAM,MAAM,UAAmB,EAC7B,SAAS,CAAC;CAAE,MAAM;CAAiB,MAAM,KAAK,UAAU,MAAM,MAAM,EAAE;CAAE,CAAC,EAC1E;AAED,MAAM,QAAQ,OAAe,WAAoB;CAC/C,SAAS,CACP;EACE,MAAM;EACN,MAAM,GAAG,MAAM,WAAW,iBAAiB,QAAQ,MAAM,UAAU,OAAO,MAAM;EACjF,CACF;CACD,SAAS;CACV;AAED,MAAa,gBAA8B,WAAW;CAGpD,OAAO,aACL,8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AAU,CACxC;WACV,OAAO;GACd,OAAO,KAAK,sBAAsB,MAAM;;GAG7C;CAED,OAAO,aACL,+BACA;EACE,OAAO;EACP,aAAa;EACb,aAAa;GACX,GAAG;GACH,MAAM,EAAE,QAAQ,CAAC,SAAS,eAAe;GAC1C;EACD,aAAa,EAAE,iBAAiB,OAAO;EACxC,EACD,OAAO,EAAE,UAAU,cAAc,WAAW;EAC1C,IAAI;GAGF,OAAO,GAAG,OADW,MADH,OAAO,UAAU,aAAa,EACvB,QAAQ,WAAW,EAAE,MAAM,CAAC,CACpC;WACV,OAAO;GACd,OAAO,KAAK,sBAAsB,MAAM;;GAG7C;CAED,OAAO,aACL,+BACA;EACE,OAAO;EACP,aAAa;EACb,aAAa;GACX,GAAG;GACH,MAAM,EAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,mBAAmB;GACzD;EACD,aAAa,EAAE,iBAAiB,MAAM;EACvC,EACD,OAAO,EAAE,UAAU,cAAc,WAAW;EAC1C,IAAI;GAGF,OAAO,GAAG,OADW,MADH,OAAO,UAAU,aAAa,EACvB,QAAQ,cAAc,EAAE,MAAM,CAAC,CACvC;WACV,OAAO;GACd,OAAO,KAAK,sBAAsB,MAAM;;GAG7C"}
1
+ {"version":3,"file":"api.mjs","names":[],"sources":["../../../src/tools/api.ts"],"sourcesContent":["import { getIntlayerAPI } from '@intlayer/api';\nimport { default as config } from '@intlayer/config/built';\nimport z from 'zod';\nimport type { McpServer } from './docs';\n\ntype LoadAPITools = (server: McpServer) => void;\n\nconst authSchema = {\n clientId: z\n .string()\n .optional()\n .describe(\n 'Intlayer OAuth2 client ID (access key). Falls back to INTLAYER_CLIENT_ID env var.'\n ),\n clientSecret: z\n .string()\n .optional()\n .describe(\n 'Intlayer OAuth2 client secret. Falls back to INTLAYER_CLIENT_SECRET env var.'\n ),\n};\n\nconst getAPI = async (clientId?: string, clientSecret?: string) => {\n const resolvedClientId = clientId ?? config.editor.clientId;\n const resolvedClientSecret = clientSecret ?? config.editor.clientSecret;\n\n if (!resolvedClientId || !resolvedClientSecret) {\n throw new Error(\n 'Intlayer credentials not found. Provide clientId/clientSecret or set INTLAYER_CLIENT_ID/INTLAYER_CLIENT_SECRET.'\n );\n }\n\n const configWithCreds = {\n ...config,\n editor: {\n ...config.editor,\n clientId: resolvedClientId,\n clientSecret: resolvedClientSecret,\n },\n };\n\n const tempAPI = getIntlayerAPI({}, configWithCreds);\n const tokenResult = await tempAPI.oAuth.getOAuth2AccessToken();\n const token = (tokenResult as any)?.data?.access_token as string | undefined;\n\n if (!token) {\n throw new Error(\n 'Failed to obtain OAuth2 access token. Check your credentials.'\n );\n }\n\n return getIntlayerAPI(\n { headers: { Authorization: `Bearer ${token}` } },\n config\n );\n};\n\nconst ok = (data: unknown) => ({\n content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }],\n});\n\nconst fail = (label: string, error: unknown) => ({\n content: [\n {\n type: 'text' as const,\n text: `${label} failed: ${error instanceof Error ? error.message : String(error)}`,\n },\n ],\n isError: true as const,\n});\n\nexport const loadAPITools: LoadAPITools = (server) => {\n // ── Dictionaries ──────────────────────────────────────────────────────────\n\n server.registerTool(\n 'intlayer-dictionaries-list',\n {\n title: 'List Dictionaries',\n description:\n 'List all dictionaries for the selected project. Returns keys, IDs, and metadata.',\n inputSchema: {\n ...authSchema,\n page: z.number().optional().describe('Page number (1-based)'),\n pageSize: z.number().optional().describe('Items per page'),\n },\n annotations: { readOnlyHint: true },\n },\n async ({ clientId, clientSecret, page, pageSize }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.dictionary.getDictionaries({\n page,\n pageSize,\n });\n return ok(result);\n } catch (error) {\n return fail('List dictionaries', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-dictionary-get',\n {\n title: 'Get Dictionary',\n description: 'Get a dictionary by its key, including its full content.',\n inputSchema: {\n ...authSchema,\n dictionaryKey: z.string().describe('The dictionary key'),\n },\n annotations: { readOnlyHint: true },\n },\n async ({ clientId, clientSecret, dictionaryKey }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.dictionary.getDictionary(dictionaryKey);\n return ok(result);\n } catch (error) {\n return fail('Get dictionary', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-dictionary-create',\n {\n title: 'Create Dictionary',\n description: 'Create a new dictionary in the selected project.',\n inputSchema: {\n ...authSchema,\n key: z.string().describe('Unique key for the dictionary'),\n title: z.string().optional().describe('Human-readable title'),\n description: z\n .string()\n .optional()\n .describe('Description of the dictionary'),\n content: z\n .record(z.string(), z.unknown())\n .optional()\n .describe('Initial content as JSON object'),\n },\n annotations: { destructiveHint: false },\n },\n async ({ clientId, clientSecret, key, title, description, content }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.dictionary.addDictionary({\n key,\n title,\n description,\n content,\n });\n return ok(result);\n } catch (error) {\n return fail('Create dictionary', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-dictionary-update',\n {\n title: 'Update Dictionary',\n description: 'Update an existing dictionary content or metadata.',\n inputSchema: {\n ...authSchema,\n id: z.string().describe('Dictionary ID'),\n key: z.string().optional().describe('New key for the dictionary'),\n title: z.string().optional().describe('New title'),\n description: z.string().optional().describe('New description'),\n content: z\n .record(z.string(), z.unknown())\n .optional()\n .describe('Updated content as JSON object'),\n },\n annotations: { destructiveHint: true },\n },\n async ({\n clientId,\n clientSecret,\n id,\n key,\n title,\n description,\n content,\n }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.dictionary.updateDictionary({\n id,\n key,\n title,\n description,\n content,\n });\n return ok(result);\n } catch (error) {\n return fail('Update dictionary', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-dictionary-delete',\n {\n title: 'Delete Dictionary',\n description:\n 'Delete a dictionary by its ID. This action is irreversible.',\n inputSchema: {\n ...authSchema,\n dictionaryId: z.string().describe('Dictionary ID to delete'),\n },\n annotations: { destructiveHint: true },\n },\n async ({ clientId, clientSecret, dictionaryId }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.dictionary.deleteDictionary(dictionaryId);\n return ok(result);\n } catch (error) {\n return fail('Delete dictionary', error);\n }\n }\n );\n\n // ── Tags ──────────────────────────────────────────────────────────────────\n\n server.registerTool(\n 'intlayer-tags-list',\n {\n title: 'List Tags',\n description: 'List all tags for the selected organization.',\n inputSchema: {\n ...authSchema,\n page: z.number().optional().describe('Page number (1-based)'),\n pageSize: z.number().optional().describe('Items per page'),\n },\n annotations: { readOnlyHint: true },\n },\n async ({ clientId, clientSecret, page, pageSize }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.tag.getTags({ page, pageSize });\n return ok(result);\n } catch (error) {\n return fail('List tags', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-tag-create',\n {\n title: 'Create Tag',\n description:\n 'Create a new tag in the organization. Tags can be used to group dictionaries and provide AI context.',\n inputSchema: {\n ...authSchema,\n key: z.string().describe('Unique tag key'),\n name: z.string().optional().describe('Display name for the tag'),\n description: z.string().optional().describe('Description of the tag'),\n color: z.string().optional().describe('Tag color (hex code)'),\n instructions: z\n .string()\n .optional()\n .describe('AI instructions to apply when this tag is used'),\n },\n annotations: { destructiveHint: false },\n },\n async ({\n clientId,\n clientSecret,\n key,\n name,\n description,\n color,\n instructions,\n }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.tag.addTag({\n key,\n name,\n description,\n color,\n instructions,\n });\n return ok(result);\n } catch (error) {\n return fail('Create tag', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-tag-update',\n {\n title: 'Update Tag',\n description: 'Update an existing tag.',\n inputSchema: {\n ...authSchema,\n tagId: z.string().describe('Tag ID to update'),\n key: z.string().optional().describe('New key'),\n name: z.string().optional().describe('New display name'),\n description: z.string().optional().describe('New description'),\n color: z.string().optional().describe('New color (hex code)'),\n instructions: z.string().optional().describe('New AI instructions'),\n },\n annotations: { destructiveHint: true },\n },\n async ({\n clientId,\n clientSecret,\n tagId,\n key,\n name,\n description,\n color,\n instructions,\n }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.tag.updateTag(tagId, {\n key,\n name,\n description,\n color,\n instructions,\n });\n return ok(result);\n } catch (error) {\n return fail('Update tag', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-tag-delete',\n {\n title: 'Delete Tag',\n description: 'Delete a tag by its ID.',\n inputSchema: {\n ...authSchema,\n tagId: z.string().describe('Tag ID to delete'),\n },\n annotations: { destructiveHint: true },\n },\n async ({ clientId, clientSecret, tagId }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.tag.deleteTag(tagId);\n return ok(result);\n } catch (error) {\n return fail('Delete tag', error);\n }\n }\n );\n\n // ── Organizations ─────────────────────────────────────────────────────────\n\n server.registerTool(\n 'intlayer-organizations-list',\n {\n title: 'List Organizations',\n description: 'List all organizations the authenticated user belongs to.',\n inputSchema: {\n ...authSchema,\n page: z.number().optional().describe('Page number (1-based)'),\n pageSize: z.number().optional().describe('Items per page'),\n },\n annotations: { readOnlyHint: true },\n },\n async ({ clientId, clientSecret, page, pageSize }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.organization.getOrganizations({\n page,\n pageSize,\n });\n return ok(result);\n } catch (error) {\n return fail('List organizations', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-organization-select',\n {\n title: 'Select Organization',\n description:\n 'Select an organization as the current active organization. Required before accessing organization-specific resources.',\n inputSchema: {\n ...authSchema,\n organizationId: z.string().describe('Organization ID to select'),\n },\n annotations: { destructiveHint: false },\n },\n async ({ clientId, clientSecret, organizationId }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result =\n await api.organization.selectOrganization(organizationId);\n return ok(result);\n } catch (error) {\n return fail('Select organization', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-organization-update',\n {\n title: 'Update Organization',\n description: 'Update the selected organization name or settings.',\n inputSchema: {\n ...authSchema,\n name: z.string().optional().describe('New organization name'),\n customInstructions: z\n .string()\n .optional()\n .describe('Custom AI instructions for this organization'),\n },\n annotations: { destructiveHint: true },\n },\n async ({ clientId, clientSecret, name, customInstructions }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.organization.updateOrganization({\n name,\n customInstructions,\n });\n return ok(result);\n } catch (error) {\n return fail('Update organization', error);\n }\n }\n );\n\n // ── Projects ──────────────────────────────────────────────────────────────\n\n server.registerTool(\n 'intlayer-cms-projects-list',\n {\n title: 'List CMS Projects',\n description:\n 'List all Intlayer CMS projects for the selected organization. These are server-side projects, not local project directories.',\n inputSchema: {\n ...authSchema,\n page: z.number().optional().describe('Page number (1-based)'),\n pageSize: z.number().optional().describe('Items per page'),\n },\n annotations: { readOnlyHint: true },\n },\n async ({ clientId, clientSecret, page, pageSize }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.project.getProjects({ page, pageSize });\n return ok(result);\n } catch (error) {\n return fail('List CMS projects', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-cms-project-select',\n {\n title: 'Select CMS Project',\n description:\n 'Select a CMS project as the current active project. Required before accessing project-specific dictionaries.',\n inputSchema: {\n ...authSchema,\n projectId: z.string().describe('Project ID to select'),\n },\n annotations: { destructiveHint: false },\n },\n async ({ clientId, clientSecret, projectId }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.project.selectProject(projectId);\n return ok(result);\n } catch (error) {\n return fail('Select CMS project', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-cms-project-create',\n {\n title: 'Create CMS Project',\n description: 'Create a new CMS project in the selected organization.',\n inputSchema: {\n ...authSchema,\n name: z.string().describe('Project name'),\n },\n annotations: { destructiveHint: false },\n },\n async ({ clientId, clientSecret, name }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.project.addProject({ name });\n return ok(result);\n } catch (error) {\n return fail('Create CMS project', error);\n }\n }\n );\n\n server.registerTool(\n 'intlayer-cms-project-update',\n {\n title: 'Update CMS Project',\n description: 'Update the selected CMS project settings.',\n inputSchema: {\n ...authSchema,\n name: z.string().optional().describe('New project name'),\n },\n annotations: { destructiveHint: true },\n },\n async ({ clientId, clientSecret, name }) => {\n try {\n const api = await getAPI(clientId, clientSecret);\n const result = await api.project.updateProject({ name });\n return ok(result);\n } catch (error) {\n return fail('Update CMS project', error);\n }\n }\n );\n};\n"],"mappings":";;;;;AAOA,MAAM,aAAa;CACjB,UAAU,EACP,OAAO,EACP,SAAS,EACT,SACC,mFACF;CACF,cAAc,EACX,OAAO,EACP,SAAS,EACT,SACC,8EACF;AACJ;AAEA,MAAM,SAAS,OAAO,UAAmB,iBAA0B;CACjE,MAAM,mBAAmB,YAAY,OAAO,OAAO;CACnD,MAAM,uBAAuB,gBAAgB,OAAO,OAAO;CAE3D,IAAI,CAAC,oBAAoB,CAAC,sBACxB,MAAM,IAAI,MACR,iHACF;CAcF,MAAM,SAAS,MAFC,eAAe,CAAC,GAAG;EARjC,GAAG;EACH,QAAQ;GACN,GAAG,OAAO;GACV,UAAU;GACV,cAAc;EAChB;CAG+C,CACjB,EAAE,MAAM,qBAAqB,IACzB,MAAM;CAE1C,IAAI,CAAC,OACH,MAAM,IAAI,MACR,+DACF;CAGF,OAAO,eACL,EAAE,SAAS,EAAE,eAAe,UAAU,QAAQ,EAAE,GAChD,MACF;AACF;AAEA,MAAM,MAAM,UAAmB,EAC7B,SAAS,CAAC;CAAE,MAAM;CAAiB,MAAM,KAAK,UAAU,MAAM,MAAM,CAAC;AAAE,CAAC,EAC1E;AAEA,MAAM,QAAQ,OAAe,WAAoB;CAC/C,SAAS,CACP;EACE,MAAM;EACN,MAAM,GAAG,MAAM,WAAW,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;CACjF,CACF;CACA,SAAS;AACX;AAEA,MAAa,gBAA8B,WAAW;CAGpD,OAAO,aACL,8BACA;EACE,OAAO;EACP,aACE;EACF,aAAa;GACX,GAAG;GACH,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,uBAAuB;GA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AAO,GAAG,OADW,MADH,OAAO,UAAU,YAAY,GACtB,QAAQ,cAAc,SAAS,CACxC;EAClB,SAAS,OAAO;GACd,OAAO,KAAK,sBAAsB,KAAK;EACzC;CACF,CACF;CAEA,OAAO,aACL,+BACA;EACE,OAAO;EACP,aAAa;EACb,aAAa;GACX,GAAG;GACH,MAAM,EAAE,OAAO,EAAE,SAAS,cAAc;EAC1C;EACA,aAAa,EAAE,iBAAiB,MAAM;CACxC,GACA,OAAO,EAAE,UAAU,cAAc,WAAW;EAC1C,IAAI;GAGF,OAAO,GAAG,OADW,MADH,OAAO,UAAU,YAAY,GACtB,QAAQ,WAAW,EAAE,KAAK,CAAC,CACpC;EAClB,SAAS,OAAO;GACd,OAAO,KAAK,sBAAsB,KAAK;EACzC;CACF,CACF;CAEA,OAAO,aACL,+BACA;EACE,OAAO;EACP,aAAa;EACb,aAAa;GACX,GAAG;GACH,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,kBAAkB;EACzD;EACA,aAAa,EAAE,iBAAiB,KAAK;CACvC,GACA,OAAO,EAAE,UAAU,cAAc,WAAW;EAC1C,IAAI;GAGF,OAAO,GAAG,OADW,MADH,OAAO,UAAU,YAAY,GACtB,QAAQ,cAAc,EAAE,KAAK,CAAC,CACvC;EAClB,SAAS,OAAO;GACd,OAAO,KAAK,sBAAsB,KAAK;EACzC;CACF,CACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"cli.mjs","names":[],"sources":["../../../src/tools/cli.ts"],"sourcesContent":["import { relative } from 'node:path';\nimport { listProjects } from '@intlayer/chokidar/cli';\nimport {\n build,\n extract,\n fill,\n init,\n listContentDeclarationRows,\n listMissingTranslations,\n pull,\n push,\n} from '@intlayer/cli';\nimport { ALL_LOCALES } from '@intlayer/types/allLocales';\nimport z from 'zod';\nimport type { McpServer } from './docs';\n\nconst configOptionsSchema = z\n .object({\n baseDir: z.string().optional().describe('Base directory for the project'),\n env: z.string().optional().describe('Environment name'),\n envFile: z.string().optional().describe('Path to the environment file'),\n override: z\n .object({\n editor: z\n .object({\n clientId: z.string().optional().describe('Intlayer CMS client ID'),\n clientSecret: z\n .string()\n .optional()\n .describe('Intlayer CMS client secret'),\n backendURL: z\n .string()\n .optional()\n .describe('Intlayer CMS backend URL'),\n })\n .optional(),\n internationalization: z\n .object({\n locales: z\n .array(z.nativeEnum(ALL_LOCALES))\n .optional()\n .describe('Available locales'),\n defaultLocale: z\n .nativeEnum(ALL_LOCALES)\n .optional()\n .describe('Default locale'),\n })\n .optional(),\n log: z\n .object({\n mode: z\n .enum(['default', 'verbose', 'disabled'])\n .optional()\n .describe('Log mode'),\n prefix: z.string().optional().describe('Log prefix'),\n })\n .optional(),\n })\n .optional()\n .describe(\n 'Config override - use when running remotely or without a local config file'\n ),\n })\n .optional()\n .describe(\n 'Configuration options. Required when running remotely or when no intlayer config file is present'\n );\n\ntype LoadCLITools = (server: McpServer) => Promise<void>;\n\nexport const loadCLITools: LoadCLITools = async (server) => {\n server.registerTool(\n 'intlayer-init',\n {\n title: 'Initialize Intlayer',\n description: 'Initialize Intlayer in the project',\n inputSchema: {\n projectRoot: z.string().describe('Project root directory'),\n },\n annotations: {\n destructiveHint: true,\n },\n },\n async ({ projectRoot }) => {\n try {\n await init(projectRoot);\n\n return {\n content: [\n {\n type: 'text',\n text: 'Initialization successful.',\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Initialization failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'intlayer-build',\n {\n title: 'Build Dictionaries',\n description:\n 'Build the dictionaries. List all content declarations files `.content.{ts,tsx,js,json,...}` to update the content callable using the `useIntlayer` hook.',\n inputSchema: {\n watch: z.boolean().optional().describe('Watch for changes'),\n configOptions: configOptionsSchema,\n },\n annotations: {\n destructiveHint: true,\n },\n },\n async ({ watch, configOptions }) => {\n try {\n await build({ watch, configOptions });\n\n return {\n content: [\n {\n type: 'text',\n text: 'Build successful.',\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Build failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'intlayer-fill',\n {\n title: 'Fill Translations',\n description:\n 'Fill the dictionaries with missing translations / review translations using Intlayer servers',\n inputSchema: {\n sourceLocale: z\n .nativeEnum(ALL_LOCALES)\n .optional()\n .describe('Source locale'),\n outputLocales: z\n .union([\n z.nativeEnum(ALL_LOCALES),\n z.array(z.nativeEnum(ALL_LOCALES)),\n ])\n .optional()\n .describe('Output locales'),\n file: z\n .union([z.string(), z.array(z.string())])\n .optional()\n .describe('File path'),\n mode: z.enum(['complete', 'review']).optional().describe('Fill mode'),\n keys: z\n .union([z.string(), z.array(z.string())])\n .optional()\n .describe('Keys to include'),\n excludedKeys: z\n .union([z.string(), z.array(z.string())])\n .optional()\n .describe('Keys to exclude'),\n pathFilter: z\n .union([z.string(), z.array(z.string())])\n .optional()\n .describe('Path filter'),\n gitOptions: z\n .object({\n gitDiff: z.boolean().optional(),\n gitDiffBase: z.string().optional(),\n gitDiffCurrent: z.string().optional(),\n uncommitted: z.boolean().optional(),\n unpushed: z.boolean().optional(),\n untracked: z.boolean().optional(),\n })\n .optional()\n .describe('Git options'),\n aiOptions: z\n .object({\n provider: z.string().optional(),\n temperature: z.number().optional(),\n model: z.string().optional(),\n apiKey: z.string().optional(),\n customPrompt: z.string().optional(),\n applicationContext: z.string().optional(),\n })\n .optional()\n .describe('AI options'),\n configOptions: configOptionsSchema,\n },\n annotations: {\n destructiveHint: true,\n },\n },\n async (props) => {\n try {\n const { gitOptions, ...rest } = props;\n const fillOptions: any = { ...rest, gitOptions: undefined };\n\n if (gitOptions) {\n const { gitDiff, uncommitted, unpushed, untracked, ...restGit } =\n gitOptions;\n const mode = [];\n if (gitDiff) mode.push('gitDiff');\n if (uncommitted) mode.push('uncommitted');\n if (unpushed) mode.push('unpushed');\n if (untracked) mode.push('untracked');\n\n fillOptions.gitOptions = { ...restGit, mode };\n }\n\n await fill(fillOptions);\n\n return {\n content: [\n {\n type: 'text',\n text: 'Fill successful.',\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Fill failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'intlayer-push',\n {\n title: 'Push Dictionaries',\n description: 'Push local dictionaries to the server',\n inputSchema: {\n deleteLocaleDictionary: z\n .boolean()\n .optional()\n .describe('Delete local dictionary after push'),\n keepLocaleDictionary: z\n .boolean()\n .optional()\n .describe('Keep local dictionary after push'),\n dictionaries: z\n .array(z.string())\n .optional()\n .describe('List of dictionaries to push'),\n gitOptions: z\n .object({\n gitDiff: z.boolean().optional(),\n gitDiffBase: z.string().optional(),\n gitDiffCurrent: z.string().optional(),\n uncommitted: z.boolean().optional(),\n unpushed: z.boolean().optional(),\n untracked: z.boolean().optional(),\n })\n .optional()\n .describe('Git options'),\n configOptions: configOptionsSchema,\n },\n annotations: {\n destructiveHint: true,\n },\n },\n async (props) => {\n try {\n const { gitOptions, ...rest } = props;\n const pushOptions: any = { ...rest, gitOptions: undefined };\n\n if (gitOptions) {\n const { gitDiff, uncommitted, unpushed, untracked, ...restGit } =\n gitOptions;\n const mode = [];\n if (gitDiff) mode.push('gitDiff');\n if (uncommitted) mode.push('uncommitted');\n if (unpushed) mode.push('unpushed');\n if (untracked) mode.push('untracked');\n\n pushOptions.gitOptions = { ...restGit, mode };\n }\n\n await push(pushOptions);\n\n return {\n content: [\n {\n type: 'text',\n text: 'Push successful.',\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Push failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'intlayer-pull',\n {\n title: 'Pull Dictionaries',\n description: 'Pull dictionaries from the CMS',\n inputSchema: {\n dictionaries: z\n .array(z.string())\n .optional()\n .describe('List of dictionaries to pull'),\n newDictionariesPath: z\n .string()\n .optional()\n .describe('Path to save new dictionaries'),\n configOptions: configOptionsSchema,\n },\n annotations: {\n destructiveHint: true,\n },\n },\n async (props) => {\n try {\n await pull(props);\n\n return {\n content: [\n {\n type: 'text',\n text: 'Pull successful.',\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Pull failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'intlayer-content-list',\n {\n title: 'List Content Declarations',\n description:\n 'List the content declaration (.content.{ts,tsx,js,json,...}) files present in the project. That files contain the multilingual content of the application and are used to build the dictionaries.',\n inputSchema: {\n configOptions: configOptionsSchema,\n absolute: z\n .boolean()\n .optional()\n .describe(\n 'Output the results as absolute paths instead of relative paths'\n ),\n json: z\n .boolean()\n .optional()\n .describe('Output the results as JSON instead of formatted text'),\n },\n annotations: {\n readOnlyHint: true,\n },\n },\n async (props) => {\n try {\n const rows = listContentDeclarationRows(props);\n return {\n content: [\n {\n type: 'text',\n text: props.json\n ? JSON.stringify(rows)\n : JSON.stringify(rows, null, 2),\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Content list failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'intlayer-content-test',\n {\n title: 'Test Translations',\n description:\n 'Test if there are missing translations in the content declaration files. That files contain the multilingual content of the application and are used to build the dictionaries.',\n inputSchema: {\n configOptions: configOptionsSchema,\n },\n annotations: {\n readOnlyHint: true,\n },\n },\n async (props) => {\n try {\n const missingTranslations = listMissingTranslations(\n props?.configOptions\n );\n return {\n content: [\n {\n type: 'text',\n text: JSON.stringify(missingTranslations, null, 2),\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Content test failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'intlayer-extract',\n {\n title: 'Extract strings from Component',\n description:\n 'Extract strings from an existing component to be placed in a .content file close to the component. Trigger this action to make an existing component multilingual. If the component does not exist, create a normal component including text in JSX, and then trigger this tool to extract it.',\n inputSchema: {\n file: z\n .union([z.string(), z.array(z.string())])\n .optional()\n .describe('List of files to extract'),\n outputContentDeclarations: z\n .string()\n .optional()\n .describe('Path to output content declaration files'),\n configOptions: configOptionsSchema,\n },\n annotations: {\n destructiveHint: true,\n },\n },\n async (props) => {\n try {\n await extract({\n files: Array.isArray(props.file)\n ? props.file\n : props.file\n ? [props.file]\n : undefined,\n configOptions: props.configOptions,\n });\n\n return {\n content: [\n {\n type: 'text',\n text: 'Extract successful.',\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Extract failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'intlayer-projects-list',\n {\n title: 'List Projects',\n description:\n 'List all Intlayer projects in the directory. Search for configuration files to find all Intlayer projects.',\n inputSchema: {\n baseDir: z\n .string()\n .optional()\n .describe('Base directory to search from'),\n gitRoot: z\n .boolean()\n .optional()\n .describe(\n 'Search from the git root directory instead of the base directory'\n ),\n absolute: z\n .boolean()\n .optional()\n .describe(\n 'Output the results as absolute paths instead of relative paths'\n ),\n json: z\n .boolean()\n .optional()\n .describe('Output the results as JSON instead of formatted text'),\n },\n annotations: {\n readOnlyHint: true,\n },\n },\n async (props) => {\n try {\n const { searchDir, projectsPath } = await listProjects({\n baseDir: props.baseDir,\n gitRoot: props.gitRoot,\n });\n\n const projectsRelativePath = projectsPath\n .map((projectPath) =>\n props.absolute ? projectPath : relative(searchDir, projectPath)\n )\n .map((projectPath) => (projectPath === '' ? '.' : projectPath));\n\n const outputPaths = props.absolute\n ? projectsPath\n : projectsRelativePath;\n\n return {\n content: [\n {\n type: 'text',\n text: props.json\n ? JSON.stringify(outputPaths)\n : JSON.stringify(\n { searchDir, projectsPath: outputPaths },\n null,\n 2\n ),\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Projects list failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n};\n"],"mappings":";;;;;;;AAgBA,MAAM,sBAAsB,EACzB,OAAO;CACN,SAAS,EAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,iCAAiC;CACzE,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,mBAAmB;CACvD,SAAS,EAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,+BAA+B;CACvE,UAAU,EACP,OAAO;EACN,QAAQ,EACL,OAAO;GACN,UAAU,EAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,yBAAyB;GAClE,cAAc,EACX,QAAQ,CACR,UAAU,CACV,SAAS,6BAA6B;GACzC,YAAY,EACT,QAAQ,CACR,UAAU,CACV,SAAS,2BAA2B;GACxC,CAAC,CACD,UAAU;EACb,sBAAsB,EACnB,OAAO;GACN,SAAS,EACN,MAAM,EAAE,WAAW,YAAY,CAAC,CAChC,UAAU,CACV,SAAS,oBAAoB;GAChC,eAAe,EACZ,WAAW,YAAY,CACvB,UAAU,CACV,SAAS,iBAAiB;GAC9B,CAAC,CACD,UAAU;EACb,KAAK,EACF,OAAO;GACN,MAAM,EACH,KAAK;IAAC;IAAW;IAAW;IAAW,CAAC,CACxC,UAAU,CACV,SAAS,WAAW;GACvB,QAAQ,EAAE,QAAQ,CAAC,UAAU,CAAC,SAAS,aAAa;GACrD,CAAC,CACD,UAAU;EACd,CAAC,CACD,UAAU,CACV,SACC,6EACD;CACJ,CAAC,CACD,UAAU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Q,CACR,UAAU,CACV,SAAS,gCAAgC;GAC5C,SAAS,EACN,SAAS,CACT,UAAU,CACV,SACC,mEACD;GACH,UAAU,EACP,SAAS,CACT,UAAU,CACV,SACC,iEACD;GACH,MAAM,EACH,SAAS,CACT,UAAU,CACV,SAAS,uDAAuD;GACpE;EACD,aAAa,EACX,cAAc,MACf;EACF,EACD,OAAO,UAAU;EACf,IAAI;GACF,MAAM,EAAE,WAAW,iBAAiB,MAAM,aAAa;IACrD,SAAS,MAAM;IACf,SAAS,MAAM;IAChB,CAAC;GAEF,MAAM,uBAAuB,aAC1B,KAAK,gBACJ,MAAM,WAAW,cAAc,SAAS,WAAW,YAAY,CAChE,CACA,KAAK,gBAAiB,gBAAgB,KAAK,MAAM,YAAa;GAEjE,MAAM,cAAc,MAAM,WACtB,eACA;GAEJ,OAAO,EACL,SAAS,CACP;IACE,MAAM;IACN,MAAM,MAAM,OACR,KAAK,UAAU,YAAY,GAC3B,KAAK,UACH;KAAE;KAAW,cAAc;KAAa,EACxC,MACA,EACD;IACN,CACF,EACF;WACM,OAAO;GAGd,OAAO,EACL,SAAS,CACP;IACE,MAAM;IACN,MAAM,yBALV,iBAAiB,QAAQ,MAAM,UAAU;IAMtC,CACF,EACF;;GAGN"}
1
+ {"version":3,"file":"cli.mjs","names":[],"sources":["../../../src/tools/cli.ts"],"sourcesContent":["import { relative } from 'node:path';\nimport { listProjects } from '@intlayer/chokidar/cli';\nimport {\n build,\n extract,\n fill,\n init,\n listContentDeclarationRows,\n listMissingTranslations,\n pull,\n push,\n} from '@intlayer/cli';\nimport { ALL_LOCALES } from '@intlayer/types/allLocales';\nimport z from 'zod';\nimport type { McpServer } from './docs';\n\nconst configOptionsSchema = z\n .object({\n baseDir: z.string().optional().describe('Base directory for the project'),\n env: z.string().optional().describe('Environment name'),\n envFile: z.string().optional().describe('Path to the environment file'),\n override: z\n .object({\n editor: z\n .object({\n clientId: z.string().optional().describe('Intlayer CMS client ID'),\n clientSecret: z\n .string()\n .optional()\n .describe('Intlayer CMS client secret'),\n backendURL: z\n .string()\n .optional()\n .describe('Intlayer CMS backend URL'),\n })\n .optional(),\n internationalization: z\n .object({\n locales: z\n .array(z.nativeEnum(ALL_LOCALES))\n .optional()\n .describe('Available locales'),\n defaultLocale: z\n .nativeEnum(ALL_LOCALES)\n .optional()\n .describe('Default locale'),\n })\n .optional(),\n log: z\n .object({\n mode: z\n .enum(['default', 'verbose', 'disabled'])\n .optional()\n .describe('Log mode'),\n prefix: z.string().optional().describe('Log prefix'),\n })\n .optional(),\n })\n .optional()\n .describe(\n 'Config override - use when running remotely or without a local config file'\n ),\n })\n .optional()\n .describe(\n 'Configuration options. Required when running remotely or when no intlayer config file is present'\n );\n\ntype LoadCLITools = (server: McpServer) => Promise<void>;\n\nexport const loadCLITools: LoadCLITools = async (server) => {\n server.registerTool(\n 'intlayer-init',\n {\n title: 'Initialize Intlayer',\n description: 'Initialize Intlayer in the project',\n inputSchema: {\n projectRoot: z.string().describe('Project root directory'),\n },\n annotations: {\n destructiveHint: true,\n },\n },\n async ({ projectRoot }) => {\n try {\n await init(projectRoot);\n\n return {\n content: [\n {\n type: 'text',\n text: 'Initialization successful.',\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Initialization failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'intlayer-build',\n {\n title: 'Build Dictionaries',\n description:\n 'Build the dictionaries. List all content declarations files `.content.{ts,tsx,js,json,...}` to update the content callable using the `useIntlayer` hook.',\n inputSchema: {\n watch: z.boolean().optional().describe('Watch for changes'),\n configOptions: configOptionsSchema,\n },\n annotations: {\n destructiveHint: true,\n },\n },\n async ({ watch, configOptions }) => {\n try {\n await build({ watch, configOptions });\n\n return {\n content: [\n {\n type: 'text',\n text: 'Build successful.',\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Build failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'intlayer-fill',\n {\n title: 'Fill Translations',\n description:\n 'Fill the dictionaries with missing translations / review translations using Intlayer servers',\n inputSchema: {\n sourceLocale: z\n .nativeEnum(ALL_LOCALES)\n .optional()\n .describe('Source locale'),\n outputLocales: z\n .union([\n z.nativeEnum(ALL_LOCALES),\n z.array(z.nativeEnum(ALL_LOCALES)),\n ])\n .optional()\n .describe('Output locales'),\n file: z\n .union([z.string(), z.array(z.string())])\n .optional()\n .describe('File path'),\n mode: z.enum(['complete', 'review']).optional().describe('Fill mode'),\n keys: z\n .union([z.string(), z.array(z.string())])\n .optional()\n .describe('Keys to include'),\n excludedKeys: z\n .union([z.string(), z.array(z.string())])\n .optional()\n .describe('Keys to exclude'),\n pathFilter: z\n .union([z.string(), z.array(z.string())])\n .optional()\n .describe('Path filter'),\n gitOptions: z\n .object({\n gitDiff: z.boolean().optional(),\n gitDiffBase: z.string().optional(),\n gitDiffCurrent: z.string().optional(),\n uncommitted: z.boolean().optional(),\n unpushed: z.boolean().optional(),\n untracked: z.boolean().optional(),\n })\n .optional()\n .describe('Git options'),\n aiOptions: z\n .object({\n provider: z.string().optional(),\n temperature: z.number().optional(),\n model: z.string().optional(),\n apiKey: z.string().optional(),\n customPrompt: z.string().optional(),\n applicationContext: z.string().optional(),\n })\n .optional()\n .describe('AI options'),\n configOptions: configOptionsSchema,\n },\n annotations: {\n destructiveHint: true,\n },\n },\n async (props) => {\n try {\n const { gitOptions, ...rest } = props;\n const fillOptions: any = { ...rest, gitOptions: undefined };\n\n if (gitOptions) {\n const { gitDiff, uncommitted, unpushed, untracked, ...restGit } =\n gitOptions;\n const mode = [];\n if (gitDiff) mode.push('gitDiff');\n if (uncommitted) mode.push('uncommitted');\n if (unpushed) mode.push('unpushed');\n if (untracked) mode.push('untracked');\n\n fillOptions.gitOptions = { ...restGit, mode };\n }\n\n await fill(fillOptions);\n\n return {\n content: [\n {\n type: 'text',\n text: 'Fill successful.',\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Fill failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'intlayer-push',\n {\n title: 'Push Dictionaries',\n description: 'Push local dictionaries to the server',\n inputSchema: {\n deleteLocaleDictionary: z\n .boolean()\n .optional()\n .describe('Delete local dictionary after push'),\n keepLocaleDictionary: z\n .boolean()\n .optional()\n .describe('Keep local dictionary after push'),\n dictionaries: z\n .array(z.string())\n .optional()\n .describe('List of dictionaries to push'),\n gitOptions: z\n .object({\n gitDiff: z.boolean().optional(),\n gitDiffBase: z.string().optional(),\n gitDiffCurrent: z.string().optional(),\n uncommitted: z.boolean().optional(),\n unpushed: z.boolean().optional(),\n untracked: z.boolean().optional(),\n })\n .optional()\n .describe('Git options'),\n configOptions: configOptionsSchema,\n },\n annotations: {\n destructiveHint: true,\n },\n },\n async (props) => {\n try {\n const { gitOptions, ...rest } = props;\n const pushOptions: any = { ...rest, gitOptions: undefined };\n\n if (gitOptions) {\n const { gitDiff, uncommitted, unpushed, untracked, ...restGit } =\n gitOptions;\n const mode = [];\n if (gitDiff) mode.push('gitDiff');\n if (uncommitted) mode.push('uncommitted');\n if (unpushed) mode.push('unpushed');\n if (untracked) mode.push('untracked');\n\n pushOptions.gitOptions = { ...restGit, mode };\n }\n\n await push(pushOptions);\n\n return {\n content: [\n {\n type: 'text',\n text: 'Push successful.',\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Push failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'intlayer-pull',\n {\n title: 'Pull Dictionaries',\n description: 'Pull dictionaries from the CMS',\n inputSchema: {\n dictionaries: z\n .array(z.string())\n .optional()\n .describe('List of dictionaries to pull'),\n newDictionariesPath: z\n .string()\n .optional()\n .describe('Path to save new dictionaries'),\n configOptions: configOptionsSchema,\n },\n annotations: {\n destructiveHint: true,\n },\n },\n async (props) => {\n try {\n await pull(props);\n\n return {\n content: [\n {\n type: 'text',\n text: 'Pull successful.',\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Pull failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'intlayer-content-list',\n {\n title: 'List Content Declarations',\n description:\n 'List the content declaration (.content.{ts,tsx,js,json,...}) files present in the project. That files contain the multilingual content of the application and are used to build the dictionaries.',\n inputSchema: {\n configOptions: configOptionsSchema,\n absolute: z\n .boolean()\n .optional()\n .describe(\n 'Output the results as absolute paths instead of relative paths'\n ),\n json: z\n .boolean()\n .optional()\n .describe('Output the results as JSON instead of formatted text'),\n },\n annotations: {\n readOnlyHint: true,\n },\n },\n async (props) => {\n try {\n const rows = listContentDeclarationRows(props);\n return {\n content: [\n {\n type: 'text',\n text: props.json\n ? JSON.stringify(rows)\n : JSON.stringify(rows, null, 2),\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Content list failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'intlayer-content-test',\n {\n title: 'Test Translations',\n description:\n 'Test if there are missing translations in the content declaration files. That files contain the multilingual content of the application and are used to build the dictionaries.',\n inputSchema: {\n configOptions: configOptionsSchema,\n },\n annotations: {\n readOnlyHint: true,\n },\n },\n async (props) => {\n try {\n const missingTranslations = listMissingTranslations(\n props?.configOptions\n );\n return {\n content: [\n {\n type: 'text',\n text: JSON.stringify(missingTranslations, null, 2),\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Content test failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'intlayer-extract',\n {\n title: 'Extract strings from Component',\n description:\n 'Extract strings from an existing component to be placed in a .content file close to the component. Trigger this action to make an existing component multilingual. If the component does not exist, create a normal component including text in JSX, and then trigger this tool to extract it.',\n inputSchema: {\n file: z\n .union([z.string(), z.array(z.string())])\n .optional()\n .describe('List of files to extract'),\n outputContentDeclarations: z\n .string()\n .optional()\n .describe('Path to output content declaration files'),\n configOptions: configOptionsSchema,\n },\n annotations: {\n destructiveHint: true,\n },\n },\n async (props) => {\n try {\n await extract({\n files: Array.isArray(props.file)\n ? props.file\n : props.file\n ? [props.file]\n : undefined,\n configOptions: props.configOptions,\n });\n\n return {\n content: [\n {\n type: 'text',\n text: 'Extract successful.',\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Extract failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'intlayer-projects-list',\n {\n title: 'List Projects',\n description:\n 'List all Intlayer projects in the directory. Search for configuration files to find all Intlayer projects.',\n inputSchema: {\n baseDir: z\n .string()\n .optional()\n .describe('Base directory to search from'),\n gitRoot: z\n .boolean()\n .optional()\n .describe(\n 'Search from the git root directory instead of the base directory'\n ),\n absolute: z\n .boolean()\n .optional()\n .describe(\n 'Output the results as absolute paths instead of relative paths'\n ),\n json: z\n .boolean()\n .optional()\n .describe('Output the results as JSON instead of formatted text'),\n },\n annotations: {\n readOnlyHint: true,\n },\n },\n async (props) => {\n try {\n const { searchDir, projectsPath } = await listProjects({\n baseDir: props.baseDir,\n gitRoot: props.gitRoot,\n });\n\n const projectsRelativePath = projectsPath\n .map((projectPath) =>\n props.absolute ? projectPath : relative(searchDir, projectPath)\n )\n .map((projectPath) => (projectPath === '' ? '.' : projectPath));\n\n const outputPaths = props.absolute\n ? projectsPath\n : projectsRelativePath;\n\n return {\n content: [\n {\n type: 'text',\n text: props.json\n ? JSON.stringify(outputPaths)\n : JSON.stringify(\n { searchDir, projectsPath: outputPaths },\n null,\n 2\n ),\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n {\n type: 'text',\n text: `Projects list failed: ${errorMessage}`,\n },\n ],\n };\n }\n }\n );\n};\n"],"mappings":";;;;;;;AAgBA,MAAM,sBAAsB,EACzB,OAAO;CACN,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,gCAAgC;CACxE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,kBAAkB;CACtD,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,8BAA8B;CACtE,UAAU,EACP,OAAO;EACN,QAAQ,EACL,OAAO;GACN,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,wBAAwB;GACjE,cAAc,EACX,OAAO,EACP,SAAS,EACT,SAAS,4BAA4B;GACxC,YAAY,EACT,OAAO,EACP,SAAS,EACT,SAAS,0BAA0B;EACxC,CAAC,EACA,SAAS;EACZ,sBAAsB,EACnB,OAAO;GACN,SAAS,EACN,MAAM,EAAE,WAAW,WAAW,CAAC,EAC/B,SAAS,EACT,SAAS,mBAAmB;GAC/B,eAAe,EACZ,WAAW,WAAW,EACtB,SAAS,EACT,SAAS,gBAAgB;EAC9B,CAAC,EACA,SAAS;EACZ,KAAK,EACF,OAAO;GACN,MAAM,EACH,KAAK;IAAC;IAAW;IAAW;GAAU,CAAC,EACvC,SAAS,EACT,SAAS,UAAU;GACtB,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,YAAY;EACrD,CAAC,EACA,SAAS;CACd,CAAC,EACA,SAAS,EACT,SACC,4EACF;AACJ,CAAC,EACA,SAAS,EACT,SACC,kGACF;AAIF,MAAa,eAA6B,OAAO,WAAW;CAC1D,OAAO,aACL,iBACA;EACE,OAAO;EACP,aAAa;EACb,aAAa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EACN,OAAO,EACP,SAAS,EACT,SAAS,+BAA+B;GAC3C,SAAS,EACN,QAAQ,EACR,SAAS,EACT,SACC,kEACF;GACF,UAAU,EACP,QAAQ,EACR,SAAS,EACT,SACC,gEACF;GACF,MAAM,EACH,QAAQ,EACR,SAAS,EACT,SAAS,sDAAsD;EACpE;EACA,aAAa,EACX,cAAc,KAChB;CACF,GACA,OAAO,UAAU;EACf,IAAI;GACF,MAAM,EAAE,WAAW,iBAAiB,MAAM,aAAa;IACrD,SAAS,MAAM;IACf,SAAS,MAAM;GACjB,CAAC;GAED,MAAM,uBAAuB,aAC1B,KAAK,gBACJ,MAAM,WAAW,cAAc,SAAS,WAAW,WAAW,CAChE,EACC,KAAK,gBAAiB,gBAAgB,KAAK,MAAM,WAAY;GAEhE,MAAM,cAAc,MAAM,WACtB,eACA;GAEJ,OAAO,EACL,SAAS,CACP;IACE,MAAM;IACN,MAAM,MAAM,OACR,KAAK,UAAU,WAAW,IAC1B,KAAK,UACH;KAAE;KAAW,cAAc;IAAY,GACvC,MACA,CACF;GACN,CACF,EACF;EACF,SAAS,OAAO;GAGd,OAAO,EACL,SAAS,CACP;IACE,MAAM;IACN,MAAM,yBALV,iBAAiB,QAAQ,MAAM,UAAU;GAMvC,CACF,EACF;EACF;CACF,CACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"docs.mjs","names":[],"sources":["../../../src/tools/docs.ts"],"sourcesContent":["import { getSearchAPI } from '@intlayer/api';\nimport type { DocKey } from '@intlayer/docs';\nimport {\n getDoc,\n getDocBySlug,\n getDocMetadataRecord,\n getDocsKeys,\n} from '@intlayer/docs';\nimport z from 'zod';\n\nexport type ToolResult = {\n content: { type: string; text: string }[];\n isError?: boolean;\n};\nexport type McpServer = {\n registerTool(\n name: string,\n config: any,\n handler: (params: any) => Promise<ToolResult>\n ): void;\n};\n\ntype LoadDocsTools = (server: McpServer) => Promise<void>;\n\nexport const loadDocsTools: LoadDocsTools = async (server) => {\n const docsKeys = getDocsKeys();\n\n server.registerTool(\n 'get-doc-list',\n {\n title: 'Get Doc List',\n description:\n 'Get the list of docs names and their metadata to get more details about what doc to retrieve',\n inputSchema: {},\n annotations: {\n readOnlyHint: true,\n },\n },\n async () => {\n try {\n const docsMetadataRecord = await getDocMetadataRecord();\n\n return {\n content: [\n {\n type: 'text',\n text: JSON.stringify(docsMetadataRecord, null, 2),\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n { type: 'text', text: `Get doc list failed: ${errorMessage}` },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'get-doc',\n {\n title: 'Get Doc by Key',\n description:\n 'Get a doc by his key. Example: `./docs/en/getting-started.md`. List all docs metadata first to get more details about what doc key to retrieve.',\n inputSchema: {\n docKey: z.enum(docsKeys as [string, ...string[]]),\n },\n annotations: {\n readOnlyHint: true,\n },\n },\n async ({ docKey }) => {\n try {\n const doc = await getDoc(docKey as DocKey);\n return {\n content: [{ type: 'text', text: doc }],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [{ type: 'text', text: `Get doc failed: ${errorMessage}` }],\n };\n }\n }\n );\n\n server.registerTool(\n 'get-doc-by-slug',\n {\n title: 'Get Doc by Slug',\n description:\n 'Get an array of docs by their slugs. If not slug is provided, return all docs (1.2Mb). List all docs metadata first to get more details about what doc to retrieve.',\n inputSchema: {\n slug: z\n .union([z.string(), z.array(z.string())])\n .optional()\n .describe(\n 'Slug of the docs. If not provided, return all docs. If not provided, return all docs.'\n ),\n strict: z\n .boolean()\n .optional()\n .describe(\n 'Strict mode - only return docs that match all slugs, by excluding additional slugs'\n ),\n },\n annotations: {\n readOnlyHint: true,\n },\n },\n async ({ slug, strict }) => {\n try {\n const doc = await getDocBySlug(slug ?? [], undefined, strict);\n return {\n content: doc.map((d) => ({ type: 'text', text: d })),\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n { type: 'text', text: `Get doc by slug failed: ${errorMessage}` },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'fetch-doc-chunks',\n {\n title: 'Fetch Doc Chunks',\n description:\n 'Fetch related doc chunks using keywords or questions. This tool will return the most relevant chunks of documentation based on the input query.',\n inputSchema: {\n query: z.string().describe('The keywords or question to search for'),\n limit: z\n .number()\n .optional()\n .describe('The number of chunks to retrieve (default: 10)'),\n },\n annotations: {\n readOnlyHint: true,\n },\n },\n async ({ query, limit }) => {\n try {\n const { searchDoc } = getSearchAPI(undefined);\n const response = await searchDoc({\n input: query,\n limit: limit?.toString(),\n returnContent: 'true',\n });\n\n if (!response.data || !Array.isArray(response.data)) {\n return {\n content: [{ type: 'text', text: 'No relevant chunks found.' }],\n };\n }\n\n const chunks = response.data;\n\n return {\n content: chunks.map((chunk: any) => ({\n type: 'text',\n text: [\n `File: ${chunk.fileKey}`,\n `Title: ${chunk.docName}`,\n `URL: ${chunk.docUrl}`,\n `Chunk: ${chunk.chunkNumber}`,\n `Content:`,\n chunk.content,\n ].join('\\n'),\n })),\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n { type: 'text', text: `Fetch doc chunks failed: ${errorMessage}` },\n ],\n };\n }\n }\n );\n};\n"],"mappings":";;;;;AAwBA,MAAa,gBAA+B,OAAO,WAAW;CAC5D,MAAM,WAAW,aAAa;CAE9B,OAAO,aACL,gBACA;EACE,OAAO;EACP,aACE;EACF,aAAa,EAAE;EACf,aAAa,EACX,cAAc,MACf;EACF,EACD,YAAY;EACV,IAAI;GACF,MAAM,qBAAqB,MAAM,sBAAsB;GAEvD,OAAO,EACL,SAAS,CACP;IACE,MAAM;IACN,MAAM,KAAK,UAAU,oBAAoB,MAAM,EAAE;IAClD,CACF,EACF;WACM,OAAO;GAGd,OAAO,EACL,SAAS,CACP;IAAE,MAAM;IAAQ,MAAM,wBAHxB,iBAAiB,QAAQ,MAAM,UAA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,MAAM,WAAW,MAAM,UAAU;IAC/B,OAAO;IACP,OAAO,OAAO,UAAU;IACxB,eAAe;IAChB,CAAC;GAEF,IAAI,CAAC,SAAS,QAAQ,CAAC,MAAM,QAAQ,SAAS,KAAK,EACjD,OAAO,EACL,SAAS,CAAC;IAAE,MAAM;IAAQ,MAAM;IAA6B,CAAC,EAC/D;GAKH,OAAO,EACL,SAHa,SAAS,KAGN,KAAK,WAAgB;IACnC,MAAM;IACN,MAAM;KACJ,SAAS,MAAM;KACf,UAAU,MAAM;KAChB,QAAQ,MAAM;KACd,UAAU,MAAM;KAChB;KACA,MAAM;KACP,CAAC,KAAK,KAAK;IACb,EAAE,EACJ;WACM,OAAO;GAGd,OAAO,EACL,SAAS,CACP;IAAE,MAAM;IAAQ,MAAM,4BAHxB,iBAAiB,QAAQ,MAAM,UAAU;IAG2B,CACnE,EACF;;GAGN"}
1
+ {"version":3,"file":"docs.mjs","names":[],"sources":["../../../src/tools/docs.ts"],"sourcesContent":["import { getSearchAPI } from '@intlayer/api';\nimport type { DocKey } from '@intlayer/docs';\nimport {\n getDoc,\n getDocBySlug,\n getDocMetadataRecord,\n getDocsKeys,\n} from '@intlayer/docs';\nimport z from 'zod';\n\nexport type ToolResult = {\n content: { type: string; text: string }[];\n isError?: boolean;\n};\nexport type McpServer = {\n registerTool(\n name: string,\n config: any,\n handler: (params: any) => Promise<ToolResult>\n ): void;\n};\n\ntype LoadDocsTools = (server: McpServer) => Promise<void>;\n\nexport const loadDocsTools: LoadDocsTools = async (server) => {\n const docsKeys = getDocsKeys();\n\n server.registerTool(\n 'get-doc-list',\n {\n title: 'Get Doc List',\n description:\n 'Get the list of docs names and their metadata to get more details about what doc to retrieve',\n inputSchema: {},\n annotations: {\n readOnlyHint: true,\n },\n },\n async () => {\n try {\n const docsMetadataRecord = await getDocMetadataRecord();\n\n return {\n content: [\n {\n type: 'text',\n text: JSON.stringify(docsMetadataRecord, null, 2),\n },\n ],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n { type: 'text', text: `Get doc list failed: ${errorMessage}` },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'get-doc',\n {\n title: 'Get Doc by Key',\n description:\n 'Get a doc by his key. Example: `./docs/en/getting-started.md`. List all docs metadata first to get more details about what doc key to retrieve.',\n inputSchema: {\n docKey: z.enum(docsKeys as [string, ...string[]]),\n },\n annotations: {\n readOnlyHint: true,\n },\n },\n async ({ docKey }) => {\n try {\n const doc = await getDoc(docKey as DocKey);\n return {\n content: [{ type: 'text', text: doc }],\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [{ type: 'text', text: `Get doc failed: ${errorMessage}` }],\n };\n }\n }\n );\n\n server.registerTool(\n 'get-doc-by-slug',\n {\n title: 'Get Doc by Slug',\n description:\n 'Get an array of docs by their slugs. If not slug is provided, return all docs (1.2Mb). List all docs metadata first to get more details about what doc to retrieve.',\n inputSchema: {\n slug: z\n .union([z.string(), z.array(z.string())])\n .optional()\n .describe(\n 'Slug of the docs. If not provided, return all docs. If not provided, return all docs.'\n ),\n strict: z\n .boolean()\n .optional()\n .describe(\n 'Strict mode - only return docs that match all slugs, by excluding additional slugs'\n ),\n },\n annotations: {\n readOnlyHint: true,\n },\n },\n async ({ slug, strict }) => {\n try {\n const doc = await getDocBySlug(slug ?? [], undefined, strict);\n return {\n content: doc.map((d) => ({ type: 'text', text: d })),\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n { type: 'text', text: `Get doc by slug failed: ${errorMessage}` },\n ],\n };\n }\n }\n );\n\n server.registerTool(\n 'fetch-doc-chunks',\n {\n title: 'Fetch Doc Chunks',\n description:\n 'Fetch related doc chunks using keywords or questions. This tool will return the most relevant chunks of documentation based on the input query.',\n inputSchema: {\n query: z.string().describe('The keywords or question to search for'),\n limit: z\n .number()\n .optional()\n .describe('The number of chunks to retrieve (default: 10)'),\n },\n annotations: {\n readOnlyHint: true,\n },\n },\n async ({ query, limit }) => {\n try {\n const { searchDoc } = getSearchAPI(undefined);\n const response = await searchDoc({\n input: query,\n limit: limit?.toString(),\n returnContent: 'true',\n });\n\n if (!response.data || !Array.isArray(response.data)) {\n return {\n content: [{ type: 'text', text: 'No relevant chunks found.' }],\n };\n }\n\n const chunks = response.data;\n\n return {\n content: chunks.map((chunk: any) => ({\n type: 'text',\n text: [\n `File: ${chunk.fileKey}`,\n `Title: ${chunk.docName}`,\n `URL: ${chunk.docUrl}`,\n `Chunk: ${chunk.chunkNumber}`,\n `Content:`,\n chunk.content,\n ].join('\\n'),\n })),\n };\n } catch (error) {\n const errorMessage =\n error instanceof Error ? error.message : 'An unknown error occurred';\n return {\n content: [\n { type: 'text', text: `Fetch doc chunks failed: ${errorMessage}` },\n ],\n };\n }\n }\n );\n};\n"],"mappings":";;;;;AAwBA,MAAa,gBAA+B,OAAO,WAAW;CAC5D,MAAM,WAAW,YAAY;CAE7B,OAAO,aACL,gBACA;EACE,OAAO;EACP,aACE;EACF,aAAa,CAAC;EACd,aAAa,EACX,cAAc,KAChB;CACF,GACA,YAAY;EACV,IAAI;GACF,MAAM,qBAAqB,MAAM,qBAAqB;GAEtD,OAAO,EACL,SAAS,CACP;IACE,MAAM;IACN,MAAM,KAAK,UAAU,oBAAoB,MAAM,CAAC;GAClD,CACF,EACF;EACF,SAAS,OAAO;GAGd,OAAO,EACL,SAAS,CACP;IAAE,MAAM;IAAQ,MAAM,wBAHxB,iBAAiB,QAAQ,MAAM,UAAU;GAGsB,CAC/D,EACF;EACF;CACF,CACF;CAEA,OAAO,aACL,WACA;EACE,OAAO;EACP,aACE;EACF,aAAa,EACX,QAAQ,EAAE,KAAK,QAAiC,EAClD;EACA,aAAa,EACX,cAAc,KAChB;CACF,GACA,OAAO,EAAE,aAAa;EACpB,IAAI;GAEF,OAAO,EACL,SAAS,CAAC;IAAE,MAAM;IAAQ,MAAM,MAFhB,OAAO,M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F,OAAO,EACL,SAHa,SAAS,KAGN,KAAK,WAAgB;IACnC,MAAM;IACN,MAAM;KACJ,SAAS,MAAM;KACf,UAAU,MAAM;KAChB,QAAQ,MAAM;KACd,UAAU,MAAM;KAChB;KACA,MAAM;IACR,EAAE,KAAK,IAAI;GACb,EAAE,EACJ;EACF,SAAS,OAAO;GAGd,OAAO,EACL,SAAS,CACP;IAAE,MAAM;IAAQ,MAAM,4BAHxB,iBAAiB,QAAQ,MAAM,UAAU;GAG0B,CACnE,EACF;EACF;CACF,CACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"installSkills.mjs","names":[],"sources":["../../../src/tools/installSkills.ts"],"sourcesContent":["import * as readline from 'node:readline';\nimport {\n installSkills,\n PLATFORMS,\n SKILLS,\n type Skill,\n} from '@intlayer/chokidar/cli';\nimport z from 'zod';\nimport type { McpServer } from './docs';\n\nexport const loadInstallSkillsTool = (server: McpServer): void => {\n server.registerTool(\n 'intlayer-install-skills',\n {\n title: 'Install Intlayer Skills',\n description:\n 'Install Intlayer documentation and skills to the project to assist AI agents. Ask the user for the platform (Cursor, VSCode, OpenCode, Claude, etc.) and which skills they want to install before calling this tool.',\n inputSchema: {\n platform: z\n .enum(PLATFORMS)\n .describe('The platform to install skills for'),\n skills: z.array(z.enum(SKILLS)).describe('List of skills to install'),\n projectRoot: z\n .string()\n .optional()\n .describe(\n 'Root directory of the project. Defaults to current directory.'\n ),\n },\n },\n\n async ({ platform, skills, projectRoot }) => {\n try {\n const root = projectRoot || process.cwd();\n const message = await installSkills(root, platform, skills);\n\n return {\n content: [\n {\n type: 'text',\n text: message,\n },\n ],\n };\n } catch (error) {\n return {\n content: [\n {\n type: 'text',\n text: `Failed to install skills: ${error instanceof Error ? error.message : String(error)}`,\n },\n ],\n isError: true,\n };\n }\n }\n );\n};\n\nexport const runInstallSkillsCLI = async (): Promise<void> => {\n const rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n });\n\n const question = (query: string): Promise<string> =>\n new Promise((resolve) => rl.question(query, resolve));\n\n try {\n console.log('Install Intlayer Skills');\n console.log('-----------------------');\n\n const platformInput = await question(\n 'Which platform are you using? (Cursor, Windsurf, Trae, OpenCode, GitHub, Claude, VSCode, Cline, RooCode, etc. or \"Other\"): '\n );\n\n // we only accept a single platform here, not an array like the main CLI\n const platform =\n PLATFORMS.find(\n (platform) =>\n platform.toLowerCase() === platformInput.trim().toLowerCase()\n ) || ('Other' as const);\n\n console.log(`Selected platform: ${platform}`);\n\n console.log('\\nAvailable skills:');\n\n SKILLS.forEach((skill, i) => {\n console.log(`${i + 1}. ${skill}`);\n });\n\n const skillsInput = await question(\n '\\nWhich skills do you want to install? (comma separated numbers, e.g. 1,2,3 or \"all\"): '\n );\n\n let selectedSkills: Skill[] = [];\n if (skillsInput.trim().toLowerCase() === 'all') {\n selectedSkills = [...SKILLS];\n } else {\n const indices = skillsInput\n .split(',')\n .map((skill) => parseInt(skill.trim(), 10) - 1)\n .filter(\n (skill) => !Number.isNaN(skill) && skill >= 0 && skill < SKILLS.length\n );\n selectedSkills = indices.map((i) => SKILLS[i] as any);\n }\n\n if (selectedSkills.length === 0) {\n console.log('No valid skills selected. Exiting.');\n rl.close();\n return;\n }\n\n console.log(`Installing skills: ${selectedSkills.join(', ')}...`);\n const result = await installSkills(process.cwd(), platform, selectedSkills);\n console.log(result);\n } catch (error) {\n console.error('Error:', error);\n } finally {\n rl.close();\n }\n};\n"],"mappings":";;;;;AAUA,MAAa,yBAAyB,WAA4B;CAChE,OAAO,aACL,2BACA;EACE,OAAO;EACP,aACE;EACF,aAAa;GACX,UAAU,EACP,KAAK,UAAU,CACf,SAAS,qCAAqC;GACjD,QAAQ,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,CAAC,SAAS,4BAA4B;GACrE,aAAa,EACV,QAAQ,CACR,UAAU,CACV,SACC,gEACD;GACJ;EACF,EAED,OAAO,EAAE,UAAU,QAAQ,kBAAkB;EAC3C,IAAI;GAIF,OAAO,EACL,SAAS,C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AC,KAAK;EACjE,MAAM,SAAS,MAAM,cAAc,QAAQ,KAAK,EAAE,UAAU,eAAe;EAC3E,QAAQ,IAAI,OAAO;UACZ,OAAO;EACd,QAAQ,MAAM,UAAU,MAAM;WACtB;EACR,GAAG,OAAO"}
1
+ {"version":3,"file":"installSkills.mjs","names":[],"sources":["../../../src/tools/installSkills.ts"],"sourcesContent":["import * as readline from 'node:readline';\nimport {\n installSkills,\n PLATFORMS,\n SKILLS,\n type Skill,\n} from '@intlayer/chokidar/cli';\nimport z from 'zod';\nimport type { McpServer } from './docs';\n\nexport const loadInstallSkillsTool = (server: McpServer): void => {\n server.registerTool(\n 'intlayer-install-skills',\n {\n title: 'Install Intlayer Skills',\n description:\n 'Install Intlayer documentation and skills to the project to assist AI agents. Ask the user for the platform (Cursor, VSCode, OpenCode, Claude, etc.) and which skills they want to install before calling this tool.',\n inputSchema: {\n platform: z\n .enum(PLATFORMS)\n .describe('The platform to install skills for'),\n skills: z.array(z.enum(SKILLS)).describe('List of skills to install'),\n projectRoot: z\n .string()\n .optional()\n .describe(\n 'Root directory of the project. Defaults to current directory.'\n ),\n },\n },\n\n async ({ platform, skills, projectRoot }) => {\n try {\n const root = projectRoot || process.cwd();\n const message = await installSkills(root, platform, skills);\n\n return {\n content: [\n {\n type: 'text',\n text: message,\n },\n ],\n };\n } catch (error) {\n return {\n content: [\n {\n type: 'text',\n text: `Failed to install skills: ${error instanceof Error ? error.message : String(error)}`,\n },\n ],\n isError: true,\n };\n }\n }\n );\n};\n\nexport const runInstallSkillsCLI = async (): Promise<void> => {\n const rl = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n });\n\n const question = (query: string): Promise<string> =>\n new Promise((resolve) => rl.question(query, resolve));\n\n try {\n console.log('Install Intlayer Skills');\n console.log('-----------------------');\n\n const platformInput = await question(\n 'Which platform are you using? (Cursor, Windsurf, Trae, OpenCode, GitHub, Claude, VSCode, Cline, RooCode, etc. or \"Other\"): '\n );\n\n // we only accept a single platform here, not an array like the main CLI\n const platform =\n PLATFORMS.find(\n (platform) =>\n platform.toLowerCase() === platformInput.trim().toLowerCase()\n ) || ('Other' as const);\n\n console.log(`Selected platform: ${platform}`);\n\n console.log('\\nAvailable skills:');\n\n SKILLS.forEach((skill, i) => {\n console.log(`${i + 1}. ${skill}`);\n });\n\n const skillsInput = await question(\n '\\nWhich skills do you want to install? (comma separated numbers, e.g. 1,2,3 or \"all\"): '\n );\n\n let selectedSkills: Skill[] = [];\n if (skillsInput.trim().toLowerCase() === 'all') {\n selectedSkills = [...SKILLS];\n } else {\n const indices = skillsInput\n .split(',')\n .map((skill) => parseInt(skill.trim(), 10) - 1)\n .filter(\n (skill) => !Number.isNaN(skill) && skill >= 0 && skill < SKILLS.length\n );\n selectedSkills = indices.map((i) => SKILLS[i] as any);\n }\n\n if (selectedSkills.length === 0) {\n console.log('No valid skills selected. Exiting.');\n rl.close();\n return;\n }\n\n console.log(`Installing skills: ${selectedSkills.join(', ')}...`);\n const result = await installSkills(process.cwd(), platform, selectedSkills);\n console.log(result);\n } catch (error) {\n console.error('Error:', error);\n } finally {\n rl.close();\n }\n};\n"],"mappings":";;;;;AAUA,MAAa,yBAAyB,WAA4B;CAChE,OAAO,aACL,2BACA;EACE,OAAO;EACP,aACE;EACF,aAAa;GACX,UAAU,EACP,KAAK,SAAS,EACd,SAAS,oCAAoC;GAChD,QAAQ,EAAE,MAAM,EAAE,KAAK,MAAM,CAAC,EAAE,SAAS,2BAA2B;GACpE,aAAa,EACV,OAAO,EACP,SAAS,EACT,SACC,+DACF;EACJ;CACF,GAEA,OAAO,EAAE,UAAU,QAAQ,kBAAkB;EAC3C,IAAI;GAIF,OAAO,EACL,SAAS,CACP;IACE,MAAM;IACN,MAAM,MANU,cADT,eAAe,QAAQ,IAAI,GACE,UAAU,MAAM;GAOtD,CACF,EACF;EACF,SAAS,OAAO;GACd,OAAO;IACL,SAAS,CACP;KACE,MAAM;KACN,MAAM,6BAA6B,iBAAiB,QAAQ,MAAM,UAAU,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AAG,MAAM;CACX;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","names":[],"sources":["../../../src/tools/api.ts"],"mappings":";;;KAKK,YAAA,IAAgB,MAAA,EAAQ,SAAA;AAAA,cAkEhB,YAAA,EAAc,YAAA"}
1
+ {"version":3,"file":"api.d.ts","names":[],"sources":["../../../src/tools/api.ts"],"mappings":";;;KAKK,YAAA,IAAgB,MAAQ,EAAA,SAAA;AAAA,cAkEhB,YAAA,EAAc,YAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"installSkills.d.ts","names":[],"sources":["../../../src/tools/installSkills.ts"],"mappings":";;;cAUa,qBAAA,GAAyB,MAAA,EAAQ,SAAA;AAAA,cAiDjC,mBAAA,QAAgC,OAAA"}
1
+ {"version":3,"file":"installSkills.d.ts","names":[],"sources":["../../../src/tools/installSkills.ts"],"mappings":";;;cAUa,qBAAA,GAAyB,MAAQ,EAAA,SAAA;AAAA,cAiDjC,mBAAA,QAAgC,OAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intlayer/mcp",
3
- "version": "8.9.6",
3
+ "version": "8.9.8",
4
4
  "private": false,
5
5
  "description": "Intlayer MCP server. Handle MCP to help IDE to use Intlayer. It build, fill, pull, push, dictionaries",
6
6
  "keywords": [
@@ -111,18 +111,18 @@
111
111
  "dependencies": {
112
112
  "@fastify/cors": "11.2.0",
113
113
  "@fastify/helmet": "13.0.2",
114
- "@intlayer/api": "8.9.6",
115
- "@intlayer/chokidar": "8.9.6",
116
- "@intlayer/cli": "8.9.6",
117
- "@intlayer/config": "8.9.6",
118
- "@intlayer/docs": "8.9.6",
119
- "@intlayer/types": "8.9.6",
114
+ "@intlayer/api": "8.9.8",
115
+ "@intlayer/chokidar": "8.9.8",
116
+ "@intlayer/cli": "8.9.8",
117
+ "@intlayer/config": "8.9.8",
118
+ "@intlayer/docs": "8.9.8",
119
+ "@intlayer/types": "8.9.8",
120
120
  "dotenv": "17.4.2",
121
121
  "fastify": "5.8.5",
122
122
  "zod": "4.4.3"
123
123
  },
124
124
  "devDependencies": {
125
- "@intlayer/types": "8.9.6",
125
+ "@intlayer/types": "8.9.8",
126
126
  "@types/node": "25.8.0",
127
127
  "@utils/ts-config": "1.0.4",
128
128
  "@utils/ts-config-types": "1.0.4",