codingbuddy 0.0.0-canary.20251223150131.44c6508 → 0.0.0-canary.20251226054455.67dbcba
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 +37 -0
- package/dist/api/mcp.d.ts +2 -0
- package/dist/api/mcp.js +92 -0
- package/dist/api/mcp.js.map +1 -0
- package/dist/src/mcp/mcp-serverless.d.ts +27 -0
- package/dist/src/mcp/mcp-serverless.js +351 -0
- package/dist/src/mcp/mcp-serverless.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +3 -2
- package/dist/vitest.config.d.ts +0 -2
- package/dist/vitest.config.js +0 -23
- package/dist/vitest.config.js.map +0 -1
package/README.md
CHANGED
|
@@ -134,6 +134,43 @@ The server will start in SSE mode, exposing:
|
|
|
134
134
|
- `GET /sse`: SSE Endpoint
|
|
135
135
|
- `POST /messages`: Message Endpoint
|
|
136
136
|
|
|
137
|
+
### Option 5: Vercel Deployment
|
|
138
|
+
|
|
139
|
+
The MCP server can be deployed to Vercel as a serverless function:
|
|
140
|
+
|
|
141
|
+
#### Deploy
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
cd apps/mcp-server
|
|
145
|
+
npx vercel deploy
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
#### Endpoint
|
|
149
|
+
|
|
150
|
+
- **URL**: `https://your-project.vercel.app/api/mcp`
|
|
151
|
+
- **Method**: POST
|
|
152
|
+
- **Content-Type**: application/json
|
|
153
|
+
|
|
154
|
+
#### Example Request
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
curl -X POST https://your-project.vercel.app/api/mcp \
|
|
158
|
+
-H "Content-Type: application/json" \
|
|
159
|
+
-d '{
|
|
160
|
+
"jsonrpc": "2.0",
|
|
161
|
+
"method": "tools/list",
|
|
162
|
+
"id": 1
|
|
163
|
+
}'
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Transport Modes
|
|
167
|
+
|
|
168
|
+
| Mode | Use Case | Command |
|
|
169
|
+
|------|----------|---------|
|
|
170
|
+
| Stdio | CLI integration | `yarn start` |
|
|
171
|
+
| SSE | Self-hosted HTTP | `MCP_TRANSPORT=sse yarn start` |
|
|
172
|
+
| Vercel | Serverless HTTPS | `npx vercel deploy` |
|
|
173
|
+
|
|
137
174
|
## Environment Variables
|
|
138
175
|
|
|
139
176
|
| Variable | Description | Default |
|
package/dist/api/mcp.js
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = handler;
|
|
4
|
+
const streamableHttp_js_1 = require("@modelcontextprotocol/sdk/server/streamableHttp.js");
|
|
5
|
+
const mcp_serverless_1 = require("../src/mcp/mcp-serverless");
|
|
6
|
+
const MAX_BODY_SIZE = 1024 * 1024;
|
|
7
|
+
const ALLOWED_METHODS = ['GET', 'POST', 'DELETE', 'OPTIONS'];
|
|
8
|
+
let mcpService = null;
|
|
9
|
+
function getService() {
|
|
10
|
+
if (!mcpService) {
|
|
11
|
+
mcpService = new mcp_serverless_1.McpServerlessService();
|
|
12
|
+
}
|
|
13
|
+
return mcpService;
|
|
14
|
+
}
|
|
15
|
+
function jsonRpcError(res, code, message, status = 500) {
|
|
16
|
+
res.status(status).json({
|
|
17
|
+
jsonrpc: '2.0',
|
|
18
|
+
error: { code, message },
|
|
19
|
+
id: null,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
async function parseBody(req) {
|
|
23
|
+
if (req.body && typeof req.body === 'object') {
|
|
24
|
+
return req.body;
|
|
25
|
+
}
|
|
26
|
+
const chunks = [];
|
|
27
|
+
let totalSize = 0;
|
|
28
|
+
for await (const chunk of req) {
|
|
29
|
+
totalSize += chunk.length;
|
|
30
|
+
if (totalSize > MAX_BODY_SIZE) {
|
|
31
|
+
throw new Error('PAYLOAD_TOO_LARGE');
|
|
32
|
+
}
|
|
33
|
+
chunks.push(chunk);
|
|
34
|
+
}
|
|
35
|
+
if (chunks.length === 0) {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
const bodyStr = Buffer.concat(chunks).toString('utf-8');
|
|
39
|
+
return JSON.parse(bodyStr);
|
|
40
|
+
}
|
|
41
|
+
async function handler(req, res) {
|
|
42
|
+
res.setHeader('Access-Control-Allow-Origin', '*');
|
|
43
|
+
res.setHeader('Access-Control-Allow-Methods', ALLOWED_METHODS.join(', '));
|
|
44
|
+
res.setHeader('Access-Control-Allow-Headers', 'Content-Type, mcp-session-id');
|
|
45
|
+
if (req.method === 'OPTIONS') {
|
|
46
|
+
res.status(200).end();
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (!req.method || !ALLOWED_METHODS.includes(req.method)) {
|
|
50
|
+
return jsonRpcError(res, -32600, 'Method not allowed', 405);
|
|
51
|
+
}
|
|
52
|
+
const contentLength = req.headers['content-length'];
|
|
53
|
+
if (contentLength && parseInt(contentLength, 10) > MAX_BODY_SIZE) {
|
|
54
|
+
return jsonRpcError(res, -32700, 'Request entity too large', 413);
|
|
55
|
+
}
|
|
56
|
+
if (req.method === 'POST') {
|
|
57
|
+
const contentType = req.headers['content-type'] || '';
|
|
58
|
+
if (!contentType.includes('application/json')) {
|
|
59
|
+
return jsonRpcError(res, -32700, 'Unsupported Media Type: expected application/json', 415);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
try {
|
|
63
|
+
let body;
|
|
64
|
+
if (req.method === 'POST') {
|
|
65
|
+
try {
|
|
66
|
+
body = await parseBody(req);
|
|
67
|
+
}
|
|
68
|
+
catch (parseError) {
|
|
69
|
+
if (parseError instanceof Error &&
|
|
70
|
+
parseError.message === 'PAYLOAD_TOO_LARGE') {
|
|
71
|
+
return jsonRpcError(res, -32700, 'Request entity too large', 413);
|
|
72
|
+
}
|
|
73
|
+
console.error('Body parse error:', parseError);
|
|
74
|
+
return jsonRpcError(res, -32700, 'Parse error: invalid JSON', 400);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const service = getService();
|
|
78
|
+
const server = service.getServer();
|
|
79
|
+
const transport = new streamableHttp_js_1.StreamableHTTPServerTransport({
|
|
80
|
+
sessionIdGenerator: undefined,
|
|
81
|
+
enableJsonResponse: true,
|
|
82
|
+
});
|
|
83
|
+
await server.connect(transport);
|
|
84
|
+
await transport.handleRequest(req, res, body);
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
console.error('MCP handler error:', error);
|
|
88
|
+
const message = error instanceof Error ? error.message : 'Internal server error';
|
|
89
|
+
return jsonRpcError(res, -32603, message);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=mcp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../api/mcp.ts"],"names":[],"mappings":";;AAyDA,0BAiFC;AAzID,0FAAmG;AACnG,8DAAiE;AAGjE,MAAM,aAAa,GAAG,IAAI,GAAG,IAAI,CAAC;AAClC,MAAM,eAAe,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;AAG7D,IAAI,UAAU,GAAgC,IAAI,CAAC;AAEnD,SAAS,UAAU;IACjB,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,UAAU,GAAG,IAAI,qCAAoB,EAAE,CAAC;IAC1C,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,SAAS,YAAY,CACnB,GAAmB,EACnB,IAAY,EACZ,OAAe,EACf,SAAiB,GAAG;IAEpB,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC;QACtB,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;QACxB,EAAE,EAAE,IAAI;KACT,CAAC,CAAC;AACL,CAAC;AAED,KAAK,UAAU,SAAS,CAAC,GAAkB;IAEzC,IAAI,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CAAC;QACH,CAAC;QAED,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;QAC7B,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;QAGnC,MAAM,SAAS,GAAG,IAAI,iDAA6B,CAAC;YAClD,kBAAkB,EAAE,SAAS;YAC7B,kBAAkB,EAAE,IAAI;SACzB,CAAC,CAAC;QAGH,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAGhC,MAAM,SAAS,CAAC,aAAa,CAC3B,GAA2C,EAC3C,GAA4C,EAC5C,IAAI,CACL,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC;QAC3C,MAAM,OAAO,GACX,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,uBAAuB,CAAC;QACnE,OAAO,YAAY,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC5C,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
export declare class McpServerlessService {
|
|
3
|
+
private server;
|
|
4
|
+
private rulesDir;
|
|
5
|
+
private projectRoot;
|
|
6
|
+
constructor(rulesDir?: string, projectRoot?: string);
|
|
7
|
+
getServer(): McpServer;
|
|
8
|
+
setRulesDir(rulesDir: string): void;
|
|
9
|
+
setProjectRoot(projectRoot: string): void;
|
|
10
|
+
private findRulesDir;
|
|
11
|
+
private registerTools;
|
|
12
|
+
private registerResources;
|
|
13
|
+
private handleSearchRules;
|
|
14
|
+
private handleGetAgentDetails;
|
|
15
|
+
private handleParseMode;
|
|
16
|
+
private handleGetProjectConfig;
|
|
17
|
+
private handleSuggestConfigUpdates;
|
|
18
|
+
private getRuleContent;
|
|
19
|
+
private listAgents;
|
|
20
|
+
private getAgent;
|
|
21
|
+
private searchRules;
|
|
22
|
+
private parseMode;
|
|
23
|
+
private getRulesForMode;
|
|
24
|
+
private loadProjectSettings;
|
|
25
|
+
private jsonResponse;
|
|
26
|
+
private errorResponse;
|
|
27
|
+
}
|
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.McpServerlessService = void 0;
|
|
4
|
+
const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
5
|
+
const z = require("zod");
|
|
6
|
+
const fs = require("fs/promises");
|
|
7
|
+
const fs_1 = require("fs");
|
|
8
|
+
const path = require("path");
|
|
9
|
+
const keyword_types_1 = require("../keyword/keyword.types");
|
|
10
|
+
const config_loader_1 = require("../config/config.loader");
|
|
11
|
+
const DEFAULT_MODE_CONFIG = {
|
|
12
|
+
modes: {
|
|
13
|
+
PLAN: {
|
|
14
|
+
description: 'Task planning and design phase',
|
|
15
|
+
instructions: 'Design first approach. Define test cases from TDD perspective. Review architecture before implementation.',
|
|
16
|
+
rules: ['rules/core.md', 'rules/augmented-coding.md'],
|
|
17
|
+
},
|
|
18
|
+
ACT: {
|
|
19
|
+
description: 'Actual task execution phase',
|
|
20
|
+
instructions: 'Follow Red-Green-Refactor cycle. Implement minimally then improve incrementally. Verify quality standards.',
|
|
21
|
+
rules: ['rules/core.md', 'rules/project.md', 'rules/augmented-coding.md'],
|
|
22
|
+
},
|
|
23
|
+
EVAL: {
|
|
24
|
+
description: 'Result review and assessment phase',
|
|
25
|
+
instructions: 'Review code quality. Verify SOLID principles. Check test coverage. Suggest improvements.',
|
|
26
|
+
rules: ['rules/core.md', 'rules/augmented-coding.md'],
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
defaultMode: 'PLAN',
|
|
30
|
+
};
|
|
31
|
+
class McpServerlessService {
|
|
32
|
+
constructor(rulesDir, projectRoot) {
|
|
33
|
+
this.rulesDir = rulesDir ?? this.findRulesDir();
|
|
34
|
+
this.projectRoot = projectRoot ?? process.cwd();
|
|
35
|
+
this.server = new mcp_js_1.McpServer({
|
|
36
|
+
name: 'codingbuddy',
|
|
37
|
+
version: '1.0.0',
|
|
38
|
+
});
|
|
39
|
+
this.registerTools();
|
|
40
|
+
this.registerResources();
|
|
41
|
+
}
|
|
42
|
+
getServer() {
|
|
43
|
+
return this.server;
|
|
44
|
+
}
|
|
45
|
+
setRulesDir(rulesDir) {
|
|
46
|
+
this.rulesDir = rulesDir;
|
|
47
|
+
}
|
|
48
|
+
setProjectRoot(projectRoot) {
|
|
49
|
+
this.projectRoot = projectRoot;
|
|
50
|
+
}
|
|
51
|
+
findRulesDir() {
|
|
52
|
+
if (process.env.CODINGBUDDY_RULES_DIR) {
|
|
53
|
+
return process.env.CODINGBUDDY_RULES_DIR;
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
const { rulesPath } = require('codingbuddy-rules');
|
|
57
|
+
return rulesPath;
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
}
|
|
61
|
+
const candidates = [
|
|
62
|
+
path.resolve(__dirname, '../../../../packages/rules/.ai-rules'),
|
|
63
|
+
path.resolve(__dirname, '../../../packages/rules/.ai-rules'),
|
|
64
|
+
path.resolve(__dirname, '../../../../.ai-rules'),
|
|
65
|
+
path.resolve(__dirname, '../../../.ai-rules'),
|
|
66
|
+
];
|
|
67
|
+
for (const candidate of candidates) {
|
|
68
|
+
if ((0, fs_1.existsSync)(candidate)) {
|
|
69
|
+
return candidate;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return candidates[0];
|
|
73
|
+
}
|
|
74
|
+
registerTools() {
|
|
75
|
+
this.server.registerTool('search_rules', {
|
|
76
|
+
title: 'Search Rules',
|
|
77
|
+
description: 'Search for rules and guidelines',
|
|
78
|
+
inputSchema: {
|
|
79
|
+
query: z.string().describe('Search query'),
|
|
80
|
+
},
|
|
81
|
+
}, async ({ query }) => {
|
|
82
|
+
return this.handleSearchRules(query);
|
|
83
|
+
});
|
|
84
|
+
this.server.registerTool('get_agent_details', {
|
|
85
|
+
title: 'Get Agent Details',
|
|
86
|
+
description: 'Get detailed profile of a specific AI agent',
|
|
87
|
+
inputSchema: {
|
|
88
|
+
agentName: z.string().describe('Name of the agent'),
|
|
89
|
+
},
|
|
90
|
+
}, async ({ agentName }) => {
|
|
91
|
+
return this.handleGetAgentDetails(agentName);
|
|
92
|
+
});
|
|
93
|
+
this.server.registerTool('parse_mode', {
|
|
94
|
+
title: 'Parse Mode',
|
|
95
|
+
description: 'Parse workflow mode keyword from prompt and return mode-specific rules with project language setting',
|
|
96
|
+
inputSchema: {
|
|
97
|
+
prompt: z
|
|
98
|
+
.string()
|
|
99
|
+
.describe('User prompt that may start with PLAN/ACT/EVAL keyword'),
|
|
100
|
+
},
|
|
101
|
+
}, async ({ prompt }) => {
|
|
102
|
+
return this.handleParseMode(prompt);
|
|
103
|
+
});
|
|
104
|
+
this.server.registerTool('get_project_config', {
|
|
105
|
+
title: 'Get Project Config',
|
|
106
|
+
description: 'Get project configuration including tech stack, architecture, conventions, and language settings',
|
|
107
|
+
inputSchema: {},
|
|
108
|
+
}, async () => {
|
|
109
|
+
return this.handleGetProjectConfig();
|
|
110
|
+
});
|
|
111
|
+
this.server.registerTool('suggest_config_updates', {
|
|
112
|
+
title: 'Suggest Config Updates',
|
|
113
|
+
description: 'Analyze the project and suggest config updates based on detected changes (new frameworks, dependencies, patterns)',
|
|
114
|
+
inputSchema: {
|
|
115
|
+
projectRoot: z
|
|
116
|
+
.string()
|
|
117
|
+
.optional()
|
|
118
|
+
.describe('Project root directory (defaults to current working directory)'),
|
|
119
|
+
},
|
|
120
|
+
}, async ({ projectRoot }) => {
|
|
121
|
+
return this.handleSuggestConfigUpdates(projectRoot);
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
registerResources() {
|
|
125
|
+
}
|
|
126
|
+
async handleSearchRules(query) {
|
|
127
|
+
try {
|
|
128
|
+
const results = await this.searchRules(query);
|
|
129
|
+
return this.jsonResponse(results);
|
|
130
|
+
}
|
|
131
|
+
catch (error) {
|
|
132
|
+
return this.errorResponse(`Failed to search rules: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
async handleGetAgentDetails(agentName) {
|
|
136
|
+
try {
|
|
137
|
+
const agent = await this.getAgent(agentName);
|
|
138
|
+
return this.jsonResponse(agent);
|
|
139
|
+
}
|
|
140
|
+
catch {
|
|
141
|
+
return this.errorResponse(`Agent '${agentName}' not found.`);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
async handleParseMode(prompt) {
|
|
145
|
+
try {
|
|
146
|
+
const result = await this.parseMode(prompt);
|
|
147
|
+
const settings = await this.loadProjectSettings();
|
|
148
|
+
const response = {
|
|
149
|
+
...result,
|
|
150
|
+
language: settings.language,
|
|
151
|
+
};
|
|
152
|
+
return this.jsonResponse(response);
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
return this.errorResponse(`Failed to parse mode: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
async handleGetProjectConfig() {
|
|
159
|
+
try {
|
|
160
|
+
const settings = await this.loadProjectSettings();
|
|
161
|
+
return this.jsonResponse(settings);
|
|
162
|
+
}
|
|
163
|
+
catch (error) {
|
|
164
|
+
return this.errorResponse(`Failed to get project config: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
async handleSuggestConfigUpdates(projectRoot) {
|
|
168
|
+
try {
|
|
169
|
+
const root = projectRoot ?? this.projectRoot;
|
|
170
|
+
const packageJsonPath = path.join(root, 'package.json');
|
|
171
|
+
const detectedStack = [];
|
|
172
|
+
if ((0, fs_1.existsSync)(packageJsonPath)) {
|
|
173
|
+
const packageJson = JSON.parse(await fs.readFile(packageJsonPath, 'utf-8'));
|
|
174
|
+
const allDeps = {
|
|
175
|
+
...packageJson.dependencies,
|
|
176
|
+
...packageJson.devDependencies,
|
|
177
|
+
};
|
|
178
|
+
const frameworks = {
|
|
179
|
+
react: 'React',
|
|
180
|
+
vue: 'Vue',
|
|
181
|
+
angular: 'Angular',
|
|
182
|
+
next: 'Next.js',
|
|
183
|
+
nuxt: 'Nuxt',
|
|
184
|
+
express: 'Express',
|
|
185
|
+
nestjs: 'NestJS',
|
|
186
|
+
'@nestjs/core': 'NestJS',
|
|
187
|
+
fastify: 'Fastify',
|
|
188
|
+
typescript: 'TypeScript',
|
|
189
|
+
tailwindcss: 'Tailwind CSS',
|
|
190
|
+
jest: 'Jest',
|
|
191
|
+
vitest: 'Vitest',
|
|
192
|
+
prisma: 'Prisma',
|
|
193
|
+
'@prisma/client': 'Prisma',
|
|
194
|
+
};
|
|
195
|
+
for (const [pkg, name] of Object.entries(frameworks)) {
|
|
196
|
+
if (allDeps[pkg]) {
|
|
197
|
+
detectedStack.push(name);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
const currentConfig = await this.loadProjectSettings();
|
|
202
|
+
const suggestions = [];
|
|
203
|
+
if (!currentConfig.techStack ||
|
|
204
|
+
Object.keys(currentConfig.techStack).length === 0) {
|
|
205
|
+
if (detectedStack.length > 0) {
|
|
206
|
+
suggestions.push(`Add detected technologies to config: ${detectedStack.join(', ')}`);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
if (!currentConfig.language) {
|
|
210
|
+
suggestions.push('Consider adding a language setting (e.g., "ko" or "en")');
|
|
211
|
+
}
|
|
212
|
+
return this.jsonResponse({
|
|
213
|
+
detectedStack,
|
|
214
|
+
currentConfig,
|
|
215
|
+
suggestions,
|
|
216
|
+
needsUpdate: suggestions.length > 0,
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
catch (error) {
|
|
220
|
+
return this.errorResponse(`Failed to suggest config updates: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
async getRuleContent(relativePath) {
|
|
224
|
+
const fullPath = path.join(this.rulesDir, relativePath);
|
|
225
|
+
try {
|
|
226
|
+
return await fs.readFile(fullPath, 'utf-8');
|
|
227
|
+
}
|
|
228
|
+
catch {
|
|
229
|
+
throw new Error(`Failed to read rule file: ${relativePath}`);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
async listAgents() {
|
|
233
|
+
const agentsDir = path.join(this.rulesDir, 'agents');
|
|
234
|
+
try {
|
|
235
|
+
const files = await fs.readdir(agentsDir);
|
|
236
|
+
return files
|
|
237
|
+
.filter(f => f.endsWith('.json'))
|
|
238
|
+
.map(f => f.replace('.json', ''));
|
|
239
|
+
}
|
|
240
|
+
catch {
|
|
241
|
+
return [];
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
async getAgent(name) {
|
|
245
|
+
const content = await this.getRuleContent(`agents/${name}.json`);
|
|
246
|
+
return JSON.parse(content);
|
|
247
|
+
}
|
|
248
|
+
async searchRules(query) {
|
|
249
|
+
const results = [];
|
|
250
|
+
const queryLower = query.toLowerCase();
|
|
251
|
+
const agents = await this.listAgents();
|
|
252
|
+
const filesToSearch = [
|
|
253
|
+
'rules/core.md',
|
|
254
|
+
'rules/project.md',
|
|
255
|
+
'rules/augmented-coding.md',
|
|
256
|
+
...agents.map(a => `agents/${a}.json`),
|
|
257
|
+
];
|
|
258
|
+
for (const file of filesToSearch) {
|
|
259
|
+
try {
|
|
260
|
+
const content = await this.getRuleContent(file);
|
|
261
|
+
const lines = content.split('\n');
|
|
262
|
+
const matches = [];
|
|
263
|
+
let score = 0;
|
|
264
|
+
lines.forEach((line, index) => {
|
|
265
|
+
if (line.toLowerCase().includes(queryLower)) {
|
|
266
|
+
matches.push(`Line ${index + 1}: ${line.trim()}`);
|
|
267
|
+
score++;
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
if (score > 0) {
|
|
271
|
+
results.push({ file, matches, score });
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
catch {
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
return results.sort((a, b) => b.score - a.score);
|
|
278
|
+
}
|
|
279
|
+
async parseMode(prompt) {
|
|
280
|
+
const config = DEFAULT_MODE_CONFIG;
|
|
281
|
+
const warnings = [];
|
|
282
|
+
const trimmed = prompt.trim();
|
|
283
|
+
const parts = trimmed.split(/\s+/);
|
|
284
|
+
const firstWord = parts[0]?.toUpperCase() ?? '';
|
|
285
|
+
let mode;
|
|
286
|
+
let originalPrompt;
|
|
287
|
+
const isKeyword = keyword_types_1.KEYWORDS.includes(firstWord);
|
|
288
|
+
if (isKeyword) {
|
|
289
|
+
mode = firstWord;
|
|
290
|
+
originalPrompt = trimmed.slice(parts[0].length).trim();
|
|
291
|
+
if (parts.length > 1) {
|
|
292
|
+
const secondWord = parts[1].toUpperCase();
|
|
293
|
+
if (keyword_types_1.KEYWORDS.includes(secondWord)) {
|
|
294
|
+
warnings.push('Multiple keywords found, using first');
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
if (originalPrompt === '') {
|
|
298
|
+
warnings.push('No prompt content after keyword');
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
else {
|
|
302
|
+
mode = config.defaultMode;
|
|
303
|
+
originalPrompt = trimmed;
|
|
304
|
+
warnings.push('No keyword found, defaulting to PLAN');
|
|
305
|
+
}
|
|
306
|
+
const modeConfig = config.modes[mode];
|
|
307
|
+
const rules = await this.getRulesForMode(mode, config);
|
|
308
|
+
return {
|
|
309
|
+
mode,
|
|
310
|
+
originalPrompt,
|
|
311
|
+
instructions: modeConfig.instructions,
|
|
312
|
+
rules,
|
|
313
|
+
...(warnings.length > 0 ? { warnings } : {}),
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
async getRulesForMode(mode, config) {
|
|
317
|
+
const modeConfig = config.modes[mode];
|
|
318
|
+
const rules = [];
|
|
319
|
+
for (const rulePath of modeConfig.rules) {
|
|
320
|
+
try {
|
|
321
|
+
const content = await this.getRuleContent(rulePath);
|
|
322
|
+
rules.push({ name: rulePath, content });
|
|
323
|
+
}
|
|
324
|
+
catch {
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
return rules;
|
|
328
|
+
}
|
|
329
|
+
async loadProjectSettings() {
|
|
330
|
+
try {
|
|
331
|
+
const result = await (0, config_loader_1.loadConfig)(this.projectRoot);
|
|
332
|
+
return result.config;
|
|
333
|
+
}
|
|
334
|
+
catch {
|
|
335
|
+
return {};
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
jsonResponse(data) {
|
|
339
|
+
return {
|
|
340
|
+
content: [{ type: 'text', text: JSON.stringify(data, null, 2) }],
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
errorResponse(message) {
|
|
344
|
+
return {
|
|
345
|
+
isError: true,
|
|
346
|
+
content: [{ type: 'text', text: message }],
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
exports.McpServerlessService = McpServerlessService;
|
|
351
|
+
//# sourceMappingURL=mcp-serverless.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-serverless.js","sourceRoot":"","sources":["../../../src/mcp/mcp-serverless.ts"],"names":[],"mappings":";;;AAAA,oEAAoE;AACpE,yBAAyB;AACzB,kCAAkC;AAClC,2BAAgC;AAChC,6BAA6B;AAQ7B,4DAAoD;AACpD,2DAAqD;AAqBrD,MAAM,mBAAmB,GAAuB;IAC9C,KAAK,EAAE;QACL,IAAI,EAAE;YACJ,WAAW,EAAE,gCAAgC;YAC7C,YAAY,EACV,2GAA2G;YAC7G,KAAK,EAAE,CAAC,eAAe,EAAE,2BAA2B,CAAC;SACtD;QACD,GAAG,EAAE;YACH,WAAW,EAAE,6BAA6B;YAC1C,YAAY,EACV,4GAA4G;YAC9G,KAAK,EAAE,CAAC,eAAe,EAAE,kBAAkB,EAAE,2BAA2B,CA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