imcp 0.0.1

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.
Files changed (124) hide show
  1. package/.github/ISSUE_TEMPLATE/JitAccess.yml +28 -0
  2. package/.github/acl/access.yml +20 -0
  3. package/.github/compliance/inventory.yml +5 -0
  4. package/.github/policies/jit.yml +19 -0
  5. package/README.md +137 -0
  6. package/dist/cli/commands/install.d.ts +2 -0
  7. package/dist/cli/commands/install.js +105 -0
  8. package/dist/cli/commands/list.d.ts +2 -0
  9. package/dist/cli/commands/list.js +90 -0
  10. package/dist/cli/commands/pull.d.ts +2 -0
  11. package/dist/cli/commands/pull.js +17 -0
  12. package/dist/cli/commands/serve.d.ts +2 -0
  13. package/dist/cli/commands/serve.js +32 -0
  14. package/dist/cli/commands/start.d.ts +2 -0
  15. package/dist/cli/commands/start.js +32 -0
  16. package/dist/cli/commands/sync.d.ts +2 -0
  17. package/dist/cli/commands/sync.js +17 -0
  18. package/dist/cli/commands/uninstall.d.ts +2 -0
  19. package/dist/cli/commands/uninstall.js +39 -0
  20. package/dist/cli/index.d.ts +2 -0
  21. package/dist/cli/index.js +114 -0
  22. package/dist/core/ConfigurationProvider.d.ts +31 -0
  23. package/dist/core/ConfigurationProvider.js +416 -0
  24. package/dist/core/InstallationService.d.ts +17 -0
  25. package/dist/core/InstallationService.js +144 -0
  26. package/dist/core/MCPManager.d.ts +17 -0
  27. package/dist/core/MCPManager.js +98 -0
  28. package/dist/core/RequirementService.d.ts +45 -0
  29. package/dist/core/RequirementService.js +123 -0
  30. package/dist/core/constants.d.ts +29 -0
  31. package/dist/core/constants.js +55 -0
  32. package/dist/core/installers/BaseInstaller.d.ts +73 -0
  33. package/dist/core/installers/BaseInstaller.js +247 -0
  34. package/dist/core/installers/ClientInstaller.d.ts +17 -0
  35. package/dist/core/installers/ClientInstaller.js +307 -0
  36. package/dist/core/installers/CommandInstaller.d.ts +36 -0
  37. package/dist/core/installers/CommandInstaller.js +170 -0
  38. package/dist/core/installers/GeneralInstaller.d.ts +32 -0
  39. package/dist/core/installers/GeneralInstaller.js +87 -0
  40. package/dist/core/installers/InstallerFactory.d.ts +52 -0
  41. package/dist/core/installers/InstallerFactory.js +95 -0
  42. package/dist/core/installers/NpmInstaller.d.ts +25 -0
  43. package/dist/core/installers/NpmInstaller.js +123 -0
  44. package/dist/core/installers/PipInstaller.d.ts +25 -0
  45. package/dist/core/installers/PipInstaller.js +114 -0
  46. package/dist/core/installers/RequirementInstaller.d.ts +32 -0
  47. package/dist/core/installers/RequirementInstaller.js +3 -0
  48. package/dist/core/installers/index.d.ts +6 -0
  49. package/dist/core/installers/index.js +7 -0
  50. package/dist/core/types.d.ts +152 -0
  51. package/dist/core/types.js +16 -0
  52. package/dist/index.d.ts +11 -0
  53. package/dist/index.js +19 -0
  54. package/dist/services/InstallRequestValidator.d.ts +21 -0
  55. package/dist/services/InstallRequestValidator.js +99 -0
  56. package/dist/services/ServerService.d.ts +47 -0
  57. package/dist/services/ServerService.js +145 -0
  58. package/dist/utils/UpdateCheckTracker.d.ts +39 -0
  59. package/dist/utils/UpdateCheckTracker.js +80 -0
  60. package/dist/utils/clientUtils.d.ts +29 -0
  61. package/dist/utils/clientUtils.js +105 -0
  62. package/dist/utils/feedUtils.d.ts +5 -0
  63. package/dist/utils/feedUtils.js +29 -0
  64. package/dist/utils/githubAuth.d.ts +1 -0
  65. package/dist/utils/githubAuth.js +123 -0
  66. package/dist/utils/logger.d.ts +14 -0
  67. package/dist/utils/logger.js +90 -0
  68. package/dist/utils/osUtils.d.ts +16 -0
  69. package/dist/utils/osUtils.js +235 -0
  70. package/dist/web/public/css/modal.css +250 -0
  71. package/dist/web/public/css/notifications.css +70 -0
  72. package/dist/web/public/index.html +157 -0
  73. package/dist/web/public/js/api.js +213 -0
  74. package/dist/web/public/js/modal.js +572 -0
  75. package/dist/web/public/js/notifications.js +99 -0
  76. package/dist/web/public/js/serverCategoryDetails.js +210 -0
  77. package/dist/web/public/js/serverCategoryList.js +82 -0
  78. package/dist/web/public/modal.html +61 -0
  79. package/dist/web/public/styles.css +155 -0
  80. package/dist/web/server.d.ts +5 -0
  81. package/dist/web/server.js +150 -0
  82. package/package.json +53 -0
  83. package/src/cli/commands/install.ts +140 -0
  84. package/src/cli/commands/list.ts +112 -0
  85. package/src/cli/commands/pull.ts +16 -0
  86. package/src/cli/commands/serve.ts +37 -0
  87. package/src/cli/commands/uninstall.ts +54 -0
  88. package/src/cli/index.ts +127 -0
  89. package/src/core/ConfigurationProvider.ts +489 -0
  90. package/src/core/InstallationService.ts +173 -0
  91. package/src/core/MCPManager.ts +134 -0
  92. package/src/core/RequirementService.ts +147 -0
  93. package/src/core/constants.ts +61 -0
  94. package/src/core/installers/BaseInstaller.ts +292 -0
  95. package/src/core/installers/ClientInstaller.ts +423 -0
  96. package/src/core/installers/CommandInstaller.ts +185 -0
  97. package/src/core/installers/GeneralInstaller.ts +89 -0
  98. package/src/core/installers/InstallerFactory.ts +109 -0
  99. package/src/core/installers/NpmInstaller.ts +128 -0
  100. package/src/core/installers/PipInstaller.ts +121 -0
  101. package/src/core/installers/RequirementInstaller.ts +38 -0
  102. package/src/core/installers/index.ts +9 -0
  103. package/src/core/types.ts +163 -0
  104. package/src/index.ts +44 -0
  105. package/src/services/InstallRequestValidator.ts +112 -0
  106. package/src/services/ServerService.ts +181 -0
  107. package/src/utils/UpdateCheckTracker.ts +86 -0
  108. package/src/utils/clientUtils.ts +112 -0
  109. package/src/utils/feedUtils.ts +31 -0
  110. package/src/utils/githubAuth.ts +142 -0
  111. package/src/utils/logger.ts +101 -0
  112. package/src/utils/osUtils.ts +250 -0
  113. package/src/web/public/css/modal.css +250 -0
  114. package/src/web/public/css/notifications.css +70 -0
  115. package/src/web/public/index.html +157 -0
  116. package/src/web/public/js/api.js +213 -0
  117. package/src/web/public/js/modal.js +572 -0
  118. package/src/web/public/js/notifications.js +99 -0
  119. package/src/web/public/js/serverCategoryDetails.js +210 -0
  120. package/src/web/public/js/serverCategoryList.js +82 -0
  121. package/src/web/public/modal.html +61 -0
  122. package/src/web/public/styles.css +155 -0
  123. package/src/web/server.ts +195 -0
  124. package/tsconfig.json +18 -0
