@elliotding/ai-agent-mcp 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/cached-client.d.ts +48 -0
- package/dist/api/cached-client.d.ts.map +1 -0
- package/dist/api/cached-client.js +126 -0
- package/dist/api/cached-client.js.map +1 -0
- package/dist/api/client.d.ts +213 -0
- package/dist/api/client.d.ts.map +1 -0
- package/dist/api/client.js +326 -0
- package/dist/api/client.js.map +1 -0
- package/dist/auth/index.d.ts +8 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +26 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/middleware.d.ts +36 -0
- package/dist/auth/middleware.d.ts.map +1 -0
- package/dist/auth/middleware.js +194 -0
- package/dist/auth/middleware.js.map +1 -0
- package/dist/auth/permissions.d.ts +60 -0
- package/dist/auth/permissions.d.ts.map +1 -0
- package/dist/auth/permissions.js +256 -0
- package/dist/auth/permissions.js.map +1 -0
- package/dist/auth/token-validator.d.ts +52 -0
- package/dist/auth/token-validator.d.ts.map +1 -0
- package/dist/auth/token-validator.js +217 -0
- package/dist/auth/token-validator.js.map +1 -0
- package/dist/cache/cache-manager.d.ts +49 -0
- package/dist/cache/cache-manager.d.ts.map +1 -0
- package/dist/cache/cache-manager.js +191 -0
- package/dist/cache/cache-manager.js.map +1 -0
- package/dist/cache/index.d.ts +6 -0
- package/dist/cache/index.d.ts.map +1 -0
- package/dist/cache/index.js +12 -0
- package/dist/cache/index.js.map +1 -0
- package/dist/cache/redis-client.d.ts +45 -0
- package/dist/cache/redis-client.d.ts.map +1 -0
- package/dist/cache/redis-client.js +210 -0
- package/dist/cache/redis-client.js.map +1 -0
- package/dist/config/constants.d.ts +28 -0
- package/dist/config/constants.d.ts.map +1 -0
- package/dist/config/constants.js +31 -0
- package/dist/config/constants.js.map +1 -0
- package/dist/config/index.d.ts +54 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +168 -0
- package/dist/config/index.js.map +1 -0
- package/dist/filesystem/manager.d.ts +45 -0
- package/dist/filesystem/manager.d.ts.map +1 -0
- package/dist/filesystem/manager.js +246 -0
- package/dist/filesystem/manager.js.map +1 -0
- package/dist/git/multi-source-manager.d.ts +62 -0
- package/dist/git/multi-source-manager.d.ts.map +1 -0
- package/dist/git/multi-source-manager.js +293 -0
- package/dist/git/multi-source-manager.js.map +1 -0
- package/dist/git/operations.d.ts +27 -0
- package/dist/git/operations.d.ts.map +1 -0
- package/dist/git/operations.js +83 -0
- package/dist/git/operations.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +109 -0
- package/dist/index.js.map +1 -0
- package/dist/monitoring/health.d.ts +35 -0
- package/dist/monitoring/health.d.ts.map +1 -0
- package/dist/monitoring/health.js +105 -0
- package/dist/monitoring/health.js.map +1 -0
- package/dist/resources/index.d.ts +6 -0
- package/dist/resources/index.d.ts.map +1 -0
- package/dist/resources/index.js +10 -0
- package/dist/resources/index.js.map +1 -0
- package/dist/resources/loader.d.ts +87 -0
- package/dist/resources/loader.d.ts.map +1 -0
- package/dist/resources/loader.js +452 -0
- package/dist/resources/loader.js.map +1 -0
- package/dist/server/http.d.ts +57 -0
- package/dist/server/http.d.ts.map +1 -0
- package/dist/server/http.js +336 -0
- package/dist/server/http.js.map +1 -0
- package/dist/server.d.ts +13 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +157 -0
- package/dist/server.js.map +1 -0
- package/dist/session/manager.d.ts +91 -0
- package/dist/session/manager.d.ts.map +1 -0
- package/dist/session/manager.js +251 -0
- package/dist/session/manager.js.map +1 -0
- package/dist/tools/index.d.ts +11 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +27 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/manage-subscription.d.ts +43 -0
- package/dist/tools/manage-subscription.d.ts.map +1 -0
- package/dist/tools/manage-subscription.js +268 -0
- package/dist/tools/manage-subscription.js.map +1 -0
- package/dist/tools/registry.d.ts +40 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/registry.js +85 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/tools/search-resources.d.ts +31 -0
- package/dist/tools/search-resources.d.ts.map +1 -0
- package/dist/tools/search-resources.js +154 -0
- package/dist/tools/search-resources.js.map +1 -0
- package/dist/tools/sync-resources.d.ts +41 -0
- package/dist/tools/sync-resources.d.ts.map +1 -0
- package/dist/tools/sync-resources.js +606 -0
- package/dist/tools/sync-resources.js.map +1 -0
- package/dist/tools/uninstall-resource.d.ts +30 -0
- package/dist/tools/uninstall-resource.d.ts.map +1 -0
- package/dist/tools/uninstall-resource.js +259 -0
- package/dist/tools/uninstall-resource.js.map +1 -0
- package/dist/tools/upload-resource.d.ts +77 -0
- package/dist/tools/upload-resource.d.ts.map +1 -0
- package/dist/tools/upload-resource.js +252 -0
- package/dist/tools/upload-resource.js.map +1 -0
- package/dist/transport/sse.d.ts +29 -0
- package/dist/transport/sse.d.ts.map +1 -0
- package/dist/transport/sse.js +271 -0
- package/dist/transport/sse.js.map +1 -0
- package/dist/types/errors.d.ts +60 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/errors.js +112 -0
- package/dist/types/errors.js.map +1 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +23 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/mcp.d.ts +50 -0
- package/dist/types/mcp.d.ts.map +1 -0
- package/dist/types/mcp.js +6 -0
- package/dist/types/mcp.js.map +1 -0
- package/dist/types/resources.d.ts +109 -0
- package/dist/types/resources.d.ts.map +1 -0
- package/dist/types/resources.js +7 -0
- package/dist/types/resources.js.map +1 -0
- package/dist/types/tools.d.ts +147 -0
- package/dist/types/tools.d.ts.map +1 -0
- package/dist/types/tools.js +6 -0
- package/dist/types/tools.js.map +1 -0
- package/dist/utils/cursor-paths.d.ts +49 -0
- package/dist/utils/cursor-paths.d.ts.map +1 -0
- package/dist/utils/cursor-paths.js +116 -0
- package/dist/utils/cursor-paths.js.map +1 -0
- package/dist/utils/log-cleaner.d.ts +18 -0
- package/dist/utils/log-cleaner.d.ts.map +1 -0
- package/dist/utils/log-cleaner.js +112 -0
- package/dist/utils/log-cleaner.js.map +1 -0
- package/dist/utils/logger.d.ts +59 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +292 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/validation.d.ts +58 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +214 -0
- package/dist/utils/validation.js.map +1 -0
- package/package.json +58 -0
- package/src/api/cached-client.ts +144 -0
- package/src/api/client.ts +578 -0
- package/src/auth/index.ts +11 -0
- package/src/auth/middleware.ts +244 -0
- package/src/auth/permissions.ts +317 -0
- package/src/auth/token-validator.ts +294 -0
- package/src/cache/cache-manager.ts +243 -0
- package/src/cache/index.ts +6 -0
- package/src/cache/redis-client.ts +249 -0
- package/src/config/constants.ts +33 -0
- package/src/config/index.ts +228 -0
- package/src/filesystem/manager.ts +235 -0
- package/src/git/multi-source-manager.ts +333 -0
- package/src/git/operations.ts +93 -0
- package/src/index.ts +139 -0
- package/src/monitoring/health.ts +132 -0
- package/src/resources/index.ts +13 -0
- package/src/resources/loader.ts +530 -0
- package/src/server/http.ts +427 -0
- package/src/server.ts +191 -0
- package/src/session/manager.ts +296 -0
- package/src/tools/index.ts +11 -0
- package/src/tools/manage-subscription.ts +332 -0
- package/src/tools/registry.ts +97 -0
- package/src/tools/search-resources.ts +177 -0
- package/src/tools/sync-resources.ts +662 -0
- package/src/tools/uninstall-resource.ts +248 -0
- package/src/tools/upload-resource.ts +258 -0
- package/src/transport/sse.ts +308 -0
- package/src/types/errors.ts +146 -0
- package/src/types/index.ts +7 -0
- package/src/types/mcp.ts +61 -0
- package/src/types/resources.ts +141 -0
- package/src/types/tools.ts +175 -0
- package/src/utils/cursor-paths.ts +83 -0
- package/src/utils/log-cleaner.ts +92 -0
- package/src/utils/logger.ts +333 -0
- package/src/utils/validation.ts +262 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Custom Error Types
|
|
4
|
+
* Typed errors for different failure scenarios
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.FileSystemError = exports.ValidationError = exports.APIError = exports.GitError = exports.MCPServerError = void 0;
|
|
8
|
+
exports.createGitError = createGitError;
|
|
9
|
+
exports.createAPIError = createAPIError;
|
|
10
|
+
exports.createValidationError = createValidationError;
|
|
11
|
+
exports.createFileSystemError = createFileSystemError;
|
|
12
|
+
/**
|
|
13
|
+
* Base Error for MCP Server operations
|
|
14
|
+
*/
|
|
15
|
+
class MCPServerError extends Error {
|
|
16
|
+
code;
|
|
17
|
+
details;
|
|
18
|
+
constructor(message, code, details) {
|
|
19
|
+
super(message);
|
|
20
|
+
this.code = code;
|
|
21
|
+
this.details = details;
|
|
22
|
+
this.name = this.constructor.name;
|
|
23
|
+
Error.captureStackTrace(this, this.constructor);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.MCPServerError = MCPServerError;
|
|
27
|
+
/**
|
|
28
|
+
* Git Operation Error
|
|
29
|
+
*/
|
|
30
|
+
class GitError extends MCPServerError {
|
|
31
|
+
operation;
|
|
32
|
+
repositoryUrl;
|
|
33
|
+
constructor(message, operation, repositoryUrl, details) {
|
|
34
|
+
super(message, 'GIT_ERROR', details);
|
|
35
|
+
this.operation = operation;
|
|
36
|
+
this.repositoryUrl = repositoryUrl;
|
|
37
|
+
// Redact credentials from repository URL
|
|
38
|
+
if (this.repositoryUrl) {
|
|
39
|
+
this.repositoryUrl = this.redactCredentials(this.repositoryUrl);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
redactCredentials(url) {
|
|
43
|
+
return url.replace(/:\/\/([^:]+):([^@]+)@/, '://***:***@');
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.GitError = GitError;
|
|
47
|
+
/**
|
|
48
|
+
* API Request Error
|
|
49
|
+
*/
|
|
50
|
+
class APIError extends MCPServerError {
|
|
51
|
+
statusCode;
|
|
52
|
+
method;
|
|
53
|
+
url;
|
|
54
|
+
retryCount;
|
|
55
|
+
constructor(message, statusCode, method, url, retryCount, details) {
|
|
56
|
+
super(message, 'API_ERROR', details);
|
|
57
|
+
this.statusCode = statusCode;
|
|
58
|
+
this.method = method;
|
|
59
|
+
this.url = url;
|
|
60
|
+
this.retryCount = retryCount;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.APIError = APIError;
|
|
64
|
+
/**
|
|
65
|
+
* Resource Validation Error
|
|
66
|
+
*/
|
|
67
|
+
class ValidationError extends MCPServerError {
|
|
68
|
+
filePath;
|
|
69
|
+
expectedFormat;
|
|
70
|
+
validationReason;
|
|
71
|
+
constructor(message, filePath, expectedFormat, validationReason, details) {
|
|
72
|
+
super(message, 'VALIDATION_ERROR', details);
|
|
73
|
+
this.filePath = filePath;
|
|
74
|
+
this.expectedFormat = expectedFormat;
|
|
75
|
+
this.validationReason = validationReason;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
exports.ValidationError = ValidationError;
|
|
79
|
+
/**
|
|
80
|
+
* Filesystem Operation Error
|
|
81
|
+
*/
|
|
82
|
+
class FileSystemError extends MCPServerError {
|
|
83
|
+
operation;
|
|
84
|
+
path;
|
|
85
|
+
systemErrorCode;
|
|
86
|
+
suggestedResolution;
|
|
87
|
+
constructor(message, operation, path, systemErrorCode, suggestedResolution, details) {
|
|
88
|
+
super(message, 'FILESYSTEM_ERROR', details);
|
|
89
|
+
this.operation = operation;
|
|
90
|
+
this.path = path;
|
|
91
|
+
this.systemErrorCode = systemErrorCode;
|
|
92
|
+
this.suggestedResolution = suggestedResolution;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
exports.FileSystemError = FileSystemError;
|
|
96
|
+
/**
|
|
97
|
+
* Error Factory Functions
|
|
98
|
+
*/
|
|
99
|
+
function createGitError(operation, error, repositoryUrl) {
|
|
100
|
+
return new GitError(`Git ${operation} failed: ${error.message}`, operation, repositoryUrl, { originalError: error });
|
|
101
|
+
}
|
|
102
|
+
function createAPIError(method, url, error, statusCode, retryCount) {
|
|
103
|
+
const message = `API ${method} ${url} failed: ${error.message}`;
|
|
104
|
+
return new APIError(message, statusCode, method, url, retryCount, { originalError: error });
|
|
105
|
+
}
|
|
106
|
+
function createValidationError(filePath, expectedFormat, reason) {
|
|
107
|
+
return new ValidationError(`Resource validation failed: ${reason}`, filePath, expectedFormat, reason);
|
|
108
|
+
}
|
|
109
|
+
function createFileSystemError(operation, path, error, suggestedResolution) {
|
|
110
|
+
return new FileSystemError(`Filesystem ${operation} failed: ${error.message}`, operation, path, error.code, suggestedResolution, { originalError: error });
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/types/errors.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AA2FH,wCAWC;AAED,wCASC;AAED,sDAWC;AAED,sDAcC;AA5ID;;GAEG;AACH,MAAa,cAAe,SAAQ,KAAK;IAGrB;IACA;IAHlB,YACE,OAAe,EACC,IAAY,EACZ,OAAiB;QAEjC,KAAK,CAAC,OAAO,CAAC,CAAC;QAHC,SAAI,GAAJ,IAAI,CAAQ;QACZ,YAAO,GAAP,OAAO,CAAU;QAGjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;QAClC,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IAClD,CAAC;CACF;AAVD,wCAUC;AAED;;GAEG;AACH,MAAa,QAAS,SAAQ,cAAc;IAGxB;IACA;IAHlB,YACE,OAA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,CACzB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Type Exports
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
17
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
__exportStar(require("./mcp"), exports);
|
|
21
|
+
__exportStar(require("./tools"), exports);
|
|
22
|
+
__exportStar(require("./errors"), exports);
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;;;;;AAEH,wCAAsB;AACtB,0CAAwB;AACxB,2CAAyB"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Protocol Types
|
|
3
|
+
*/
|
|
4
|
+
export interface MCPToolSchema {
|
|
5
|
+
type: 'object';
|
|
6
|
+
properties: Record<string, {
|
|
7
|
+
type: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
enum?: string[];
|
|
10
|
+
default?: unknown;
|
|
11
|
+
}>;
|
|
12
|
+
required?: string[];
|
|
13
|
+
}
|
|
14
|
+
export interface MCPToolDefinition {
|
|
15
|
+
name: string;
|
|
16
|
+
description: string;
|
|
17
|
+
inputSchema: MCPToolSchema;
|
|
18
|
+
}
|
|
19
|
+
export interface MCPInitializeRequest {
|
|
20
|
+
protocolVersion: string;
|
|
21
|
+
capabilities: {
|
|
22
|
+
tools?: Record<string, never>;
|
|
23
|
+
};
|
|
24
|
+
clientInfo: {
|
|
25
|
+
name: string;
|
|
26
|
+
version: string;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export interface MCPInitializeResponse {
|
|
30
|
+
protocolVersion: string;
|
|
31
|
+
capabilities: {
|
|
32
|
+
tools?: Record<string, never>;
|
|
33
|
+
};
|
|
34
|
+
serverInfo: {
|
|
35
|
+
name: string;
|
|
36
|
+
version: string;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export interface MCPToolCallRequest {
|
|
40
|
+
name: string;
|
|
41
|
+
arguments?: Record<string, unknown>;
|
|
42
|
+
}
|
|
43
|
+
export interface MCPToolCallResponse {
|
|
44
|
+
content: Array<{
|
|
45
|
+
type: 'text';
|
|
46
|
+
text: string;
|
|
47
|
+
}>;
|
|
48
|
+
isError?: boolean;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=mcp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../src/types/mcp.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,QAAQ,CAAC;IACf,UAAU,EAAE,MAAM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"names":[],"mappings":";AAAA;;GAEG"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI Resources Type Definitions
|
|
3
|
+
* Defines types for multi-source AI resource management
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Resource type enumeration
|
|
7
|
+
*/
|
|
8
|
+
export type ResourceType = 'commands' | 'skills' | 'mcp' | 'rules';
|
|
9
|
+
/**
|
|
10
|
+
* Resource source configuration
|
|
11
|
+
*/
|
|
12
|
+
export interface ResourceSource {
|
|
13
|
+
/** Source name (identifier) */
|
|
14
|
+
name: string;
|
|
15
|
+
/** Relative path to AI-Resources root */
|
|
16
|
+
path: string;
|
|
17
|
+
/** Whether this source is enabled */
|
|
18
|
+
enabled: boolean;
|
|
19
|
+
/** Priority (higher number = higher priority) */
|
|
20
|
+
priority: number;
|
|
21
|
+
/** Mapping of resource types to subdirectories */
|
|
22
|
+
resources: Partial<Record<ResourceType, string>>;
|
|
23
|
+
/** Optional description */
|
|
24
|
+
description?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* AI Resources configuration
|
|
28
|
+
*/
|
|
29
|
+
export interface AIResourcesConfig {
|
|
30
|
+
/** Configuration version */
|
|
31
|
+
version: string;
|
|
32
|
+
/** Optional description */
|
|
33
|
+
description?: string;
|
|
34
|
+
/** Default resource source (always loaded) */
|
|
35
|
+
default_source: ResourceSource;
|
|
36
|
+
/** Extended resource sources */
|
|
37
|
+
extended_sources: ResourceSource[];
|
|
38
|
+
/** Supported resource types */
|
|
39
|
+
resource_types: ResourceType[];
|
|
40
|
+
/** Loading order strategy */
|
|
41
|
+
loading_order: 'priority_desc' | 'priority_asc' | 'name_asc';
|
|
42
|
+
/** Conflict resolution strategy */
|
|
43
|
+
conflict_resolution: 'highest_priority_wins' | 'merge' | 'error';
|
|
44
|
+
/** Cache configuration */
|
|
45
|
+
cache?: {
|
|
46
|
+
enabled: boolean;
|
|
47
|
+
ttl: number;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Resource metadata
|
|
52
|
+
*/
|
|
53
|
+
export interface ResourceMetadata {
|
|
54
|
+
/** Resource ID */
|
|
55
|
+
id: string;
|
|
56
|
+
/** Resource name */
|
|
57
|
+
name: string;
|
|
58
|
+
/** Resource type */
|
|
59
|
+
type: ResourceType;
|
|
60
|
+
/** Source name */
|
|
61
|
+
source: string;
|
|
62
|
+
/** Source priority */
|
|
63
|
+
priority: number;
|
|
64
|
+
/** Full file path */
|
|
65
|
+
path: string;
|
|
66
|
+
/** Version (if available) */
|
|
67
|
+
version?: string;
|
|
68
|
+
/** Description (if available) */
|
|
69
|
+
description?: string;
|
|
70
|
+
/** Tags (if available) */
|
|
71
|
+
tags?: string[];
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Resource conflict information
|
|
75
|
+
*/
|
|
76
|
+
export interface ResourceConflict {
|
|
77
|
+
/** Resource name */
|
|
78
|
+
name: string;
|
|
79
|
+
/** Resource type */
|
|
80
|
+
type: ResourceType;
|
|
81
|
+
/** Conflicting resources */
|
|
82
|
+
conflicts: Array<{
|
|
83
|
+
source: string;
|
|
84
|
+
priority: number;
|
|
85
|
+
path: string;
|
|
86
|
+
}>;
|
|
87
|
+
/** Selected resource (after conflict resolution) */
|
|
88
|
+
selected: {
|
|
89
|
+
source: string;
|
|
90
|
+
priority: number;
|
|
91
|
+
path: string;
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Resource loader statistics
|
|
96
|
+
*/
|
|
97
|
+
export interface LoaderStats {
|
|
98
|
+
/** Total sources loaded */
|
|
99
|
+
sourcesLoaded: number;
|
|
100
|
+
/** Total resources indexed */
|
|
101
|
+
resourcesIndexed: number;
|
|
102
|
+
/** Resources by type */
|
|
103
|
+
byType: Record<ResourceType, number>;
|
|
104
|
+
/** Conflicts detected */
|
|
105
|
+
conflictsDetected: number;
|
|
106
|
+
/** Load duration (ms) */
|
|
107
|
+
loadDuration: number;
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=resources.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resources.d.ts","sourceRoot":"","sources":["../../src/types/resources.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,QAAQ,GAAG,KAAK,GAAG,OAAO,CAAC;AAEnE;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAC;IAEb,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAC;IAEb,qCAAqC;IACrC,OAAO,EAAE,OAAO,CAAC;IAEjB,iDAAiD;IACjD,QAAQ,EAAE,MAAM,CAAC;IAEjB,kDAAkD;IAClD,SAAS,EAAE,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC;IAEjD,2BAA2B;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,4BAA4B;IAC5B,OAAO,EAAE,MAAM,CAAC;IAEhB,2BAA2B;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB,8CAA8C;IAC9C,cAAc,EAAE,cAAc,CAAC;IAE/B,gCAAgC;IAChC,gBAAgB,EAAE,cAAc,EAAE,CAAC;IAEnC,+BAA+B;IAC/B,cAAc,EAAE,YAAY,EAAE,CAAC;IAE/B,6BAA6B;IAC7B,aAAa,EAAE,eAAe,GAAG,cAAc,GAAG,UAAU,CAAC;IAE7D,mCAAmC;IACnC,mBAAmB,EAAE,uBAAuB,GAAG,OAAO,GAAG,OAAO,CAAC;IAEjE,0BAA0B;IAC1B,KAAK,CAAC,EAAE;QACN,OAAO,EAAE,OAAO,CAAC;QACjB,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW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ceRoot":"","sources":["../../src/types/resources.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Tool Types
|
|
3
|
+
*/
|
|
4
|
+
import type { MCPToolSchema } from './mcp';
|
|
5
|
+
export type ToolHandler = (params: unknown) => Promise<ToolResult>;
|
|
6
|
+
export interface ToolDefinition {
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
inputSchema: MCPToolSchema;
|
|
10
|
+
handler: ToolHandler;
|
|
11
|
+
}
|
|
12
|
+
export interface ToolResult<T = unknown> {
|
|
13
|
+
success: boolean;
|
|
14
|
+
data?: T;
|
|
15
|
+
error?: {
|
|
16
|
+
code: string;
|
|
17
|
+
message: string;
|
|
18
|
+
details?: unknown;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export interface SyncResourcesParams {
|
|
22
|
+
mode?: 'check' | 'incremental' | 'full';
|
|
23
|
+
scope?: 'global' | 'workspace' | 'all';
|
|
24
|
+
types?: string[];
|
|
25
|
+
}
|
|
26
|
+
export interface McpSetupItem {
|
|
27
|
+
/** MCP server name as it appears in mcp.json */
|
|
28
|
+
server_name: string;
|
|
29
|
+
/** Human-readable path to mcp.json on this platform */
|
|
30
|
+
mcp_json_path: string;
|
|
31
|
+
/** env keys that are currently empty and need user input */
|
|
32
|
+
missing_env: string[];
|
|
33
|
+
/** true when the registered command might not be correct for this machine */
|
|
34
|
+
command_needs_verification: boolean;
|
|
35
|
+
/** the command string that was registered */
|
|
36
|
+
command: string;
|
|
37
|
+
/** freeform guidance shown to the user */
|
|
38
|
+
setup_hint: string;
|
|
39
|
+
/** absolute path to a local setup/readme doc found in the install directory, if any */
|
|
40
|
+
setup_doc?: string;
|
|
41
|
+
}
|
|
42
|
+
export interface SyncResourcesResult {
|
|
43
|
+
mode: string;
|
|
44
|
+
health_score: number;
|
|
45
|
+
summary: {
|
|
46
|
+
total: number;
|
|
47
|
+
synced: number;
|
|
48
|
+
cached: number;
|
|
49
|
+
failed: number;
|
|
50
|
+
};
|
|
51
|
+
details: Array<{
|
|
52
|
+
id: string;
|
|
53
|
+
name: string;
|
|
54
|
+
action: string;
|
|
55
|
+
version: string;
|
|
56
|
+
}>;
|
|
57
|
+
/**
|
|
58
|
+
* MCP servers that were installed/updated but require manual configuration
|
|
59
|
+
* before they can be used. Present only when at least one server needs setup.
|
|
60
|
+
*/
|
|
61
|
+
pending_setup?: McpSetupItem[];
|
|
62
|
+
}
|
|
63
|
+
export interface ManageSubscriptionParams {
|
|
64
|
+
action: 'subscribe' | 'unsubscribe' | 'list' | 'batch_subscribe' | 'batch_unsubscribe';
|
|
65
|
+
resource_ids?: string[];
|
|
66
|
+
auto_sync?: boolean;
|
|
67
|
+
scope?: 'global' | 'workspace';
|
|
68
|
+
notify?: boolean;
|
|
69
|
+
}
|
|
70
|
+
export interface ManageSubscriptionResult {
|
|
71
|
+
action: string;
|
|
72
|
+
success: boolean;
|
|
73
|
+
subscriptions?: Array<{
|
|
74
|
+
id: string;
|
|
75
|
+
name: string;
|
|
76
|
+
type: string;
|
|
77
|
+
subscribed_at: string;
|
|
78
|
+
}>;
|
|
79
|
+
message?: string;
|
|
80
|
+
/** Sync results for each resource after auto-sync on subscribe */
|
|
81
|
+
sync_details?: Array<{
|
|
82
|
+
id: string;
|
|
83
|
+
name: string;
|
|
84
|
+
action: string;
|
|
85
|
+
}>;
|
|
86
|
+
/** MCP servers that need manual configuration after auto-sync */
|
|
87
|
+
pending_setup?: unknown[];
|
|
88
|
+
}
|
|
89
|
+
export interface SearchResourcesParams {
|
|
90
|
+
team?: string;
|
|
91
|
+
type?: string;
|
|
92
|
+
keyword: string;
|
|
93
|
+
}
|
|
94
|
+
export interface SearchResourcesResult {
|
|
95
|
+
total: number;
|
|
96
|
+
results: Array<{
|
|
97
|
+
id: string;
|
|
98
|
+
name: string;
|
|
99
|
+
type: string;
|
|
100
|
+
team: string;
|
|
101
|
+
version: string;
|
|
102
|
+
description: string;
|
|
103
|
+
score: number;
|
|
104
|
+
is_subscribed: boolean;
|
|
105
|
+
is_installed: boolean;
|
|
106
|
+
}>;
|
|
107
|
+
}
|
|
108
|
+
export interface FileEntry {
|
|
109
|
+
path: string;
|
|
110
|
+
content: string;
|
|
111
|
+
}
|
|
112
|
+
export interface UploadResourceParams {
|
|
113
|
+
resource_id: string;
|
|
114
|
+
type: 'command' | 'skill' | 'rule' | 'mcp';
|
|
115
|
+
message: string;
|
|
116
|
+
/** Human-readable resource name sent to the CSP API. Defaults to resource_id. */
|
|
117
|
+
name?: string;
|
|
118
|
+
/** Target source repo from ai-resources-config.json (e.g. "csp", "client-sdk-ai-hub"). Defaults to default_source. */
|
|
119
|
+
target_source?: string;
|
|
120
|
+
team?: string;
|
|
121
|
+
/** File list to upload. Paths are relative to the type subdir of the chosen source. Any file extension allowed. */
|
|
122
|
+
files: FileEntry[];
|
|
123
|
+
title?: string;
|
|
124
|
+
metadata?: Record<string, unknown>;
|
|
125
|
+
}
|
|
126
|
+
export interface UploadResourceResult {
|
|
127
|
+
resource_id: string;
|
|
128
|
+
version: string;
|
|
129
|
+
url: string;
|
|
130
|
+
commit_hash: string;
|
|
131
|
+
message: string;
|
|
132
|
+
}
|
|
133
|
+
export interface UninstallResourceParams {
|
|
134
|
+
resource_id_or_name: string;
|
|
135
|
+
remove_from_account?: boolean;
|
|
136
|
+
}
|
|
137
|
+
export interface UninstallResourceResult {
|
|
138
|
+
success: boolean;
|
|
139
|
+
removed_resources: Array<{
|
|
140
|
+
id: string;
|
|
141
|
+
name: string;
|
|
142
|
+
path: string;
|
|
143
|
+
}>;
|
|
144
|
+
subscription_removed: boolean;
|
|
145
|
+
message: string;
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/types/tools.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,O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ACtC,OAAO,EAAE,OAAO,CAAC;IACjB,iBAAiB,EAAE,KAAK,CAAC;QACvB,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACd,CAAC,CAAC;IACH,oBAAoB,EAAE,OAAO,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/types/tools.ts"],"names":[],"mappings":";AAAA;;GAEG"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cursor IDE standard directory path resolver.
|
|
3
|
+
*
|
|
4
|
+
* Cursor stores user-level assets in platform-specific locations:
|
|
5
|
+
* macOS / Linux : ~/.cursor/<type>/
|
|
6
|
+
* Windows : %APPDATA%\Cursor\User\<type>\
|
|
7
|
+
* (typically C:\Users\<user>\AppData\Roaming\Cursor\User\<type>\)
|
|
8
|
+
*
|
|
9
|
+
* Resource type → subdirectory mapping mirrors the actual Cursor directory layout.
|
|
10
|
+
*/
|
|
11
|
+
/** Supported Cursor resource types and their directory names. */
|
|
12
|
+
export declare const CURSOR_TYPE_DIRS: Record<string, string>;
|
|
13
|
+
/**
|
|
14
|
+
* Returns the root of the Cursor user directory on the current platform.
|
|
15
|
+
*
|
|
16
|
+
* macOS / Linux : ~/.cursor
|
|
17
|
+
* Windows : %APPDATA%\Cursor\User
|
|
18
|
+
*/
|
|
19
|
+
export declare function getCursorRootDir(): string;
|
|
20
|
+
/**
|
|
21
|
+
* Returns the Cursor subdirectory for a given resource type.
|
|
22
|
+
*
|
|
23
|
+
* @param resourceType - API resource type string (e.g. 'skill', 'command', 'rule', 'mcp')
|
|
24
|
+
* @returns Absolute path to the matching Cursor directory
|
|
25
|
+
* @throws Error if the resource type is not recognised
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* getCursorTypeDir('skill') // ~/.cursor/skills
|
|
29
|
+
* getCursorTypeDir('command') // ~/.cursor/commands
|
|
30
|
+
* getCursorTypeDir('rule') // ~/.cursor/rules
|
|
31
|
+
* getCursorTypeDir('mcp') // ~/.cursor/mcp-servers
|
|
32
|
+
*/
|
|
33
|
+
export declare function getCursorTypeDir(resourceType: string): string;
|
|
34
|
+
/**
|
|
35
|
+
* Returns the install path for a specific named resource.
|
|
36
|
+
*
|
|
37
|
+
* For directory-based resources (skill, mcp) the result is a directory:
|
|
38
|
+
* ~/.cursor/skills/<name>/
|
|
39
|
+
*
|
|
40
|
+
* For file-based resources (command, rule) the result is the file path
|
|
41
|
+
* preserving the original filename (caller should pass name with extension):
|
|
42
|
+
* ~/.cursor/commands/<name> (e.g. generate-testcase.md)
|
|
43
|
+
* ~/.cursor/rules/<name> (e.g. elliotTest.mdc)
|
|
44
|
+
*
|
|
45
|
+
* @param resourceType - Resource type string
|
|
46
|
+
* @param resourceName - Resource name (with or without extension)
|
|
47
|
+
*/
|
|
48
|
+
export declare function getCursorResourcePath(resourceType: string, resourceName: string): string;
|
|
49
|
+
//# sourceMappingURL=cursor-paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cursor-paths.d.ts","sourceRoot":"","sources":["../../src/utils/cursor-paths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,iEAAiE;AACjE,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CASnD,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,gBAAgB,IAAI,MAAM,CAQzC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAS7D;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAExF"}
|