imcp 0.0.16 → 0.0.17
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/cli/commands/install.js +2 -2
- package/dist/cli/commands/list.js +2 -2
- package/dist/cli/commands/serve.js +1 -1
- package/dist/core/RequirementService.d.ts +0 -12
- package/dist/core/RequirementService.js +0 -24
- package/dist/core/installers/clients/BaseClientInstaller.d.ts +1 -1
- package/dist/core/installers/clients/ClientInstaller.d.ts +1 -1
- package/dist/core/installers/clients/ClientInstaller.js +1 -1
- package/dist/core/installers/clients/ClientInstallerFactory.js +1 -1
- package/dist/core/installers/clients/ClineInstaller.d.ts +1 -1
- package/dist/core/installers/clients/ClineInstaller.js +1 -1
- package/dist/core/installers/clients/ExtensionInstaller.js +1 -1
- package/dist/core/installers/clients/GithubCopilotInstaller.d.ts +1 -1
- package/dist/core/installers/clients/GithubCopilotInstaller.js +1 -1
- package/dist/core/installers/clients/MSRooCodeInstaller.d.ts +1 -1
- package/dist/core/installers/clients/MSRooCodeInstaller.js +1 -1
- package/dist/core/installers/requirements/BaseInstaller.d.ts +1 -1
- package/dist/core/installers/requirements/BaseInstaller.js +1 -1
- package/dist/core/installers/requirements/CommandInstaller.d.ts +1 -1
- package/dist/core/installers/requirements/CommandInstaller.js +1 -1
- package/dist/core/installers/requirements/GeneralInstaller.d.ts +1 -1
- package/dist/core/installers/requirements/InstallerFactory.d.ts +1 -1
- package/dist/core/installers/requirements/NpmInstaller.d.ts +1 -1
- package/dist/core/installers/requirements/NpmInstaller.js +1 -1
- package/dist/core/installers/requirements/PipInstaller.d.ts +1 -1
- package/dist/core/installers/requirements/RequirementInstaller.d.ts +1 -1
- package/dist/core/loaders/ConfigurationLoader.d.ts +32 -0
- package/dist/core/loaders/ConfigurationLoader.js +236 -0
- package/dist/core/loaders/ConfigurationProvider.d.ts +35 -0
- package/dist/core/loaders/ConfigurationProvider.js +375 -0
- package/dist/core/loaders/ServerSchemaLoader.d.ts +11 -0
- package/{src/core/ServerSchemaLoader.ts → dist/core/loaders/ServerSchemaLoader.js} +43 -48
- package/dist/core/loaders/ServerSchemaProvider.d.ts +17 -0
- package/{src/core/ServerSchemaProvider.ts → dist/core/loaders/ServerSchemaProvider.js} +120 -137
- package/dist/core/metadatas/constants.d.ts +47 -0
- package/dist/core/metadatas/constants.js +94 -0
- package/dist/core/metadatas/types.d.ts +166 -0
- package/dist/core/metadatas/types.js +16 -0
- package/dist/core/onboard/FeedOnboardService.d.ts +1 -1
- package/dist/core/onboard/FeedOnboardService.js +1 -1
- package/dist/core/onboard/OnboardProcessor.d.ts +1 -1
- package/dist/core/onboard/OnboardProcessor.js +1 -1
- package/dist/core/onboard/OnboardStatus.d.ts +1 -1
- package/dist/core/onboard/OnboardStatusManager.d.ts +1 -1
- package/dist/core/onboard/OnboardStatusManager.js +1 -1
- package/dist/core/validators/FeedValidator.d.ts +1 -1
- package/dist/core/validators/IServerValidator.d.ts +1 -1
- package/dist/core/validators/SSEServerValidator.d.ts +1 -1
- package/dist/core/validators/ServerValidatorFactory.d.ts +1 -1
- package/dist/core/validators/StdioServerValidator.d.ts +1 -1
- package/dist/core/validators/StdioServerValidator.js +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/services/InstallationService.d.ts +50 -0
- package/dist/services/InstallationService.js +350 -0
- package/dist/services/MCPManager.d.ts +28 -0
- package/dist/services/MCPManager.js +188 -0
- package/dist/services/RequirementService.d.ts +40 -0
- package/dist/services/RequirementService.js +110 -0
- package/dist/services/ServerService.d.ts +2 -2
- package/dist/services/ServerService.js +5 -5
- package/dist/utils/adoUtils.d.ts +2 -2
- package/dist/utils/adoUtils.js +1 -1
- package/dist/utils/feedUtils.js +1 -1
- package/dist/utils/githubUtils.d.ts +1 -1
- package/dist/utils/githubUtils.js +1 -1
- package/dist/utils/logger.js +1 -1
- package/dist/utils/macroExpressionUtils.d.ts +1 -1
- package/dist/utils/osUtils.d.ts +1 -1
- package/dist/utils/osUtils.js +1 -1
- package/dist/web/contract/serverContract.d.ts +1 -1
- package/dist/web/public/index.html +1 -3
- package/dist/web/public/js/api.js +2 -80
- package/dist/web/server.js +2 -2
- package/package.json +1 -1
- package/src/cli/commands/install.ts +3 -3
- package/src/cli/commands/list.ts +2 -2
- package/src/cli/commands/serve.ts +3 -2
- package/src/cli/index.ts +1 -1
- package/src/core/installers/clients/BaseClientInstaller.ts +134 -3
- package/src/core/installers/clients/ClientInstaller.ts +3 -3
- package/src/core/installers/clients/ClientInstallerFactory.ts +1 -1
- package/src/core/installers/clients/ClineInstaller.ts +1 -101
- package/src/core/installers/clients/ExtensionInstaller.ts +1 -1
- package/src/core/installers/clients/GithubCopilotInstaller.ts +1 -101
- package/src/core/installers/clients/MSRooCodeInstaller.ts +1 -102
- package/src/core/installers/requirements/BaseInstaller.ts +2 -2
- package/src/core/installers/requirements/CommandInstaller.ts +1 -1
- package/src/core/installers/requirements/GeneralInstaller.ts +1 -1
- package/src/core/installers/requirements/InstallerFactory.ts +1 -1
- package/src/core/installers/requirements/NpmInstaller.ts +12 -12
- package/src/core/installers/requirements/PipInstaller.ts +1 -1
- package/src/core/installers/requirements/RequirementInstaller.ts +1 -1
- package/src/core/{ConfigurationLoader.ts → loaders/ConfigurationLoader.ts} +31 -7
- package/src/core/{ConfigurationProvider.ts → loaders/ConfigurationProvider.ts} +18 -10
- package/src/core/loaders/ServerSchemaLoader.ts +117 -0
- package/src/core/loaders/ServerSchemaProvider.ts +99 -0
- package/src/core/{types.ts → metadatas/types.ts} +3 -2
- package/src/core/onboard/FeedOnboardService.ts +270 -146
- package/src/core/onboard/OnboardProcessor.ts +60 -11
- package/src/core/onboard/OnboardStatus.ts +7 -2
- package/src/core/onboard/OnboardStatusManager.ts +270 -43
- package/src/core/validators/FeedValidator.ts +65 -9
- package/src/core/validators/IServerValidator.ts +1 -1
- package/src/core/validators/SSEServerValidator.ts +2 -2
- package/src/core/validators/ServerValidatorFactory.ts +1 -1
- package/src/core/validators/StdioServerValidator.ts +86 -34
- package/src/index.ts +3 -3
- package/src/{core → services}/InstallationService.ts +5 -5
- package/src/{core → services}/MCPManager.ts +10 -5
- package/src/{core → services}/RequirementService.ts +2 -31
- package/src/services/ServerService.ts +7 -7
- package/src/utils/adoUtils.ts +3 -3
- package/src/utils/feedUtils.ts +2 -2
- package/src/utils/githubUtils.ts +2 -2
- package/src/utils/logger.ts +13 -1
- package/src/utils/macroExpressionUtils.ts +1 -1
- package/src/utils/osUtils.ts +4 -4
- package/src/web/contract/serverContract.ts +2 -2
- package/src/web/public/index.html +1 -3
- package/src/web/public/js/api.js +2 -80
- package/src/web/public/js/modal/installation.js +1 -1
- package/src/web/public/js/onboard/ONBOARDING_PAGE_DESIGN.md +41 -9
- package/src/web/public/js/onboard/formProcessor.js +200 -34
- package/src/web/public/js/onboard/index.js +2 -2
- package/src/web/public/js/onboard/publishHandler.js +30 -22
- package/src/web/public/js/onboard/templates.js +34 -40
- package/src/web/public/js/onboard/uiHandlers.js +175 -84
- package/src/web/public/js/onboard/validationHandlers.js +147 -64
- package/src/web/public/js/serverCategoryDetails.js +19 -4
- package/src/web/public/js/serverCategoryList.js +13 -1
- package/src/web/public/onboard.html +1 -1
- package/src/web/server.ts +30 -14
- package/src/services/InstallRequestValidator.ts +0 -112
- /package/src/core/{constants.ts → metadatas/constants.ts} +0 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import fs from 'fs/promises';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { LOCAL_FEEDS_SCHEMA_DIR } from '../metadatas/constants.js';
|
|
4
|
+
import { Logger } from '../../utils/logger.js';
|
|
5
|
+
import { ServerSchema } from './ServerSchemaProvider.js';
|
|
6
|
+
|
|
7
|
+
export class ServerSchemaLoader {
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Loads a single schema file.
|
|
11
|
+
* @param filePath The absolute path to the schema file.
|
|
12
|
+
* @returns A Promise that resolves to the ServerSchema or undefined if not found or error.
|
|
13
|
+
*/
|
|
14
|
+
public static async loadSchema(filePath: string): Promise<ServerSchema | undefined> {
|
|
15
|
+
try {
|
|
16
|
+
const content = await fs.readFile(filePath, 'utf8');
|
|
17
|
+
const schema = JSON.parse(content);
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
schema: schema
|
|
21
|
+
};
|
|
22
|
+
} catch (error) {
|
|
23
|
+
if ((error as NodeJS.ErrnoException).code === 'ENOENT') {
|
|
24
|
+
Logger.debug(`No schema file found at ${filePath}`);
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
Logger.error(`Error loading schema from ${filePath}:`, error);
|
|
28
|
+
// Optionally rethrow or return undefined based on desired error handling
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Loads all schemas from the default feeds directory.
|
|
35
|
+
* @param defaultFeedsDir The path to the default feeds directory.
|
|
36
|
+
* @param schemaMap The map to populate with loaded schemas.
|
|
37
|
+
*/
|
|
38
|
+
public static async loadAllDefaultSchemas(defaultFeedsDir: string, schemaMap: Map<string, Map<string, ServerSchema>>): Promise<void> {
|
|
39
|
+
schemaMap.clear(); // Clear map for initial load from default directory
|
|
40
|
+
|
|
41
|
+
try {
|
|
42
|
+
const categoryDirs = await fs.readdir(defaultFeedsDir, { withFileTypes: true });
|
|
43
|
+
|
|
44
|
+
for (const categoryDir of categoryDirs) {
|
|
45
|
+
if (categoryDir.isDirectory()) {
|
|
46
|
+
const categoryName = categoryDir.name;
|
|
47
|
+
const categoryPath = path.join(defaultFeedsDir, categoryName);
|
|
48
|
+
const serverFiles = await fs.readdir(categoryPath);
|
|
49
|
+
const serverSchemas = new Map<string, ServerSchema>();
|
|
50
|
+
|
|
51
|
+
for (const file of serverFiles) {
|
|
52
|
+
if (file.endsWith('.json')) {
|
|
53
|
+
try {
|
|
54
|
+
const schemaFilePath = path.join(categoryPath, file);
|
|
55
|
+
const schema = await this.loadSchema(schemaFilePath);
|
|
56
|
+
if (schema) {
|
|
57
|
+
serverSchemas.set(file, schema); // file is serverName
|
|
58
|
+
Logger.debug(`Loaded schema '${file}' for category '${categoryName}' from default directory`);
|
|
59
|
+
}
|
|
60
|
+
} catch (error) { // Error already logged in loadSchema
|
|
61
|
+
Logger.error(`Skipping schema file ${file} in category ${categoryName} due to loading error.`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
if (serverSchemas.size > 0) {
|
|
66
|
+
schemaMap.set(categoryName, serverSchemas);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
} catch (error) {
|
|
71
|
+
Logger.error(`Error reading schemas from default directory ${defaultFeedsDir}:`, error);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Loads schemas from an adhoc directory for a specific category.
|
|
77
|
+
* @param adhocSchemasDir The path to the adhoc schemas directory.
|
|
78
|
+
* @param categoryName The name of the category for these adhoc schemas.
|
|
79
|
+
* @param schemaMap The map to update with loaded adhoc schemas.
|
|
80
|
+
*/
|
|
81
|
+
public static async loadAdhocSchemas(adhocSchemasDir: string, categoryName: string, schemaMap: Map<string, Map<string, ServerSchema>>): Promise<void> {
|
|
82
|
+
try {
|
|
83
|
+
const serverFiles = await fs.readdir(adhocSchemasDir);
|
|
84
|
+
|
|
85
|
+
if (schemaMap.has(categoryName)) {
|
|
86
|
+
Logger.warn(`\x1b[33mAdhoc schema category '${categoryName}' (from dir: ${adhocSchemasDir}) conflicts with an existing category. Adhoc schemas in this category will override existing ones.\x1b[0m`);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
let serverSchemas = schemaMap.get(categoryName);
|
|
90
|
+
if (!serverSchemas) {
|
|
91
|
+
serverSchemas = new Map<string, ServerSchema>();
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
for (const file of serverFiles) {
|
|
95
|
+
if (file.endsWith('.json')) {
|
|
96
|
+
try {
|
|
97
|
+
const schemaFilePath = path.join(adhocSchemasDir, file);
|
|
98
|
+
const schema = await this.loadSchema(schemaFilePath);
|
|
99
|
+
if (schema) {
|
|
100
|
+
serverSchemas.set(file, schema); // file is serverName
|
|
101
|
+
Logger.debug(`Loaded adhoc schema '${file}' for category '${categoryName}'`);
|
|
102
|
+
}
|
|
103
|
+
} catch (error) { // Error already logged in loadSchema
|
|
104
|
+
Logger.error(`Skipping adhoc schema file ${file} in category ${categoryName} due to loading error.`);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (serverSchemas.size > 0) {
|
|
110
|
+
schemaMap.set(categoryName, serverSchemas);
|
|
111
|
+
}
|
|
112
|
+
} catch (error) {
|
|
113
|
+
// This case should ideally be caught by the fs.access check in ServerSchemaProvider.initialize
|
|
114
|
+
Logger.error(`Error reading adhoc schemas from directory ${adhocSchemasDir} for category ${categoryName}:`, error);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import fs from 'fs/promises';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { LOCAL_FEEDS_SCHEMA_DIR } from '../metadatas/constants.js';
|
|
4
|
+
import { Logger } from '../../utils/logger.js';
|
|
5
|
+
import { ServerSchemaLoader } from './ServerSchemaLoader.js';
|
|
6
|
+
|
|
7
|
+
export interface ServerSchema {
|
|
8
|
+
schema: Record<string, any>;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export class ServerSchemaProvider {
|
|
12
|
+
private static instance: ServerSchemaProvider;
|
|
13
|
+
private schemaMap: Map<string, Map<string, ServerSchema>>;
|
|
14
|
+
private schemaLock: Promise<void> = Promise.resolve();
|
|
15
|
+
|
|
16
|
+
private constructor() {
|
|
17
|
+
this.schemaMap = new Map();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public static getInstance(): ServerSchemaProvider {
|
|
21
|
+
if (!ServerSchemaProvider.instance) {
|
|
22
|
+
ServerSchemaProvider.instance = new ServerSchemaProvider();
|
|
23
|
+
// Initialize is now called with optional adhocSchemasDir,
|
|
24
|
+
// but getInstance is often called without it initially.
|
|
25
|
+
// The actual loading with adhoc dir will happen when MCPManager calls initialize.
|
|
26
|
+
}
|
|
27
|
+
return ServerSchemaProvider.instance;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
private async withLock<T>(operation: () => Promise<T>): Promise<T> {
|
|
31
|
+
const current = this.schemaLock;
|
|
32
|
+
let resolve: () => void;
|
|
33
|
+
this.schemaLock = new Promise<void>(r => resolve = r);
|
|
34
|
+
try {
|
|
35
|
+
await current;
|
|
36
|
+
return await operation();
|
|
37
|
+
} finally {
|
|
38
|
+
resolve!();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async initialize(adhocSchemasDir?: string): Promise<void> {
|
|
43
|
+
await this.withLock(async () => {
|
|
44
|
+
try {
|
|
45
|
+
// Create default feeds directory if it doesn't exist
|
|
46
|
+
await fs.mkdir(LOCAL_FEEDS_SCHEMA_DIR, { recursive: true });
|
|
47
|
+
|
|
48
|
+
// Load all schemas from the default feeds directory
|
|
49
|
+
await ServerSchemaLoader.loadAllDefaultSchemas(LOCAL_FEEDS_SCHEMA_DIR, this.schemaMap);
|
|
50
|
+
|
|
51
|
+
// Load schemas from adhoc directory if provided
|
|
52
|
+
if (adhocSchemasDir) {
|
|
53
|
+
try {
|
|
54
|
+
await fs.access(adhocSchemasDir); // Check if directory exists
|
|
55
|
+
const adhocCategoryName = path.basename(adhocSchemasDir);
|
|
56
|
+
Logger.info(`Loading adhoc schemas from: ${adhocSchemasDir} for category: ${adhocCategoryName}`);
|
|
57
|
+
await ServerSchemaLoader.loadAdhocSchemas(adhocSchemasDir, adhocCategoryName, this.schemaMap);
|
|
58
|
+
} catch (error) {
|
|
59
|
+
if ((error as NodeJS.ErrnoException).code === 'ENOENT') {
|
|
60
|
+
Logger.warn(`Adhoc schemas directory not found: ${adhocSchemasDir}`);
|
|
61
|
+
} else {
|
|
62
|
+
Logger.error(`Error accessing adhoc schemas directory ${adhocSchemasDir}:`, error);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
} catch (error) {
|
|
67
|
+
Logger.error('Error during schema initialization:', error);
|
|
68
|
+
throw error;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// The actual loading methods (loadSchema, loadAllSchemas, loadAdhocSchemas) have been moved to ServerSchemaLoader.
|
|
74
|
+
// ServerSchemaProvider now delegates to ServerSchemaLoader for these operations.
|
|
75
|
+
|
|
76
|
+
async getSchema(categoryName: string, schemaFileName: string): Promise<ServerSchema | undefined> {
|
|
77
|
+
return await this.withLock(async () => {
|
|
78
|
+
const categorySchemas = this.schemaMap.get(categoryName);
|
|
79
|
+
if (!categorySchemas) {
|
|
80
|
+
Logger.debug(`No schemas found for category ${categoryName}`);
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
const schema = categorySchemas.get(schemaFileName);
|
|
84
|
+
if (!schema) {
|
|
85
|
+
Logger.debug(`Schema ${schemaFileName} not found in category ${categoryName}`);
|
|
86
|
+
}
|
|
87
|
+
return schema;
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
async reloadSchemas(): Promise<void> {
|
|
92
|
+
return await this.withLock(async () => {
|
|
93
|
+
// Reloading should re-evaluate both default and any configured adhoc directory
|
|
94
|
+
// For simplicity, we assume initialize would be called again if adhoc path changes.
|
|
95
|
+
// This reload will just reload from the paths known during the last full initialize.
|
|
96
|
+
await this.initialize(); // This will re-load default and adhoc if adhocSchemasDir was set
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -24,7 +24,6 @@ export interface RequirementStatus {
|
|
|
24
24
|
export interface MCPServerStatus {
|
|
25
25
|
installedStatus: Record<string, OperationStatus>; // client: installed
|
|
26
26
|
name: string;
|
|
27
|
-
tags?: string[];
|
|
28
27
|
error?: string;
|
|
29
28
|
}
|
|
30
29
|
|
|
@@ -48,7 +47,6 @@ export interface MCPServerCategory {
|
|
|
48
47
|
displayName: string;
|
|
49
48
|
description?: string;
|
|
50
49
|
type: 'local';
|
|
51
|
-
tags?: string[];
|
|
52
50
|
path?: string;
|
|
53
51
|
installationStatus?: InstallationStatus;
|
|
54
52
|
feedConfiguration?: FeedConfiguration;
|
|
@@ -123,6 +121,7 @@ export interface McpConfig {
|
|
|
123
121
|
dependencies?: DependencyConfig;
|
|
124
122
|
schemas?: string; // Path to the schema file
|
|
125
123
|
repository?: string; // Repository URL for the server
|
|
124
|
+
systemTags?: Record<string, string>; // System tags for the feed
|
|
126
125
|
installation: InstallationConfig;
|
|
127
126
|
}
|
|
128
127
|
|
|
@@ -151,8 +150,10 @@ export interface FeedConfiguration {
|
|
|
151
150
|
displayName: string;
|
|
152
151
|
description: string;
|
|
153
152
|
repository?: string;
|
|
153
|
+
PullRequest?: string; // Optional Pull Request link
|
|
154
154
|
requirements: RequirementConfig[];
|
|
155
155
|
mcpServers: McpConfig[];
|
|
156
|
+
systemTags?: Record<string, string>; // System tags for the feed
|
|
156
157
|
}
|
|
157
158
|
|
|
158
159
|
export interface ClientSettings {
|