@@ -0,0 +1,157 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <title>IMCP Server Manager</title>
8
+ <script src="https://cdn.tailwindcss.com"></script>
9
+ <link href="https://unpkg.com/boxicons@2.1.4/css/boxicons.min.css" rel="stylesheet">
10
+ <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
11
+ <link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.2/font/bootstrap-icons.css" rel="stylesheet">
12
+ <link rel="stylesheet" href="styles.css">
13
+ <link rel="stylesheet" href="css/modal.css">
14
+ <link rel="stylesheet" href="css/notifications.css">
15
+ <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
16
+
17
+ <!-- Alert container for notifications -->
18
+ <div class="alert-container position-fixed top-0 end-0 p-3">
19
+ </div>
20
+ </head>
21
+
22
+ <body class="bg-gray-50 min-h-screen">
23
+ <div class="container mx-auto px-4 py-6">
24
+ <header class="mb-8">
25
+ <h1 class="text-3xl font-bold text-gray-900 flex items-center justify-center">
26
+ <i class='bx bx-server mr-3 text-blue-600'></i>
27
+ IMCP Server Manager
28
+ </h1>
29
+ </header>
30
+
31
+ <div class="search-controls mb-6">
32
+ <div class="relative max-w-2xl mx-auto">
33
+ <input type="text" id="searchBox" placeholder="Search servers or tools..." class="search-input">
34
+ <i class='bx bx-search absolute left-3 top-1/2 transform -translate-y-1/2 text-gray-400'></i>
35
+ </div>
36
+ </div>
37
+
38
+ <div class="flex flex-col lg:flex-row gap-6">
39
+ <!-- Server List Sidebar -->
40
+ <div class="lg:w-1/3">
41
+ <div class="bg-white rounded-xl shadow-sm border border-gray-100 p-6">
42
+ <h2 class="text-xl font-semibold mb-4 text-gray-900 flex items-center">
43
+ <i class='bx bx-list-ul mr-2 text-blue-600'></i>
44
+ MCP Server Categories
45
+ </h2>
46
+ <div class="server-list space-y-3" id="serverCategoryList">
47
+ <div class="animate-pulse">
48
+ <p class="text-gray-500">Loading MCP server categories...</p>
49
+ </div>
50
+ </div>
51
+ </div>
52
+ </div>
53
+
54
+ <!-- Main Content Area -->
55
+ <div class="lg:w-2/3">
56
+ <div class="bg-white rounded-xl shadow-sm border border-gray-100 p-6">
57
+ <h2 class="text-xl font-semibold mb-4 text-gray-900 flex items-center">
58
+ <i class='bx bx-detail mr-2 text-blue-600'></i>
59
+ Server Category Details
60
+ </h2>
61
+ <div id="serverCategoryDetails" class="text-gray-600">
62
+ <div class="flex items-center justify-center h-32 text-gray-400">
63
+ <div class="text-center">
64
+ <i class='bx bx-selection text-4xl mb-2'></i>
65
+ <p>Select a server category from the list to see details</p>
66
+ </div>
67
+ </div>
68
+ </div>
69
+ <div id="toolMcpsList" class="mt-6 grid gap-4">
70
+ <!-- Tool cards will be dynamically inserted here -->
71
+ </div>
72
+ </div>
73
+ </div>
74
+ </div>
75
+ </div>
76
+
77
+ <!-- Installation Modal -->
78
+ <div id="installModal" class="modal">
79
+ <div class="modal-content">
80
+ <div class="flex justify-between items-center mb-4">
81
+ <h3 id="modalTitle" class="text-xl font-semibold text-gray-900">Install MCP Tool</h3>
82
+ <span class="close" onclick="closeModal()">&times;</span>
83
+ </div>
84
+ <form id="installForm">
85
+ <!-- Requirements Section -->
86
+ <div id="modalRequirements" class="mb-6">
87
+ <!-- Requirements will be injected here -->
88
+ </div>
89
+
90
+ <!-- Target Selection Section -->
91
+ <div id="modalTargets" class="bg-gray-50 rounded-lg">
92
+ <!-- Target options will be injected here -->
93
+ </div>
94
+
95
+ <!-- Environment Variables Section -->
96
+ <div id="modalEnvInputs" class="space-y-4">
97
+ <!-- Environment variable inputs will be injected here -->
98
+ </div>
99
+
100
+ <div class="flex justify-end space-x-4 mt-6">
101
+ <button type="button" onclick="closeModal()"
102
+ class="px-4 py-2 text-gray-600 hover:text-gray-800 font-medium rounded-md hover:bg-gray-100 transition-colors">
103
+ Cancel
104
+ </button>
105
+ <button type="submit" class="submit-button">
106
+ <i class='bx bx-download mr-2'></i>
107
+ Install
108
+ </button>
109
+ </div>
110
+ </form>
111
+ </div>
112
+ </div>
113
+ <!-- Loading Modal -->
114
+ <div id="installLoadingModal" class="modal" style="display:none; z-index:2000;">
115
+ <div class="modal-content" style="text-align:center; pointer-events:auto;">
116
+ <div style="margin-top:40px;">
117
+ <div class="loading-icon" style="margin-bottom:16px;">
118
+ <svg width="48" height="48" viewBox="0 0 48 48" fill="none">
119
+ <circle cx="24" cy="24" r="20" stroke="#888" stroke-width="4" opacity="0.2"/>
120
+ <circle cx="24" cy="24" r="20" stroke="#3498db" stroke-width="4" stroke-linecap="round" stroke-dasharray="100" stroke-dashoffset="60">
121
+ <animateTransform attributeName="transform" type="rotate" from="0 24 24" to="360 24 24" dur="1s" repeatCount="indefinite"/>
122
+ </circle>
123
+ </svg>
124
+ </div>
125
+ <div class="loading-title" style="font-size:1.5rem; font-weight:bold; margin-bottom:8px;">Installing...</div>
126
+ <div id="installLoadingMessage" style="min-height:48px; max-height:160px; overflow:auto; background:#f8f8f8; border-radius:6px; padding:12px; font-size:1rem; color:#444; text-align:left;"></div>
127
+ </div>
128
+ </div>
129
+ </div>
130
+
131
+ <!-- Module scripts -->
132
+ <script type="module">
133
+ import { fetchServerCategories, handleInstallServer, installRequirement, upgradeRequirement, uninstallTool } from './js/api.js';
134
+ import { setupSearch } from './js/serverCategoryList.js';
135
+ import { showServerDetails } from './js/serverCategoryDetails.js';
136
+ import { showInstallModal, closeModal, setupModalOutsideClick } from './js/modal.js';
137
+
138
+ // Make necessary functions available globally
139
+ window.showServerDetails = showServerDetails;
140
+ window.showInstallModal = showInstallModal;
141
+ window.closeModal = closeModal;
142
+ window.handleInstallServer = handleInstallServer;
143
+ window.installRequirement = installRequirement;
144
+ window.upgradeRequirement = upgradeRequirement;
145
+ window.uninstallTool = uninstallTool;
146
+
147
+ // Initialize
148
+ document.addEventListener('DOMContentLoaded', () => {
149
+ setupSearch();
150
+ setupModalOutsideClick();
151
+ fetchServerCategories();
152
+ });
153
+ </script>
154
+ <script src="js/modal.js" type="module"></script>
155
+ </body>
156
+
157
+ </html>
@@ -0,0 +1,213 @@
1
+ import { renderServerCategoryList } from './serverCategoryList.js';
2
+ import { showToast } from './notifications.js';
3
+
4
+ // Global store for server data
5
+ let allServerCategoriesData = [];
6
+
7
+ // Fetch and display servers
8
+ async function fetchServerCategories() {
9
+ try {
10
+ // Fetch all servers (without filters)
11
+ const response = await fetch('/api/categories');
12
+ if (!response.ok) throw new Error(`HTTP error! status: ${response.status}`);
13
+ const responseData = await response.json();
14
+ if (!responseData.success || !responseData.data) {
15
+ throw new Error(`API Error fetching servers: ${responseData.error || 'Invalid data format'}`);
16
+ }
17
+ allServerCategoriesData = responseData.data; // Store globally
18
+
19
+ // Use the renderServerCategoryList function to display servers
20
+ renderServerCategoryList(allServerCategoriesData);
21
+
22
+ // Show the first category by default if there are categories
23
+ if (allServerCategoriesData.length > 0) {
24
+ window.showServerDetails(allServerCategoriesData[0].name);
25
+ }
26
+
27
+ // Check if search is active
28
+ const searchTerm = document.getElementById('searchBox').value.toLowerCase();
29
+ if (searchTerm) {
30
+ const filteredServerCategories = allServerCategoriesData.filter(server =>
31
+ (server.displayName || server.name).toLowerCase().includes(searchTerm) ||
32
+ (server.description || '').toLowerCase().includes(searchTerm)
33
+ );
34
+ renderServerCategoryList(filteredServerCategories);
35
+ }
36
+ } catch (error) {
37
+ console.error('Error fetching servers:', error);
38
+ document.getElementById('serverCategoryList').innerHTML =
39
+ '<p class="text-red-600">Error loading servers. Please check console and try again.</p>';
40
+ document.getElementById('serverCategoryDetails').innerHTML = ''; // Clear details on error
41
+ }
42
+ }
43
+
44
+ // Handle MCP tool installation
45
+ async function handleInstallServer(event, categoryName, serverName, callback, options = {}) {
46
+ event.preventDefault(); // Prevent page reload
47
+ console.log("Handling install for:", categoryName, serverName);
48
+
49
+ // Get selected targets from the form if not provided in options
50
+ const selectedTargets = options.targets || [...document.querySelectorAll('input[name="targets"]:checked')]
51
+ .map(cb => cb.value);
52
+
53
+ if (selectedTargets.length === 0) {
54
+ showToast('Please select at least one target', 'error');
55
+ return;
56
+ }
57
+
58
+ // Get environment variables from the form
59
+ const form = event.target;
60
+ const formData = new FormData(form);
61
+ const envValues = {};
62
+ formData.forEach((value, key) => {
63
+ if (!key.startsWith('targets') && value) { // Skip target checkboxes
64
+ envValues[key] = value;
65
+ }
66
+ });
67
+
68
+ try {
69
+ const serverList = {};
70
+ serverList[serverName] = {
71
+ env: envValues,
72
+ targetClients: selectedTargets
73
+ }; // Use serverName as key
74
+ const response = await fetch(`/api/categories/${categoryName}/install`, {
75
+ method: 'POST',
76
+ headers: { 'Content-Type': 'application/json' },
77
+ body: JSON.stringify({serverList: serverList})
78
+ });
79
+
80
+ if (!response.ok) {
81
+ const errorData = await response.text();
82
+ throw new Error(`Installation failed: ${errorData || response.statusText}`);
83
+ }
84
+
85
+ showToast('MCP server "' + serverName + '" for ' + categoryName + ' installation initiated successfully!', 'success');
86
+ window.closeModal();
87
+ fetchServerCategories(); // Refresh the main server list
88
+ window.showServerDetails(categoryName); // Refresh the details pane
89
+
90
+ } catch (error) {
91
+ console.error('Error installing MCP server:', error);
92
+ showToast('Error installing MCP server: ' + error.message + '. Please check console.', 'error');
93
+ }
94
+ }
95
+
96
+ // Install requirement handler
97
+ async function installRequirement(reqName) {
98
+ const detailsDiv = document.getElementById('serverCategoryDetails');
99
+ const serverTitle = detailsDiv.querySelector('h3');
100
+ if (!serverTitle) {
101
+ showToast('No server selected.', 'error');
102
+ return;
103
+ }
104
+ let serverName = serverTitle.textContent;
105
+ if (serverName.includes(' for ')) {
106
+ serverName = serverName.split(' for ')[0];
107
+ }
108
+ const confirmed = await showConfirm(`Do you want to install requirement '${reqName}' for ${serverName}?`);
109
+ if (!confirmed) {
110
+ return;
111
+ }
112
+
113
+ const btn = Array.from(document.querySelectorAll('button')).find(b => b.textContent.trim() === 'Install' && b.onclick?.toString().includes(reqName));
114
+ if (btn) btn.disabled = true;
115
+
116
+ try {
117
+ const response = await fetch(`/api/categories/${serverName}/install-requirement`, {
118
+ method: 'POST',
119
+ headers: { 'Content-Type': 'application/json' },
120
+ body: JSON.stringify({ requirementName: reqName })
121
+ });
122
+ if (!response.ok) {
123
+ const errorData = await response.text();
124
+ throw new Error(`Installation failed: ${errorData || response.statusText}`);
125
+ }
126
+ showToast(`Requirement '${reqName}' installation initiated successfully!`, 'success');
127
+ setTimeout(() => {
128
+ fetchServerCategories();
129
+ window.showServerDetails(serverName);
130
+ }, 1000);
131
+ } catch (error) {
132
+ console.error('Error installing requirement:', error);
133
+ showToast(`Error installing requirement: ${error.message}. Please check console.`, 'error');
134
+ } finally {
135
+ if (btn) btn.disabled = false;
136
+ }
137
+ }
138
+
139
+ // Handle upgrade/uninstall actions
140
+ async function upgradeRequirement(name) {
141
+ const serverTitle = document.querySelector('#serverCategoryDetails h3')?.textContent;
142
+ if (!serverTitle) {
143
+ showToast('No server selected.', 'error');
144
+ return;
145
+ }
146
+
147
+ const upgradeConfirmed = await showConfirm(`Do you want to upgrade requirement '${name}' for ${serverTitle}?`);
148
+ if (!upgradeConfirmed) {
149
+ return;
150
+ }
151
+
152
+ try {
153
+ const response = await fetch(`/api/categories/${serverTitle}/upgrade-requirement`, {
154
+ method: 'POST',
155
+ headers: { 'Content-Type': 'application/json' },
156
+ body: JSON.stringify({ requirementName: name })
157
+ });
158
+
159
+ if (!response.ok) {
160
+ const errorData = await response.text();
161
+ throw new Error(`Upgrade failed: ${errorData || response.statusText}`);
162
+ }
163
+
164
+ showToast(`Requirement '${name}' upgrade initiated successfully!`, 'success');
165
+ fetchServerCategories();
166
+ window.showServerDetails(serverTitle);
167
+ } catch (error) {
168
+ console.error('Error upgrading requirement:', error);
169
+ showToast(`Error upgrading requirement: ${error.message}`, 'error');
170
+ }
171
+ }
172
+
173
+ async function uninstallTool(name) {
174
+ const serverTitle = document.querySelector('#serverCategoryDetails h3')?.textContent;
175
+ if (!serverTitle) {
176
+ showToast('No server selected.', 'error');
177
+ return;
178
+ }
179
+
180
+ const uninstallConfirmed = await showConfirm(`Do you want to uninstall tool '${name}' from ${serverTitle}?`);
181
+ if (!uninstallConfirmed) {
182
+ return;
183
+ }
184
+
185
+ try {
186
+ const response = await fetch(`/api/categories/${serverTitle}/uninstall-tool`, {
187
+ method: 'POST',
188
+ headers: { 'Content-Type': 'application/json' },
189
+ body: JSON.stringify({ toolName: name })
190
+ });
191
+
192
+ if (!response.ok) {
193
+ const errorData = await response.text();
194
+ throw new Error(`Uninstall failed: ${errorData || response.statusText}`);
195
+ }
196
+
197
+ showToast(`Tool '${name}' uninstall initiated successfully!`, 'success');
198
+ fetchServerCategories();
199
+ window.showServerDetails(serverTitle);
200
+ } catch (error) {
201
+ console.error('Error uninstalling tool:', error);
202
+ showToast(`Error uninstalling tool: ${error.message}`, 'error');
203
+ }
204
+ }
205
+
206
+ export {
207
+ allServerCategoriesData,
208
+ fetchServerCategories,
209
+ handleInstallServer,
210
+ installRequirement,
211
+ upgradeRequirement,
212
+ uninstallTool
213
+ };