@jvittechs/jai1-mcp 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -6
- package/dist/index.js +109 -15
- package/dist/index.js.map +1 -1
- package/package.json +47 -47
package/README.md
CHANGED
|
@@ -31,14 +31,14 @@ npx @jvittechs/jai1-mcp
|
|
|
31
31
|
|
|
32
32
|
| Variable | Description |
|
|
33
33
|
|----------|-------------|
|
|
34
|
-
| `JAI1_ACCESS_KEY` | Your Jai1 access key
|
|
34
|
+
| `JAI1_ACCESS_KEY` | Your Jai1 access key |
|
|
35
|
+
| `JAI1_MCP_SERVER_URL` | MCP server URL (provided by your admin) |
|
|
35
36
|
|
|
36
37
|
### Optional Environment Variables
|
|
37
38
|
|
|
38
39
|
| Variable | Default | Description |
|
|
39
40
|
|----------|---------|-------------|
|
|
40
|
-
| `
|
|
41
|
-
| `JAI1_MCP_TIMEOUT` | `60000` | Request timeout in milliseconds |
|
|
41
|
+
| `JAI1_MCP_TIMEOUT` | `120000` | Request timeout in milliseconds |
|
|
42
42
|
| `JAI1_MCP_DEBUG` | `false` | Enable debug logging |
|
|
43
43
|
|
|
44
44
|
## IDE Setup
|
|
@@ -54,7 +54,8 @@ Add to your Cursor MCP configuration (`~/.cursor/mcp.json` or project `.cursor/m
|
|
|
54
54
|
"command": "npx",
|
|
55
55
|
"args": ["@jvittechs/jai1-mcp"],
|
|
56
56
|
"env": {
|
|
57
|
-
"JAI1_ACCESS_KEY": "your_access_key_here"
|
|
57
|
+
"JAI1_ACCESS_KEY": "your_access_key_here",
|
|
58
|
+
"JAI1_MCP_SERVER_URL": "https://mcp.your-company.com"
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
61
|
}
|
|
@@ -72,7 +73,8 @@ Add to your Windsurf MCP configuration:
|
|
|
72
73
|
"command": "npx",
|
|
73
74
|
"args": ["@jvittechs/jai1-mcp"],
|
|
74
75
|
"env": {
|
|
75
|
-
"JAI1_ACCESS_KEY": "your_access_key_here"
|
|
76
|
+
"JAI1_ACCESS_KEY": "your_access_key_here",
|
|
77
|
+
"JAI1_MCP_SERVER_URL": "https://mcp.your-company.com"
|
|
76
78
|
}
|
|
77
79
|
}
|
|
78
80
|
}
|
|
@@ -90,7 +92,8 @@ Add to your Claude Desktop config (`~/Library/Application Support/Claude/claude_
|
|
|
90
92
|
"command": "npx",
|
|
91
93
|
"args": ["@jvittechs/jai1-mcp"],
|
|
92
94
|
"env": {
|
|
93
|
-
"JAI1_ACCESS_KEY": "your_access_key_here"
|
|
95
|
+
"JAI1_ACCESS_KEY": "your_access_key_here",
|
|
96
|
+
"JAI1_MCP_SERVER_URL": "https://mcp.your-company.com"
|
|
94
97
|
}
|
|
95
98
|
}
|
|
96
99
|
}
|
package/dist/index.js
CHANGED
|
@@ -11,18 +11,18 @@ import {
|
|
|
11
11
|
// src/config.ts
|
|
12
12
|
import { z } from "zod";
|
|
13
13
|
var ConfigSchema = z.object({
|
|
14
|
-
/** MCP Server URL */
|
|
15
|
-
serverUrl: z.string().url(
|
|
14
|
+
/** MCP Server URL - REQUIRED, no default to avoid exposing URL in published package */
|
|
15
|
+
serverUrl: z.string().url("JAI1_MCP_SERVER_URL must be a valid URL"),
|
|
16
16
|
/** JAI1 Access Key for authentication */
|
|
17
|
-
accessKey: z.string().min(1, "
|
|
17
|
+
accessKey: z.string().min(1, "JAI1_ACCESS_KEY is required"),
|
|
18
18
|
/** Request timeout in milliseconds */
|
|
19
|
-
timeout: z.number().positive().default(
|
|
19
|
+
timeout: z.number().positive().default(12e4),
|
|
20
20
|
/** Enable debug logging */
|
|
21
21
|
debug: z.boolean().default(false)
|
|
22
22
|
});
|
|
23
23
|
function loadConfig() {
|
|
24
24
|
const rawConfig = {
|
|
25
|
-
serverUrl: process.env.JAI1_MCP_SERVER_URL
|
|
25
|
+
serverUrl: process.env.JAI1_MCP_SERVER_URL,
|
|
26
26
|
accessKey: process.env.JAI1_ACCESS_KEY,
|
|
27
27
|
timeout: process.env.JAI1_MCP_TIMEOUT ? parseInt(process.env.JAI1_MCP_TIMEOUT, 10) : void 0,
|
|
28
28
|
debug: process.env.JAI1_MCP_DEBUG === "true" || process.env.DEBUG === "true"
|
|
@@ -35,12 +35,26 @@ function loadConfig() {
|
|
|
35
35
|
${errors}
|
|
36
36
|
|
|
37
37
|
Required environment variables:
|
|
38
|
-
JAI1_ACCESS_KEY
|
|
38
|
+
JAI1_ACCESS_KEY - Your Jai1 access key
|
|
39
|
+
JAI1_MCP_SERVER_URL - MCP server URL
|
|
39
40
|
|
|
40
41
|
Optional environment variables:
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
JAI1_MCP_TIMEOUT - Request timeout in ms (default: 120000)
|
|
43
|
+
JAI1_MCP_DEBUG - Enable debug logging (default: false)
|
|
44
|
+
|
|
45
|
+
Example Cursor MCP config:
|
|
46
|
+
{
|
|
47
|
+
"mcpServers": {
|
|
48
|
+
"jai1": {
|
|
49
|
+
"command": "npx",
|
|
50
|
+
"args": ["@jvittechs/jai1-mcp"],
|
|
51
|
+
"env": {
|
|
52
|
+
"JAI1_ACCESS_KEY": "your_key",
|
|
53
|
+
"JAI1_MCP_SERVER_URL": "https://mcp.example.com"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}`
|
|
44
58
|
);
|
|
45
59
|
}
|
|
46
60
|
return result.data;
|
|
@@ -55,6 +69,73 @@ var ProxyError = class extends Error {
|
|
|
55
69
|
this.name = "ProxyError";
|
|
56
70
|
}
|
|
57
71
|
};
|
|
72
|
+
var TOOL_TO_AGENT = {
|
|
73
|
+
jai1_plan_feature: "planning-agent",
|
|
74
|
+
jai1_suggest_techstack: "research-agent",
|
|
75
|
+
jai1_research: "research-agent",
|
|
76
|
+
jai1_review_code: "code-review-agent",
|
|
77
|
+
jai1_review_security: "security-agent",
|
|
78
|
+
jai1_generate_commit: "commit-agent"
|
|
79
|
+
};
|
|
80
|
+
function formatToolArgsToPrompt(toolName, args) {
|
|
81
|
+
switch (toolName) {
|
|
82
|
+
case "jai1_plan_feature":
|
|
83
|
+
return [
|
|
84
|
+
`Feature: ${args.feature_description}`,
|
|
85
|
+
args.codebase_context && `Codebase Context: ${args.codebase_context}`,
|
|
86
|
+
args.tech_stack && `Tech Stack: ${args.tech_stack}`,
|
|
87
|
+
args.constraints && `Constraints: ${args.constraints}`
|
|
88
|
+
].filter(Boolean).join("\n\n");
|
|
89
|
+
case "jai1_suggest_techstack":
|
|
90
|
+
return [
|
|
91
|
+
`Project Requirements: ${args.requirements}`,
|
|
92
|
+
args.project_type && `Project Type: ${args.project_type}`,
|
|
93
|
+
args.constraints && `Constraints: ${args.constraints}`,
|
|
94
|
+
args.preferences && `Preferences: ${args.preferences}`,
|
|
95
|
+
"\nPlease recommend an optimal tech stack."
|
|
96
|
+
].filter(Boolean).join("\n");
|
|
97
|
+
case "jai1_research": {
|
|
98
|
+
const depthInstructions = {
|
|
99
|
+
brief: "Provide a brief overview.",
|
|
100
|
+
standard: "Provide a detailed analysis.",
|
|
101
|
+
deep: "Provide a comprehensive, in-depth analysis."
|
|
102
|
+
};
|
|
103
|
+
return [
|
|
104
|
+
`Research Topic: ${args.topic}`,
|
|
105
|
+
args.context && `Context: ${args.context}`,
|
|
106
|
+
depthInstructions[args.depth || "standard"]
|
|
107
|
+
].filter(Boolean).join("\n");
|
|
108
|
+
}
|
|
109
|
+
case "jai1_review_code":
|
|
110
|
+
return [
|
|
111
|
+
args.language && `Language: ${args.language}`,
|
|
112
|
+
args.scope && `Focus areas: ${args.scope}`,
|
|
113
|
+
args.project_guidelines && `Project guidelines: ${args.project_guidelines}`,
|
|
114
|
+
"\n```\n" + args.code + "\n```",
|
|
115
|
+
"\nPlease review this code for quality and best practices."
|
|
116
|
+
].filter(Boolean).join("\n");
|
|
117
|
+
case "jai1_review_security":
|
|
118
|
+
return [
|
|
119
|
+
args.language && `Language: ${args.language}`,
|
|
120
|
+
args.context && `Context: ${args.context}`,
|
|
121
|
+
"\n```\n" + args.code + "\n```",
|
|
122
|
+
"\nPlease audit this code for security vulnerabilities."
|
|
123
|
+
].filter(Boolean).join("\n");
|
|
124
|
+
case "jai1_generate_commit":
|
|
125
|
+
return [
|
|
126
|
+
args.files_changed && `Files changed:
|
|
127
|
+
${args.files_changed}`,
|
|
128
|
+
`
|
|
129
|
+
Diff:
|
|
130
|
+
\`\`\`diff
|
|
131
|
+
${args.diff}
|
|
132
|
+
\`\`\``,
|
|
133
|
+
"\nGenerate a commit message for these changes."
|
|
134
|
+
].filter(Boolean).join("\n");
|
|
135
|
+
default:
|
|
136
|
+
return Object.entries(args).map(([key, value]) => `${key}: ${value}`).join("\n");
|
|
137
|
+
}
|
|
138
|
+
}
|
|
58
139
|
var MCPProxy = class {
|
|
59
140
|
config;
|
|
60
141
|
debug;
|
|
@@ -65,10 +146,23 @@ var MCPProxy = class {
|
|
|
65
146
|
}
|
|
66
147
|
/**
|
|
67
148
|
* Call a tool on the remote MCP server
|
|
149
|
+
* Maps tools to agents and calls the Mastra generate endpoint
|
|
68
150
|
*/
|
|
69
151
|
async callTool(toolName, args) {
|
|
70
|
-
const
|
|
71
|
-
|
|
152
|
+
const agentId = TOOL_TO_AGENT[toolName];
|
|
153
|
+
if (!agentId) {
|
|
154
|
+
throw new ProxyError(
|
|
155
|
+
`Unknown tool: ${toolName}. Available: ${Object.keys(TOOL_TO_AGENT).join(", ")}`,
|
|
156
|
+
"ERR-MCP-003",
|
|
157
|
+
404
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
const url = `${this.config.serverUrl}/api/agents/${agentId}/generate`;
|
|
161
|
+
const prompt = formatToolArgsToPrompt(toolName, args);
|
|
162
|
+
const body = {
|
|
163
|
+
messages: [{ role: "user", content: prompt }]
|
|
164
|
+
};
|
|
165
|
+
this.debug(`Calling tool: ${toolName}`, { url, agentId, prompt: prompt.substring(0, 100) });
|
|
72
166
|
const controller = new AbortController();
|
|
73
167
|
const timeoutId = setTimeout(
|
|
74
168
|
() => controller.abort(),
|
|
@@ -81,7 +175,7 @@ var MCPProxy = class {
|
|
|
81
175
|
"Content-Type": "application/json",
|
|
82
176
|
Authorization: `Bearer ${this.config.accessKey}`
|
|
83
177
|
},
|
|
84
|
-
body: JSON.stringify(
|
|
178
|
+
body: JSON.stringify(body),
|
|
85
179
|
signal: controller.signal
|
|
86
180
|
});
|
|
87
181
|
clearTimeout(timeoutId);
|
|
@@ -97,7 +191,7 @@ var MCPProxy = class {
|
|
|
97
191
|
}
|
|
98
192
|
if (response.status === 404) {
|
|
99
193
|
throw new ProxyError(
|
|
100
|
-
`
|
|
194
|
+
`Agent not found: ${agentId}`,
|
|
101
195
|
"ERR-MCP-003",
|
|
102
196
|
404
|
|
103
197
|
);
|
|
@@ -109,8 +203,8 @@ var MCPProxy = class {
|
|
|
109
203
|
);
|
|
110
204
|
}
|
|
111
205
|
const result = await response.json();
|
|
112
|
-
this.debug(`Tool response:`, { toolName, result });
|
|
113
|
-
return result;
|
|
206
|
+
this.debug(`Tool response:`, { toolName, hasText: !!result.text });
|
|
207
|
+
return result.text || result;
|
|
114
208
|
} catch (error) {
|
|
115
209
|
clearTimeout(timeoutId);
|
|
116
210
|
if (error instanceof ProxyError) {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/config.ts","../src/proxy.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { Server } from \"@modelcontextprotocol/sdk/server/index.js\";\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\nimport {\n CallToolRequestSchema,\n ListToolsRequestSchema,\n} from \"@modelcontextprotocol/sdk/types.js\";\nimport { z } from \"zod\";\n\nimport { loadConfig } from \"./config.js\";\nimport { MCPProxy, ProxyError } from \"./proxy.js\";\n\n/**\n * Jai1 MCP Proxy Server\n * \n * This is a stdio MCP server that acts as a proxy to the remote Jai1 MCP Server.\n * It allows IDE AI agents (Cursor, Windsurf) to access Jai1 developer tools.\n * \n * Usage:\n * JAI1_ACCESS_KEY=your_key npx @jvittechs/jai1-mcp\n * \n * Or in Cursor MCP config:\n * {\n * \"mcpServers\": {\n * \"jai1\": {\n * \"command\": \"npx\",\n * \"args\": [\"@jvittechs/jai1-mcp\"],\n * \"env\": {\n * \"JAI1_ACCESS_KEY\": \"your_key\"\n * }\n * }\n * }\n * }\n */\n\n// Tool definitions matching the mcp-server tools\nconst TOOLS = [\n {\n name: \"jai1_plan_feature\",\n description:\n \"Create a structured development plan for a feature. Returns requirements, design approach, and task breakdown.\",\n inputSchema: {\n type: \"object\" as const,\n properties: {\n feature_description: {\n type: \"string\",\n description: \"Description of the feature to plan\",\n },\n codebase_context: {\n type: \"string\",\n description:\n \"Current codebase context (tech stack, patterns, relevant code)\",\n },\n tech_stack: {\n type: \"string\",\n description: \"Tech stack being used\",\n },\n constraints: {\n type: \"string\",\n description: \"Any constraints or requirements to consider\",\n },\n },\n required: [\"feature_description\"],\n },\n },\n {\n name: \"jai1_suggest_techstack\",\n description:\n \"Get tech stack recommendations based on project requirements. Returns recommended technologies with justification.\",\n inputSchema: {\n type: \"object\" as const,\n properties: {\n requirements: {\n type: \"string\",\n description: \"Project requirements and goals\",\n },\n project_type: {\n type: \"string\",\n description: \"Type of project (web app, mobile, API, CLI, etc.)\",\n },\n constraints: {\n type: \"string\",\n description: \"Constraints (budget, team skills, timeline)\",\n },\n preferences: {\n type: \"string\",\n description: \"Any technology preferences or existing stack\",\n },\n },\n required: [\"requirements\"],\n },\n },\n {\n name: \"jai1_research\",\n description:\n \"Research a technical topic. Returns structured summary with key concepts, best practices, and resources.\",\n inputSchema: {\n type: \"object\" as const,\n properties: {\n topic: {\n type: \"string\",\n description: \"The topic to research\",\n },\n context: {\n type: \"string\",\n description: \"Context for the research (project, use case)\",\n },\n depth: {\n type: \"string\",\n enum: [\"brief\", \"standard\", \"deep\"],\n description:\n \"Depth of research: brief (overview), standard (detailed), deep (comprehensive)\",\n },\n },\n required: [\"topic\"],\n },\n },\n {\n name: \"jai1_review_code\",\n description:\n \"Review code for quality, maintainability, and best practices. Returns quality checklist and improvement suggestions.\",\n inputSchema: {\n type: \"object\" as const,\n properties: {\n code: {\n type: \"string\",\n description: \"The code or diff to review\",\n },\n language: {\n type: \"string\",\n description: \"Programming language\",\n },\n scope: {\n type: \"string\",\n description:\n \"Specific areas to focus on (e.g., 'error handling', 'performance')\",\n },\n project_guidelines: {\n type: \"string\",\n description: \"Project-specific guidelines to check\",\n },\n },\n required: [\"code\"],\n },\n },\n {\n name: \"jai1_review_security\",\n description:\n \"Audit code for security vulnerabilities. Returns security checklist and vulnerability report.\",\n inputSchema: {\n type: \"object\" as const,\n properties: {\n code: {\n type: \"string\",\n description: \"The code or diff to audit\",\n },\n language: {\n type: \"string\",\n description: \"Programming language\",\n },\n context: {\n type: \"string\",\n description:\n \"Context about the code (e.g., 'authentication endpoint', 'file upload handler')\",\n },\n },\n required: [\"code\"],\n },\n },\n {\n name: \"jai1_generate_commit\",\n description:\n \"Generate a commit message from a git diff. Returns Conventional Commits formatted message.\",\n inputSchema: {\n type: \"object\" as const,\n properties: {\n diff: {\n type: \"string\",\n description: \"Git diff content\",\n },\n files_changed: {\n type: \"string\",\n description: \"List of files changed with status\",\n },\n },\n required: [\"diff\"],\n },\n },\n];\n\nasync function main() {\n // Load configuration\n let config;\n try {\n config = loadConfig();\n } catch (error) {\n console.error(error instanceof Error ? error.message : String(error));\n process.exit(1);\n }\n\n const proxy = new MCPProxy(config);\n\n // Verify server is reachable\n const isHealthy = await proxy.healthCheck();\n if (!isHealthy) {\n console.error(\n `Warning: Cannot reach MCP server at ${config.serverUrl}. ` +\n `Requests may fail.`\n );\n }\n\n // Create MCP server\n const server = new Server(\n {\n name: \"jai1-mcp\",\n version: \"1.0.0\",\n },\n {\n capabilities: {\n tools: {},\n },\n }\n );\n\n // Handle tool listing\n server.setRequestHandler(ListToolsRequestSchema, async () => {\n return { tools: TOOLS };\n });\n\n // Handle tool execution\n server.setRequestHandler(CallToolRequestSchema, async (request) => {\n const { name, arguments: args } = request.params;\n\n // Validate tool exists\n const tool = TOOLS.find((t) => t.name === name);\n if (!tool) {\n return {\n content: [\n {\n type: \"text\" as const,\n text: `Error: Unknown tool '${name}'. Available tools: ${TOOLS.map((t) => t.name).join(\", \")}`,\n },\n ],\n isError: true,\n };\n }\n\n try {\n // Call the remote MCP server\n const result = await proxy.callTool(name, args as Record<string, unknown>);\n\n // Handle different response types\n if (typeof result === \"string\") {\n return {\n content: [{ type: \"text\" as const, text: result }],\n };\n }\n\n if (typeof result === \"object\" && result !== null) {\n // If result has a 'result' property, extract it\n const data = (result as Record<string, unknown>).result ?? result;\n return {\n content: [\n {\n type: \"text\" as const,\n text: typeof data === \"string\" ? data : JSON.stringify(data, null, 2),\n },\n ],\n };\n }\n\n return {\n content: [{ type: \"text\" as const, text: String(result) }],\n };\n } catch (error) {\n const message =\n error instanceof ProxyError\n ? `[${error.code}] ${error.message}`\n : `Error: ${error instanceof Error ? error.message : String(error)}`;\n\n return {\n content: [{ type: \"text\" as const, text: message }],\n isError: true,\n };\n }\n });\n\n // Connect via stdio\n const transport = new StdioServerTransport();\n await server.connect(transport);\n\n // Handle graceful shutdown\n process.on(\"SIGINT\", async () => {\n await server.close();\n process.exit(0);\n });\n\n process.on(\"SIGTERM\", async () => {\n await server.close();\n process.exit(0);\n });\n}\n\nmain().catch((error) => {\n console.error(\"Fatal error:\", error);\n process.exit(1);\n});\n","import { z } from \"zod\";\n\n/**\n * Configuration schema for the MCP proxy\n */\nconst ConfigSchema = z.object({\n /** MCP Server URL */\n serverUrl: z\n .string()\n .url()\n .default(\"https://mcp.jai1.jv-it.net\"),\n\n /** JAI1 Access Key for authentication */\n accessKey: z.string().min(1, \"Access key is required\"),\n\n /** Request timeout in milliseconds */\n timeout: z.number().positive().default(60000),\n\n /** Enable debug logging */\n debug: z.boolean().default(false),\n});\n\nexport type Config = z.infer<typeof ConfigSchema>;\n\n/**\n * Load configuration from environment variables\n */\nexport function loadConfig(): Config {\n const rawConfig = {\n serverUrl: process.env.JAI1_MCP_SERVER_URL || process.env.MCP_SERVER_URL,\n accessKey: process.env.JAI1_ACCESS_KEY,\n timeout: process.env.JAI1_MCP_TIMEOUT\n ? parseInt(process.env.JAI1_MCP_TIMEOUT, 10)\n : undefined,\n debug:\n process.env.JAI1_MCP_DEBUG === \"true\" ||\n process.env.DEBUG === \"true\",\n };\n\n const result = ConfigSchema.safeParse(rawConfig);\n\n if (!result.success) {\n const errors = result.error.errors\n .map((e) => ` - ${e.path.join(\".\")}: ${e.message}`)\n .join(\"\\n\");\n throw new Error(\n `Invalid MCP proxy configuration:\\n${errors}\\n\\n` +\n `Required environment variables:\\n` +\n ` JAI1_ACCESS_KEY - Your Jai1 access key\\n\\n` +\n `Optional environment variables:\\n` +\n ` JAI1_MCP_SERVER_URL - MCP server URL (default: https://mcp.jai1.jv-it.net)\\n` +\n ` JAI1_MCP_TIMEOUT - Request timeout in ms (default: 60000)\\n` +\n ` JAI1_MCP_DEBUG - Enable debug logging (default: false)`\n );\n }\n\n return result.data;\n}\n\n/**\n * Default config for documentation purposes\n */\nexport const DEFAULT_CONFIG = {\n serverUrl: \"https://mcp.jai1.jv-it.net\",\n timeout: 60000,\n debug: false,\n} as const;\n","import type { Config } from \"./config.js\";\n\n/**\n * Error class for proxy-related errors\n */\nexport class ProxyError extends Error {\n constructor(\n message: string,\n public readonly code: string,\n public readonly statusCode?: number\n ) {\n super(message);\n this.name = \"ProxyError\";\n }\n}\n\n/**\n * HTTP client for proxying requests to the MCP server\n */\nexport class MCPProxy {\n private config: Config;\n private debug: (...args: unknown[]) => void;\n\n constructor(config: Config) {\n this.config = config;\n this.debug = config.debug\n ? (...args: unknown[]) => console.error(\"[MCP-PROXY]\", ...args)\n : () => { };\n }\n\n /**\n * Call a tool on the remote MCP server\n */\n async callTool(\n toolName: string,\n args: Record<string, unknown>\n ): Promise<unknown> {\n const url = `${this.config.serverUrl}/api/agents/tools/${toolName}/execute`;\n this.debug(`Calling tool: ${toolName}`, { url, args });\n\n const controller = new AbortController();\n const timeoutId = setTimeout(\n () => controller.abort(),\n this.config.timeout\n );\n\n try {\n const response = await fetch(url, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n Authorization: `Bearer ${this.config.accessKey}`,\n },\n body: JSON.stringify(args),\n signal: controller.signal,\n });\n\n clearTimeout(timeoutId);\n\n if (!response.ok) {\n const errorBody = await response.text();\n this.debug(`Tool error response:`, { status: response.status, body: errorBody });\n\n if (response.status === 401) {\n throw new ProxyError(\n \"Invalid JAI1_ACCESS_KEY\",\n \"ERR-MCP-001\",\n 401\n );\n }\n if (response.status === 404) {\n throw new ProxyError(\n `Tool not found: ${toolName}`,\n \"ERR-MCP-003\",\n 404\n );\n }\n throw new ProxyError(\n `Server error: ${errorBody}`,\n \"ERR-MCP-004\",\n response.status\n );\n }\n\n const result = await response.json();\n this.debug(`Tool response:`, { toolName, result });\n return result;\n } catch (error) {\n clearTimeout(timeoutId);\n\n if (error instanceof ProxyError) {\n throw error;\n }\n\n if (error instanceof Error && error.name === \"AbortError\") {\n throw new ProxyError(\n `Request timeout after ${this.config.timeout}ms`,\n \"ERR-MCP-002\",\n 504\n );\n }\n\n throw new ProxyError(\n `Network error: ${error instanceof Error ? error.message : String(error)}`,\n \"ERR-MCP-005\"\n );\n }\n }\n\n /**\n * List available tools from the MCP server\n */\n async listTools(): Promise<ToolInfo[]> {\n const url = `${this.config.serverUrl}/api/mcp/tools`;\n this.debug(`Listing tools from: ${url}`);\n\n const controller = new AbortController();\n const timeoutId = setTimeout(\n () => controller.abort(),\n this.config.timeout\n );\n\n try {\n const response = await fetch(url, {\n method: \"GET\",\n headers: {\n Authorization: `Bearer ${this.config.accessKey}`,\n },\n signal: controller.signal,\n });\n\n clearTimeout(timeoutId);\n\n if (!response.ok) {\n if (response.status === 401) {\n throw new ProxyError(\n \"Invalid JAI1_ACCESS_KEY\",\n \"ERR-MCP-001\",\n 401\n );\n }\n throw new ProxyError(\n `Failed to list tools: ${response.statusText}`,\n \"ERR-MCP-004\",\n response.status\n );\n }\n\n const data = await response.json();\n this.debug(`Available tools:`, data);\n return data.tools || [];\n } catch (error) {\n clearTimeout(timeoutId);\n\n if (error instanceof ProxyError) {\n throw error;\n }\n\n if (error instanceof Error && error.name === \"AbortError\") {\n throw new ProxyError(\n `Request timeout after ${this.config.timeout}ms`,\n \"ERR-MCP-002\",\n 504\n );\n }\n\n throw new ProxyError(\n `Network error: ${error instanceof Error ? error.message : String(error)}`,\n \"ERR-MCP-005\"\n );\n }\n }\n\n /**\n * Health check for the MCP server\n */\n async healthCheck(): Promise<boolean> {\n const url = `${this.config.serverUrl}/health`;\n this.debug(`Health check: ${url}`);\n\n try {\n const response = await fetch(url, {\n method: \"GET\",\n signal: AbortSignal.timeout(5000),\n });\n return response.ok;\n } catch {\n return false;\n }\n }\n}\n\n/**\n * Tool information returned from the server\n */\nexport interface ToolInfo {\n name: string;\n description: string;\n inputSchema: {\n type: string;\n properties: Record<string, unknown>;\n required?: string[];\n };\n}\n"],"mappings":";;;AAEA,SAAS,cAAc;AACvB,SAAS,4BAA4B;AACrC;AAAA,EACI;AAAA,EACA;AAAA,OACG;;;ACPP,SAAS,SAAS;AAKlB,IAAM,eAAe,EAAE,OAAO;AAAA;AAAA,EAE1B,WAAW,EACN,OAAO,EACP,IAAI,EACJ,QAAQ,4BAA4B;AAAA;AAAA,EAGzC,WAAW,EAAE,OAAO,EAAE,IAAI,GAAG,wBAAwB;AAAA;AAAA,EAGrD,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,GAAK;AAAA;AAAA,EAG5C,OAAO,EAAE,QAAQ,EAAE,QAAQ,KAAK;AACpC,CAAC;AAOM,SAAS,aAAqB;AACjC,QAAM,YAAY;AAAA,IACd,WAAW,QAAQ,IAAI,uBAAuB,QAAQ,IAAI;AAAA,IAC1D,WAAW,QAAQ,IAAI;AAAA,IACvB,SAAS,QAAQ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,SAAS,WAAW,OAAO,KAAK,UAAU,MAAM,MAAM,CAAC;AAAA,YACxE;AAAA,UACJ;AAAA,QACJ;AAAA,MACJ;AAEA,aAAO;AAAA,QACH,SAAS,CAAC,EAAE,MAAM,QAAiB,MAAM,OAAO,MAAM,EAAE,CAAC;AAAA,MAC7D;AAAA,IACJ,SAAS,OAAO;AACZ,YAAM,UACF,iBAAiB,aACX,IAAI,MAAM,IAAI,KAAK,MAAM,OAAO,KAChC,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC;AAE1E,aAAO;AAAA,QACH,SAAS,CAAC,EAAE,MAAM,QAAiB,MAAM,QAAQ,CAAC;AAAA,QAClD,SAAS;AAAA,MACb;AAAA,IACJ;AAAA,EACJ,CAAC;AAGD,QAAM,YAAY,IAAI,qBAAqB;AAC3C,QAAM,OAAO,QAAQ,SAAS;AAG9B,UAAQ,GAAG,UAAU,YAAY;AAC7B,UAAM,OAAO,MAAM;AACnB,YAAQ,KAAK,CAAC;AAAA,EAClB,CAAC;AAED,UAAQ,GAAG,WAAW,YAAY;AAC9B,UAAM,OAAO,MAAM;AACnB,YAAQ,KAAK,CAAC;AAAA,EAClB,CAAC;AACL;AAEA,KAAK,EAAE,MAAM,CAAC,UAAU;AACpB,UAAQ,MAAM,gBAAgB,KAAK;AACnC,UAAQ,KAAK,CAAC;AAClB,CAAC;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/config.ts","../src/proxy.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { Server } from \"@modelcontextprotocol/sdk/server/index.js\";\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\";\nimport {\n CallToolRequestSchema,\n ListToolsRequestSchema,\n} from \"@modelcontextprotocol/sdk/types.js\";\nimport { z } from \"zod\";\n\nimport { loadConfig } from \"./config.js\";\nimport { MCPProxy, ProxyError } from \"./proxy.js\";\n\n/**\n * Jai1 MCP Proxy Server\n * \n * This is a stdio MCP server that acts as a proxy to the remote Jai1 MCP Server.\n * It allows IDE AI agents (Cursor, Windsurf) to access Jai1 developer tools.\n * \n * Usage:\n * JAI1_ACCESS_KEY=your_key npx @jvittechs/jai1-mcp\n * \n * Or in Cursor MCP config:\n * {\n * \"mcpServers\": {\n * \"jai1\": {\n * \"command\": \"npx\",\n * \"args\": [\"@jvittechs/jai1-mcp\"],\n * \"env\": {\n * \"JAI1_ACCESS_KEY\": \"your_key\"\n * }\n * }\n * }\n * }\n */\n\n// Tool definitions matching the mcp-server tools\nconst TOOLS = [\n {\n name: \"jai1_plan_feature\",\n description:\n \"Create a structured development plan for a feature. Returns requirements, design approach, and task breakdown.\",\n inputSchema: {\n type: \"object\" as const,\n properties: {\n feature_description: {\n type: \"string\",\n description: \"Description of the feature to plan\",\n },\n codebase_context: {\n type: \"string\",\n description:\n \"Current codebase context (tech stack, patterns, relevant code)\",\n },\n tech_stack: {\n type: \"string\",\n description: \"Tech stack being used\",\n },\n constraints: {\n type: \"string\",\n description: \"Any constraints or requirements to consider\",\n },\n },\n required: [\"feature_description\"],\n },\n },\n {\n name: \"jai1_suggest_techstack\",\n description:\n \"Get tech stack recommendations based on project requirements. Returns recommended technologies with justification.\",\n inputSchema: {\n type: \"object\" as const,\n properties: {\n requirements: {\n type: \"string\",\n description: \"Project requirements and goals\",\n },\n project_type: {\n type: \"string\",\n description: \"Type of project (web app, mobile, API, CLI, etc.)\",\n },\n constraints: {\n type: \"string\",\n description: \"Constraints (budget, team skills, timeline)\",\n },\n preferences: {\n type: \"string\",\n description: \"Any technology preferences or existing stack\",\n },\n },\n required: [\"requirements\"],\n },\n },\n {\n name: \"jai1_research\",\n description:\n \"Research a technical topic. Returns structured summary with key concepts, best practices, and resources.\",\n inputSchema: {\n type: \"object\" as const,\n properties: {\n topic: {\n type: \"string\",\n description: \"The topic to research\",\n },\n context: {\n type: \"string\",\n description: \"Context for the research (project, use case)\",\n },\n depth: {\n type: \"string\",\n enum: [\"brief\", \"standard\", \"deep\"],\n description:\n \"Depth of research: brief (overview), standard (detailed), deep (comprehensive)\",\n },\n },\n required: [\"topic\"],\n },\n },\n {\n name: \"jai1_review_code\",\n description:\n \"Review code for quality, maintainability, and best practices. Returns quality checklist and improvement suggestions.\",\n inputSchema: {\n type: \"object\" as const,\n properties: {\n code: {\n type: \"string\",\n description: \"The code or diff to review\",\n },\n language: {\n type: \"string\",\n description: \"Programming language\",\n },\n scope: {\n type: \"string\",\n description:\n \"Specific areas to focus on (e.g., 'error handling', 'performance')\",\n },\n project_guidelines: {\n type: \"string\",\n description: \"Project-specific guidelines to check\",\n },\n },\n required: [\"code\"],\n },\n },\n {\n name: \"jai1_review_security\",\n description:\n \"Audit code for security vulnerabilities. Returns security checklist and vulnerability report.\",\n inputSchema: {\n type: \"object\" as const,\n properties: {\n code: {\n type: \"string\",\n description: \"The code or diff to audit\",\n },\n language: {\n type: \"string\",\n description: \"Programming language\",\n },\n context: {\n type: \"string\",\n description:\n \"Context about the code (e.g., 'authentication endpoint', 'file upload handler')\",\n },\n },\n required: [\"code\"],\n },\n },\n {\n name: \"jai1_generate_commit\",\n description:\n \"Generate a commit message from a git diff. Returns Conventional Commits formatted message.\",\n inputSchema: {\n type: \"object\" as const,\n properties: {\n diff: {\n type: \"string\",\n description: \"Git diff content\",\n },\n files_changed: {\n type: \"string\",\n description: \"List of files changed with status\",\n },\n },\n required: [\"diff\"],\n },\n },\n];\n\nasync function main() {\n // Load configuration\n let config;\n try {\n config = loadConfig();\n } catch (error) {\n console.error(error instanceof Error ? error.message : String(error));\n process.exit(1);\n }\n\n const proxy = new MCPProxy(config);\n\n // Verify server is reachable\n const isHealthy = await proxy.healthCheck();\n if (!isHealthy) {\n console.error(\n `Warning: Cannot reach MCP server at ${config.serverUrl}. ` +\n `Requests may fail.`\n );\n }\n\n // Create MCP server\n const server = new Server(\n {\n name: \"jai1-mcp\",\n version: \"1.0.0\",\n },\n {\n capabilities: {\n tools: {},\n },\n }\n );\n\n // Handle tool listing\n server.setRequestHandler(ListToolsRequestSchema, async () => {\n return { tools: TOOLS };\n });\n\n // Handle tool execution\n server.setRequestHandler(CallToolRequestSchema, async (request) => {\n const { name, arguments: args } = request.params;\n\n // Validate tool exists\n const tool = TOOLS.find((t) => t.name === name);\n if (!tool) {\n return {\n content: [\n {\n type: \"text\" as const,\n text: `Error: Unknown tool '${name}'. Available tools: ${TOOLS.map((t) => t.name).join(\", \")}`,\n },\n ],\n isError: true,\n };\n }\n\n try {\n // Call the remote MCP server\n const result = await proxy.callTool(name, args as Record<string, unknown>);\n\n // Handle different response types\n if (typeof result === \"string\") {\n return {\n content: [{ type: \"text\" as const, text: result }],\n };\n }\n\n if (typeof result === \"object\" && result !== null) {\n // If result has a 'result' property, extract it\n const data = (result as Record<string, unknown>).result ?? result;\n return {\n content: [\n {\n type: \"text\" as const,\n text: typeof data === \"string\" ? data : JSON.stringify(data, null, 2),\n },\n ],\n };\n }\n\n return {\n content: [{ type: \"text\" as const, text: String(result) }],\n };\n } catch (error) {\n const message =\n error instanceof ProxyError\n ? `[${error.code}] ${error.message}`\n : `Error: ${error instanceof Error ? error.message : String(error)}`;\n\n return {\n content: [{ type: \"text\" as const, text: message }],\n isError: true,\n };\n }\n });\n\n // Connect via stdio\n const transport = new StdioServerTransport();\n await server.connect(transport);\n\n // Handle graceful shutdown\n process.on(\"SIGINT\", async () => {\n await server.close();\n process.exit(0);\n });\n\n process.on(\"SIGTERM\", async () => {\n await server.close();\n process.exit(0);\n });\n}\n\nmain().catch((error) => {\n console.error(\"Fatal error:\", error);\n process.exit(1);\n});\n","import { z } from \"zod\";\n\n/**\n * Configuration schema for the MCP proxy\n * \n * Required environment variables:\n * - JAI1_ACCESS_KEY: Your Jai1 access key\n * - JAI1_MCP_SERVER_URL: MCP server URL (e.g., https://mcp.example.com)\n * \n * Optional environment variables:\n * - JAI1_MCP_TIMEOUT: Request timeout in ms (default: 120000)\n * - JAI1_MCP_DEBUG: Enable debug logging (default: false)\n */\nconst ConfigSchema = z.object({\n /** MCP Server URL - REQUIRED, no default to avoid exposing URL in published package */\n serverUrl: z\n .string()\n .url(\"JAI1_MCP_SERVER_URL must be a valid URL\"),\n\n /** JAI1 Access Key for authentication */\n accessKey: z.string().min(1, \"JAI1_ACCESS_KEY is required\"),\n\n /** Request timeout in milliseconds */\n timeout: z.number().positive().default(120000),\n\n /** Enable debug logging */\n debug: z.boolean().default(false),\n});\n\nexport type Config = z.infer<typeof ConfigSchema>;\n\n/**\n * Load configuration from environment variables\n * \n * Example Cursor MCP config:\n * ```json\n * {\n * \"mcpServers\": {\n * \"jai1\": {\n * \"command\": \"npx\",\n * \"args\": [\"@jvittechs/jai1-mcp\"],\n * \"env\": {\n * \"JAI1_ACCESS_KEY\": \"your_access_key\",\n * \"JAI1_MCP_SERVER_URL\": \"https://mcp.example.com\"\n * }\n * }\n * }\n * }\n * ```\n */\nexport function loadConfig(): Config {\n const rawConfig = {\n serverUrl: process.env.JAI1_MCP_SERVER_URL,\n accessKey: process.env.JAI1_ACCESS_KEY,\n timeout: process.env.JAI1_MCP_TIMEOUT\n ? parseInt(process.env.JAI1_MCP_TIMEOUT, 10)\n : undefined,\n debug:\n process.env.JAI1_MCP_DEBUG === \"true\" ||\n process.env.DEBUG === \"true\",\n };\n\n const result = ConfigSchema.safeParse(rawConfig);\n\n if (!result.success) {\n const errors = result.error.errors\n .map((e) => ` - ${e.path.join(\".\")}: ${e.message}`)\n .join(\"\\n\");\n throw new Error(\n `Invalid MCP proxy configuration:\\n${errors}\\n\\n` +\n `Required environment variables:\\n` +\n ` JAI1_ACCESS_KEY - Your Jai1 access key\\n` +\n ` JAI1_MCP_SERVER_URL - MCP server URL\\n\\n` +\n `Optional environment variables:\\n` +\n ` JAI1_MCP_TIMEOUT - Request timeout in ms (default: 120000)\\n` +\n ` JAI1_MCP_DEBUG - Enable debug logging (default: false)\\n\\n` +\n `Example Cursor MCP config:\\n` +\n ` {\\n` +\n ` \"mcpServers\": {\\n` +\n ` \"jai1\": {\\n` +\n ` \"command\": \"npx\",\\n` +\n ` \"args\": [\"@jvittechs/jai1-mcp\"],\\n` +\n ` \"env\": {\\n` +\n ` \"JAI1_ACCESS_KEY\": \"your_key\",\\n` +\n ` \"JAI1_MCP_SERVER_URL\": \"https://mcp.example.com\"\\n` +\n ` }\\n` +\n ` }\\n` +\n ` }\\n` +\n ` }`\n );\n }\n\n return result.data;\n}\n\n/**\n * Default config values for documentation purposes\n * Note: serverUrl has no default - must be provided via env\n */\nexport const DEFAULT_CONFIG = {\n timeout: 120000,\n debug: false,\n} as const;\n\n","import type { Config } from \"./config.js\";\n\n/**\n * Error class for proxy-related errors\n */\nexport class ProxyError extends Error {\n constructor(\n message: string,\n public readonly code: string,\n public readonly statusCode?: number\n ) {\n super(message);\n this.name = \"ProxyError\";\n }\n}\n\n/**\n * Tool to Agent mapping\n * Maps MCP tool names to their corresponding agent IDs on the server\n */\nconst TOOL_TO_AGENT: Record<string, string> = {\n jai1_plan_feature: \"planning-agent\",\n jai1_suggest_techstack: \"research-agent\",\n jai1_research: \"research-agent\",\n jai1_review_code: \"code-review-agent\",\n jai1_review_security: \"security-agent\",\n jai1_generate_commit: \"commit-agent\",\n};\n\n/**\n * Format tool arguments into a prompt message for the agent\n */\nfunction formatToolArgsToPrompt(toolName: string, args: Record<string, unknown>): string {\n switch (toolName) {\n case \"jai1_plan_feature\":\n return [\n `Feature: ${args.feature_description}`,\n args.codebase_context && `Codebase Context: ${args.codebase_context}`,\n args.tech_stack && `Tech Stack: ${args.tech_stack}`,\n args.constraints && `Constraints: ${args.constraints}`,\n ]\n .filter(Boolean)\n .join(\"\\n\\n\");\n\n case \"jai1_suggest_techstack\":\n return [\n `Project Requirements: ${args.requirements}`,\n args.project_type && `Project Type: ${args.project_type}`,\n args.constraints && `Constraints: ${args.constraints}`,\n args.preferences && `Preferences: ${args.preferences}`,\n \"\\nPlease recommend an optimal tech stack.\",\n ]\n .filter(Boolean)\n .join(\"\\n\");\n\n case \"jai1_research\": {\n const depthInstructions: Record<string, string> = {\n brief: \"Provide a brief overview.\",\n standard: \"Provide a detailed analysis.\",\n deep: \"Provide a comprehensive, in-depth analysis.\",\n };\n return [\n `Research Topic: ${args.topic}`,\n args.context && `Context: ${args.context}`,\n depthInstructions[(args.depth as string) || \"standard\"],\n ]\n .filter(Boolean)\n .join(\"\\n\");\n }\n\n case \"jai1_review_code\":\n return [\n args.language && `Language: ${args.language}`,\n args.scope && `Focus areas: ${args.scope}`,\n args.project_guidelines && `Project guidelines: ${args.project_guidelines}`,\n \"\\n```\\n\" + args.code + \"\\n```\",\n \"\\nPlease review this code for quality and best practices.\",\n ]\n .filter(Boolean)\n .join(\"\\n\");\n\n case \"jai1_review_security\":\n return [\n args.language && `Language: ${args.language}`,\n args.context && `Context: ${args.context}`,\n \"\\n```\\n\" + args.code + \"\\n```\",\n \"\\nPlease audit this code for security vulnerabilities.\",\n ]\n .filter(Boolean)\n .join(\"\\n\");\n\n case \"jai1_generate_commit\":\n return [\n args.files_changed && `Files changed:\\n${args.files_changed}`,\n `\\nDiff:\\n\\`\\`\\`diff\\n${args.diff}\\n\\`\\`\\``,\n \"\\nGenerate a commit message for these changes.\",\n ]\n .filter(Boolean)\n .join(\"\\n\");\n\n default:\n // Fallback: just stringify all args\n return Object.entries(args)\n .map(([key, value]) => `${key}: ${value}`)\n .join(\"\\n\");\n }\n}\n\n/**\n * HTTP client for proxying requests to the MCP server\n */\nexport class MCPProxy {\n private config: Config;\n private debug: (...args: unknown[]) => void;\n\n constructor(config: Config) {\n this.config = config;\n this.debug = config.debug\n ? (...args: unknown[]) => console.error(\"[MCP-PROXY]\", ...args)\n : () => { };\n }\n\n /**\n * Call a tool on the remote MCP server\n * Maps tools to agents and calls the Mastra generate endpoint\n */\n async callTool(\n toolName: string,\n args: Record<string, unknown>\n ): Promise<unknown> {\n // Get the agent ID for this tool\n const agentId = TOOL_TO_AGENT[toolName];\n if (!agentId) {\n throw new ProxyError(\n `Unknown tool: ${toolName}. Available: ${Object.keys(TOOL_TO_AGENT).join(\", \")}`,\n \"ERR-MCP-003\",\n 404\n );\n }\n\n // Build the correct endpoint URL\n const url = `${this.config.serverUrl}/api/agents/${agentId}/generate`;\n\n // Format args into a message prompt\n const prompt = formatToolArgsToPrompt(toolName, args);\n const body = {\n messages: [{ role: \"user\", content: prompt }],\n };\n\n this.debug(`Calling tool: ${toolName}`, { url, agentId, prompt: prompt.substring(0, 100) });\n\n const controller = new AbortController();\n const timeoutId = setTimeout(\n () => controller.abort(),\n this.config.timeout\n );\n\n try {\n const response = await fetch(url, {\n method: \"POST\",\n headers: {\n \"Content-Type\": \"application/json\",\n Authorization: `Bearer ${this.config.accessKey}`,\n },\n body: JSON.stringify(body),\n signal: controller.signal,\n });\n\n clearTimeout(timeoutId);\n\n if (!response.ok) {\n const errorBody = await response.text();\n this.debug(`Tool error response:`, { status: response.status, body: errorBody });\n\n if (response.status === 401) {\n throw new ProxyError(\n \"Invalid JAI1_ACCESS_KEY\",\n \"ERR-MCP-001\",\n 401\n );\n }\n if (response.status === 404) {\n throw new ProxyError(\n `Agent not found: ${agentId}`,\n \"ERR-MCP-003\",\n 404\n );\n }\n throw new ProxyError(\n `Server error: ${errorBody}`,\n \"ERR-MCP-004\",\n response.status\n );\n }\n\n const result = await response.json() as { text?: string };\n this.debug(`Tool response:`, { toolName, hasText: !!result.text });\n\n // Return the text content from the agent response\n return result.text || result;\n } catch (error) {\n clearTimeout(timeoutId);\n\n if (error instanceof ProxyError) {\n throw error;\n }\n\n if (error instanceof Error && error.name === \"AbortError\") {\n throw new ProxyError(\n `Request timeout after ${this.config.timeout}ms`,\n \"ERR-MCP-002\",\n 504\n );\n }\n\n throw new ProxyError(\n `Network error: ${error instanceof Error ? error.message : String(error)}`,\n \"ERR-MCP-005\"\n );\n }\n }\n\n /**\n * List available tools from the MCP server\n */\n async listTools(): Promise<ToolInfo[]> {\n const url = `${this.config.serverUrl}/api/mcp/tools`;\n this.debug(`Listing tools from: ${url}`);\n\n const controller = new AbortController();\n const timeoutId = setTimeout(\n () => controller.abort(),\n this.config.timeout\n );\n\n try {\n const response = await fetch(url, {\n method: \"GET\",\n headers: {\n Authorization: `Bearer ${this.config.accessKey}`,\n },\n signal: controller.signal,\n });\n\n clearTimeout(timeoutId);\n\n if (!response.ok) {\n if (response.status === 401) {\n throw new ProxyError(\n \"Invalid JAI1_ACCESS_KEY\",\n \"ERR-MCP-001\",\n 401\n );\n }\n throw new ProxyError(\n `Failed to list tools: ${response.statusText}`,\n \"ERR-MCP-004\",\n response.status\n );\n }\n\n const data = await response.json();\n this.debug(`Available tools:`, data);\n return data.tools || [];\n } catch (error) {\n clearTimeout(timeoutId);\n\n if (error instanceof ProxyError) {\n throw error;\n }\n\n if (error instanceof Error && error.name === \"AbortError\") {\n throw new ProxyError(\n `Request timeout after ${this.config.timeout}ms`,\n \"ERR-MCP-002\",\n 504\n );\n }\n\n throw new ProxyError(\n `Network error: ${error instanceof Error ? error.message : String(error)}`,\n \"ERR-MCP-005\"\n );\n }\n }\n\n /**\n * Health check for the MCP server\n */\n async healthCheck(): Promise<boolean> {\n const url = `${this.config.serverUrl}/health`;\n this.debug(`Health check: ${url}`);\n\n try {\n const response = await fetch(url, {\n method: \"GET\",\n signal: AbortSignal.timeout(5000),\n });\n return response.ok;\n } catch {\n return false;\n }\n }\n}\n\n/**\n * Tool information returned from the server\n */\nexport interface ToolInfo {\n name: string;\n description: string;\n inputSchema: {\n type: string;\n properties: Record<string, unknown>;\n required?: string[];\n };\n}\n"],"mappings":";;;AAEA,SAAS,cAAc;AACvB,SAAS,4BAA4B;AACrC;AAAA,EACI;AAAA,EACA;AAAA,OACG;;;ACPP,SAAS,SAAS;AAalB,IAAM,eAAe,EAAE,OAAO;AAAA;AAAA,EAE1B,WAAW,EACN,OAAO,EACP,IAAI,yCAAyC;AAAA;AAAA,EAGlD,WAAW,EAAE,OAAO,EAAE,IAAI,GAAG,6BAA6B;AAAA;AAAA,EAG1D,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,I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
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
2
|
+
"name": "@jvittechs/jai1-mcp",
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"description": "MCP stdio proxy for Jai1 MCP Server - connects IDE AI agents to Jai1 developer tools",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"jai1-mcp": "dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"exports": {
|
|
10
|
+
".": "./dist/index.js"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist",
|
|
14
|
+
"README.md"
|
|
15
|
+
],
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": ">=20"
|
|
18
|
+
},
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"author": "JVIT <dev@jvit.com>",
|
|
21
|
+
"keywords": [
|
|
22
|
+
"jai1",
|
|
23
|
+
"mcp",
|
|
24
|
+
"model-context-protocol",
|
|
25
|
+
"ai",
|
|
26
|
+
"cursor",
|
|
27
|
+
"windsurf",
|
|
28
|
+
"developer-tools"
|
|
29
|
+
],
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
32
|
+
"zod": "^3.23.8"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@types/node": "^22.19.2",
|
|
36
|
+
"tsup": "^8.1.0",
|
|
37
|
+
"tsx": "^4.21.0",
|
|
38
|
+
"typescript": "^5.9.3",
|
|
39
|
+
"vitest": "^2.1.4"
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"build": "tsup src/index.ts --format esm --target node22 --out-dir dist --sourcemap --dts",
|
|
43
|
+
"dev": "tsx src/index.ts",
|
|
44
|
+
"lint": "eslint .",
|
|
45
|
+
"test": "vitest run",
|
|
46
|
+
"smart-publish": "node scripts/smart-publish.js"
|
|
47
|
+
}
|
|
48
|
+
}
|