@samanhappy/mcphub 0.6.1 → 0.7.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/README.md +40 -18
- package/README.zh.md +40 -17
- package/dist/config/index.js +3 -1
- package/dist/config/index.js.map +1 -1
- package/dist/controllers/configController.js +28 -0
- package/dist/controllers/configController.js.map +1 -0
- package/dist/controllers/serverController.js +83 -2
- package/dist/controllers/serverController.js.map +1 -1
- package/dist/db/connection.js +279 -0
- package/dist/db/connection.js.map +1 -0
- package/dist/db/entities/VectorEmbedding.js +62 -0
- package/dist/db/entities/VectorEmbedding.js.map +1 -0
- package/dist/db/entities/index.js +6 -0
- package/dist/db/entities/index.js.map +1 -0
- package/dist/db/index.js +32 -0
- package/dist/db/index.js.map +1 -0
- package/dist/db/repositories/BaseRepository.js +58 -0
- package/dist/db/repositories/BaseRepository.js.map +1 -0
- package/dist/db/repositories/VectorEmbeddingRepository.js +173 -0
- package/dist/db/repositories/VectorEmbeddingRepository.js.map +1 -0
- package/dist/db/repositories/index.js +4 -0
- package/dist/db/repositories/index.js.map +1 -0
- package/dist/db/subscribers/VectorEmbeddingSubscriber.js +56 -0
- package/dist/db/subscribers/VectorEmbeddingSubscriber.js.map +1 -0
- package/dist/db/types/postgresVectorType.js +33 -0
- package/dist/db/types/postgresVectorType.js.map +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/middlewares/index.js +18 -8
- package/dist/middlewares/index.js.map +1 -1
- package/dist/routes/index.js +13 -9
- package/dist/routes/index.js.map +1 -1
- package/dist/server.js +20 -11
- package/dist/server.js.map +1 -1
- package/dist/services/logService.js +54 -50
- package/dist/services/logService.js.map +1 -1
- package/dist/services/mcpService.js +209 -10
- package/dist/services/mcpService.js.map +1 -1
- package/dist/services/sseService.js +17 -10
- package/dist/services/sseService.js.map +1 -1
- package/dist/services/vectorSearchService.js +603 -0
- package/dist/services/vectorSearchService.js.map +1 -0
- package/dist/utils/version.js +23 -0
- package/dist/utils/version.js.map +1 -0
- package/frontend/dist/assets/favicon-DJnZjsC8.ico +0 -0
- package/frontend/dist/assets/index-D9p3VMBc.css +1 -0
- package/frontend/dist/assets/index-D_eNkDvW.js +148 -0
- package/frontend/dist/assets/index-D_eNkDvW.js.map +1 -0
- package/frontend/dist/index.html +3 -3
- package/package.json +15 -7
- package/frontend/dist/assets/favicon-DKeT5aEu.ico +0 -0
- package/frontend/dist/assets/index-2ChivQin.js +0 -148
- package/frontend/dist/assets/index-2ChivQin.js.map +0 -1
- package/frontend/dist/assets/index-DlUYoMya.css +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/db/repositories/index.ts"],"names":[],"mappings":"AAAA,OAAO,yBAAyB,MAAM,gCAAgC,CAAC;AAEvE,0BAA0B;AAC1B,OAAO,EAAE,yBAAyB,EAAE,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { EventSubscriber } from 'typeorm';
|
|
8
|
+
import { VectorEmbedding } from '../entities/VectorEmbedding.js';
|
|
9
|
+
/**
|
|
10
|
+
* A subscriber to format vector embeddings before saving to database
|
|
11
|
+
*/
|
|
12
|
+
let VectorEmbeddingSubscriber = class VectorEmbeddingSubscriber {
|
|
13
|
+
/**
|
|
14
|
+
* Indicates that this subscriber only listens to VectorEmbedding events
|
|
15
|
+
*/
|
|
16
|
+
listenTo() {
|
|
17
|
+
return VectorEmbedding;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Called before entity insertion
|
|
21
|
+
*/
|
|
22
|
+
beforeInsert(event) {
|
|
23
|
+
this.formatEmbedding(event.entity);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Called before entity update
|
|
27
|
+
*/
|
|
28
|
+
beforeUpdate(event) {
|
|
29
|
+
if (event.entity && event.entity.embedding) {
|
|
30
|
+
this.formatEmbedding(event.entity);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Format embedding as a proper vector string
|
|
35
|
+
*/
|
|
36
|
+
formatEmbedding(entity) {
|
|
37
|
+
if (!entity || !entity.embedding || !Array.isArray(entity.embedding)) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
// If the embedding is already a string, don't process it
|
|
41
|
+
if (typeof entity.embedding === 'string') {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
// Format array as proper pgvector string
|
|
45
|
+
// Ensure the string starts with '[' and ends with ']' as required by pgvector
|
|
46
|
+
const vectorString = `[${entity.embedding.join(',')}]`;
|
|
47
|
+
// Store the string directly (TypeORM will handle conversion)
|
|
48
|
+
// We need to use 'as any' because the type is declared as number[] but we're setting a string
|
|
49
|
+
entity.embedding = vectorString;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
VectorEmbeddingSubscriber = __decorate([
|
|
53
|
+
EventSubscriber()
|
|
54
|
+
], VectorEmbeddingSubscriber);
|
|
55
|
+
export { VectorEmbeddingSubscriber };
|
|
56
|
+
//# sourceMappingURL=VectorEmbeddingSubscriber.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VectorEmbeddingSubscriber.js","sourceRoot":"","sources":["../../../src/db/subscribers/VectorEmbeddingSubscriber.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAA6B,eAAe,EAA4B,MAAM,SAAS,CAAC;AAC/F,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAEjE;;GAEG;AAEI,IAAM,yBAAyB,GAA/B,MAAM,yBAAyB;IACpC;;OAEG;IACH,QAAQ;QACN,OAAO,eAAe,CAAC;IACzB,CAAC;IAED;;OAEG;IACH,YAAY,CAAC,KAAmC;QAC9C,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;IAED;;OAEG;IACH,YAAY,CAAC,KAAmC;QAC9C,IAAI,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;YAC3C,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,MAAyB,CAAC,CAAC;QACxD,CAAC;IACH,CAAC;IAED;;OAEG;IACK,eAAe,CAAC,MAAmC;QACzD,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,SAAS,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC;YACrE,OAAO;QACT,CAAC;QAED,yDAAyD;QACzD,IAAI,OAAO,MAAM,CAAC,SAAS,KAAK,QAAQ,EAAE,CAAC;YACzC,OAAO;QACT,CAAC;QAED,yCAAyC;QACzC,8EAA8E;QAC9E,MAAM,YAAY,GAAG,IAAI,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;QAEvD,6DAA6D;QAC7D,8FAA8F;QAC7F,MAAc,CAAC,SAAS,GAAG,YAAY,CAAC;IAC3C,CAAC;CACF,CAAA;AA7CY,yBAAyB;IADrC,eAAe,EAAE;GACL,yBAAyB,CA6CrC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Register the PostgreSQL vector type with TypeORM
|
|
3
|
+
* @param dataSource TypeORM data source
|
|
4
|
+
*/
|
|
5
|
+
export function registerPostgresVectorType(dataSource) {
|
|
6
|
+
// Skip if not postgres
|
|
7
|
+
if (dataSource.driver.options.type !== 'postgres') {
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
// Get the postgres driver
|
|
11
|
+
const pgDriver = dataSource.driver;
|
|
12
|
+
// Add 'vector' to the list of supported column types
|
|
13
|
+
if (pgDriver.supportedDataTypes) {
|
|
14
|
+
pgDriver.supportedDataTypes.push('vector');
|
|
15
|
+
}
|
|
16
|
+
// Override the normalization for the vector type
|
|
17
|
+
if (pgDriver.dataTypeDefaults) {
|
|
18
|
+
pgDriver.dataTypeDefaults['vector'] = {
|
|
19
|
+
type: 'vector',
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
// Override the column type resolver to prevent it from converting vector to other types
|
|
23
|
+
const originalColumnTypeResolver = pgDriver.columnTypeResolver;
|
|
24
|
+
if (originalColumnTypeResolver) {
|
|
25
|
+
pgDriver.columnTypeResolver = (column) => {
|
|
26
|
+
if (column.type === 'vector') {
|
|
27
|
+
return 'vector';
|
|
28
|
+
}
|
|
29
|
+
return originalColumnTypeResolver(column);
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=postgresVectorType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgresVectorType.js","sourceRoot":"","sources":["../../../src/db/types/postgresVectorType.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,UAAU,0BAA0B,CAAC,UAAsB;IAC/D,uBAAuB;IACvB,IAAI,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;QAClD,OAAO;IACT,CAAC;IAED,0BAA0B;IAC1B,MAAM,QAAQ,GAAG,UAAU,CAAC,MAAM,CAAC;IAEnC,qDAAqD;IACrD,IAAI,QAAQ,CAAC,kBAAkB,EAAE,CAAC;QAChC,QAAQ,CAAC,kBAAkB,CAAC,IAAI,CAAC,QAAe,CAAC,CAAC;IACpD,CAAC;IAED,iDAAiD;IACjD,IAAK,QAAgB,CAAC,gBAAgB,EAAE,CAAC;QACtC,QAAgB,CAAC,gBAAgB,CAAC,QAAQ,CAAC,GAAG;YAC7C,IAAI,EAAE,QAAQ;SACf,CAAC;IACJ,CAAC;IAED,wFAAwF;IACxF,MAAM,0BAA0B,GAAI,QAAgB,CAAC,kBAAkB,CAAC;IACxE,IAAI,0BAA0B,EAAE,CAAC;QAC9B,QAAgB,CAAC,kBAAkB,GAAG,CAAC,MAAW,EAAE,EAAE;YACrD,IAAI,MAAM,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;gBAC7B,OAAO,QAAQ,CAAC;YAClB,CAAC;YACD,OAAO,0BAA0B,CAAC,MAAM,CAAC,CAAC;QAC5C,CAAC,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC,MAAM,SAAS,GAAG,IAAI,SAAS,EAAE,CAAC;AAElC,KAAK,UAAU,IAAI;IACjB,IAAI,CAAC;QACH,MAAM,SAAS,CAAC,UAAU,EAAE,CAAC;QAC7B,SAAS,CAAC,KAAK,EAAE,CAAC;IACpB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,8BAA8B,EAAE,KAAK,CAAC,CAAC;QACrD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC;AAEP,eAAe,SAAS,CAAC,MAAM,EAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,SAAS,MAAM,aAAa,CAAC;AAEpC,MAAM,SAAS,GAAG,IAAI,SAAS,EAAE,CAAC;AAElC,KAAK,UAAU,IAAI;IACjB,IAAI,CAAC;QACH,MAAM,SAAS,CAAC,UAAU,EAAE,CAAC;QAC7B,SAAS,CAAC,KAAK,EAAE,CAAC;IACpB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,8BAA8B,EAAE,KAAK,CAAC,CAAC;QACrD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC;AAEP,eAAe,SAAS,CAAC,MAAM,EAAE,CAAC"}
|
|
@@ -5,6 +5,7 @@ import { dirname } from 'path';
|
|
|
5
5
|
import fs from 'fs';
|
|
6
6
|
import { auth } from './auth.js';
|
|
7
7
|
import { initializeDefaultUser } from '../models/User.js';
|
|
8
|
+
import config from '../config/index.js';
|
|
8
9
|
// Create __dirname equivalent for ES modules
|
|
9
10
|
const __filename = fileURLToPath(import.meta.url);
|
|
10
11
|
const __dirname = dirname(__filename);
|
|
@@ -34,9 +35,14 @@ export const errorHandler = (err, _req, res, _next) => {
|
|
|
34
35
|
};
|
|
35
36
|
export const initMiddlewares = (app) => {
|
|
36
37
|
// Serve static files from the dynamically determined frontend path
|
|
37
|
-
|
|
38
|
+
// Note: Static files will be handled by the server directly, not here
|
|
38
39
|
app.use((req, res, next) => {
|
|
39
|
-
|
|
40
|
+
const basePath = config.basePath;
|
|
41
|
+
// Only apply JSON parsing for API and auth routes, not for SSE or message endpoints
|
|
42
|
+
if (req.path !== `${basePath}/sse` &&
|
|
43
|
+
req.path !== `${basePath}/messages` &&
|
|
44
|
+
!req.path.startsWith(`${basePath}/sse/`) &&
|
|
45
|
+
!req.path.startsWith(`${basePath}/mcp/`)) {
|
|
40
46
|
express.json()(req, res, next);
|
|
41
47
|
}
|
|
42
48
|
else {
|
|
@@ -44,14 +50,18 @@ export const initMiddlewares = (app) => {
|
|
|
44
50
|
}
|
|
45
51
|
});
|
|
46
52
|
// Initialize default admin user if no users exist
|
|
47
|
-
initializeDefaultUser().catch(err => {
|
|
53
|
+
initializeDefaultUser().catch((err) => {
|
|
48
54
|
console.error('Error initializing default user:', err);
|
|
49
55
|
});
|
|
50
|
-
// Protect
|
|
51
|
-
app.use(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
56
|
+
// Protect API routes with authentication middleware, but exclude auth endpoints
|
|
57
|
+
app.use(`${config.basePath}/api`, (req, res, next) => {
|
|
58
|
+
// Skip authentication for login and register endpoints
|
|
59
|
+
if (req.path === '/auth/login' || req.path === '/auth/register') {
|
|
60
|
+
next();
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
auth(req, res, next);
|
|
64
|
+
}
|
|
55
65
|
});
|
|
56
66
|
app.use(errorHandler);
|
|
57
67
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/middlewares/index.ts"],"names":[],"mappings":"AAAA,OAAO,OAA4C,MAAM,SAAS,CAAC;AACnE,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/middlewares/index.ts"],"names":[],"mappings":"AAAA,OAAO,OAA4C,MAAM,SAAS,CAAC;AACnE,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC/B,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,IAAI,EAA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GAAG,CAAC,IAAI,KAAK,aAAa,IAAI,GAAG,CAAC,IAAI,KAAK,gBAAgB,EAAE,CAAC;YAChE,IAAI,EAAE,CAAC;QACT,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;QACvB,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,GAAG,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;AACxB,CAAC,CAAC"}
|
package/dist/routes/index.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import express from 'express';
|
|
2
2
|
import { check } from 'express-validator';
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import config from '../config/index.js';
|
|
4
|
+
import { getAllServers, getAllSettings, createServer, updateServer, deleteServer, toggleServer, updateSystemConfig, } from '../controllers/serverController.js';
|
|
5
|
+
import { getGroups, getGroup, createNewGroup, updateExistingGroup, deleteExistingGroup, addServerToExistingGroup, removeServerFromExistingGroup, getGroupServers, updateGroupServersBatch, } from '../controllers/groupController.js';
|
|
6
|
+
import { getAllMarketServers, getMarketServer, getAllMarketCategories, getAllMarketTags, searchMarketServersByQuery, getMarketServersByCategory, getMarketServersByTag, } from '../controllers/marketController.js';
|
|
6
7
|
import { login, register, getCurrentUser, changePassword } from '../controllers/authController.js';
|
|
7
8
|
import { getAllLogs, clearLogs, streamLogs } from '../controllers/logController.js';
|
|
9
|
+
import { getRuntimeConfig } from '../controllers/configController.js';
|
|
8
10
|
import { auth } from '../middlewares/auth.js';
|
|
9
11
|
const router = express.Router();
|
|
10
12
|
export const initRoutes = (app) => {
|
|
@@ -39,23 +41,25 @@ export const initRoutes = (app) => {
|
|
|
39
41
|
router.get('/logs', getAllLogs);
|
|
40
42
|
router.delete('/logs', clearLogs);
|
|
41
43
|
router.get('/logs/stream', streamLogs);
|
|
42
|
-
// Auth routes
|
|
43
|
-
|
|
44
|
+
// Auth routes - move to router instead of app directly
|
|
45
|
+
router.post('/auth/login', [
|
|
44
46
|
check('username', 'Username is required').not().isEmpty(),
|
|
45
47
|
check('password', 'Password is required').not().isEmpty(),
|
|
46
48
|
], login);
|
|
47
|
-
|
|
49
|
+
router.post('/auth/register', [
|
|
48
50
|
check('username', 'Username is required').not().isEmpty(),
|
|
49
51
|
check('password', 'Password must be at least 6 characters').isLength({ min: 6 }),
|
|
50
52
|
], register);
|
|
51
|
-
|
|
53
|
+
router.get('/auth/user', auth, getCurrentUser);
|
|
52
54
|
// Add change password route
|
|
53
|
-
|
|
55
|
+
router.post('/auth/change-password', [
|
|
54
56
|
auth,
|
|
55
57
|
check('currentPassword', 'Current password is required').not().isEmpty(),
|
|
56
58
|
check('newPassword', 'New password must be at least 6 characters').isLength({ min: 6 }),
|
|
57
59
|
], changePassword);
|
|
58
|
-
|
|
60
|
+
// Runtime configuration endpoint (no auth required for frontend initialization)
|
|
61
|
+
app.get(`${config.basePath}/config`, getRuntimeConfig);
|
|
62
|
+
app.use(`${config.basePath}/api`, router);
|
|
59
63
|
};
|
|
60
64
|
export default router;
|
|
61
65
|
//# sourceMappingURL=index.js.map
|
package/dist/routes/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/routes/index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EACL,aAAa,EACb,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,kBAAkB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/routes/index.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EACL,aAAa,EACb,cAAc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U,CAAC,CAAC;IAEvC,uDAAuD;IACvD,MAAM,CAAC,IAAI,CACT,aAAa,EACb;QACE,KAAK,CAAC,UAAU,EAAE,sBAAsB,CAAC,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE;QACzD,KAAK,CAAC,UAAU,EAAE,sBAAsB,CAAC,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE;KAC1D,EACD,KAAK,CACN,CAAC;IAEF,MAAM,CAAC,IAAI,CACT,gBAAgB,EAChB;QACE,KAAK,CAAC,UAAU,EAAE,sBAAsB,CAAC,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE;QACzD,KAAK,CAAC,UAAU,EAAE,wCAAwC,CAAC,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;KACjF,EACD,QAAQ,CACT,CAAC;IAEF,MAAM,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;IAE/C,4BAA4B;IAC5B,MAAM,CAAC,IAAI,CACT,uBAAuB,EACvB;QACE,IAAI;QACJ,KAAK,CAAC,iBAAiB,EAAE,8BAA8B,CAAC,CAAC,GAAG,EAAE,CAAC,OAAO,EAAE;QACxE,KAAK,CAAC,aAAa,EAAE,4CAA4C,CAAC,CAAC,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;KACxF,EACD,cAAc,CACf,CAAC;IAEF,gFAAgF;IAChF,GAAG,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,QAAQ,SAAS,EAAE,gBAAgB,CAAC,CAAC;IAEvD,GAAG,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,QAAQ,MAAM,EAAE,MAAM,CAAC,CAAC;AAC5C,CAAC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
package/dist/server.js
CHANGED
|
@@ -3,7 +3,7 @@ import config from './config/index.js';
|
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import { fileURLToPath } from 'url';
|
|
5
5
|
import fs from 'fs';
|
|
6
|
-
import {
|
|
6
|
+
import { initUpstreamServers } from './services/mcpService.js';
|
|
7
7
|
import { initMiddlewares } from './middlewares/index.js';
|
|
8
8
|
import { initRoutes } from './routes/index.js';
|
|
9
9
|
import { handleSseConnection, handleSseMessage, handleMcpPostRequest, handleMcpOtherRequest, } from './services/sseService.js';
|
|
@@ -16,6 +16,7 @@ export class AppServer {
|
|
|
16
16
|
this.frontendPath = null;
|
|
17
17
|
this.app = express();
|
|
18
18
|
this.port = config.port;
|
|
19
|
+
this.basePath = config.basePath;
|
|
19
20
|
}
|
|
20
21
|
async initialize() {
|
|
21
22
|
try {
|
|
@@ -24,14 +25,14 @@ export class AppServer {
|
|
|
24
25
|
initMiddlewares(this.app);
|
|
25
26
|
initRoutes(this.app);
|
|
26
27
|
console.log('Server initialized successfully');
|
|
27
|
-
|
|
28
|
+
initUpstreamServers()
|
|
28
29
|
.then(() => {
|
|
29
30
|
console.log('MCP server initialized successfully');
|
|
30
|
-
this.app.get(
|
|
31
|
-
this.app.post(
|
|
32
|
-
this.app.post(
|
|
33
|
-
this.app.get(
|
|
34
|
-
this.app.delete(
|
|
31
|
+
this.app.get(`${this.basePath}/sse/:group?`, (req, res) => handleSseConnection(req, res));
|
|
32
|
+
this.app.post(`${this.basePath}/messages`, handleSseMessage);
|
|
33
|
+
this.app.post(`${this.basePath}/mcp/:group?`, handleMcpPostRequest);
|
|
34
|
+
this.app.get(`${this.basePath}/mcp/:group?`, handleMcpOtherRequest);
|
|
35
|
+
this.app.delete(`${this.basePath}/mcp/:group?`, handleMcpOtherRequest);
|
|
35
36
|
})
|
|
36
37
|
.catch((error) => {
|
|
37
38
|
console.error('Error initializing MCP server:', error);
|
|
@@ -52,17 +53,25 @@ export class AppServer {
|
|
|
52
53
|
this.frontendPath = this.findFrontendDistPath();
|
|
53
54
|
if (this.frontendPath) {
|
|
54
55
|
console.log(`Serving frontend from: ${this.frontendPath}`);
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
// Serve static files with base path
|
|
57
|
+
this.app.use(this.basePath, express.static(this.frontendPath));
|
|
58
|
+
// Add the wildcard route for SPA with base path
|
|
57
59
|
if (fs.existsSync(path.join(this.frontendPath, 'index.html'))) {
|
|
58
|
-
this.app.get(
|
|
60
|
+
this.app.get(`${this.basePath}/*`, (_req, res) => {
|
|
59
61
|
res.sendFile(path.join(this.frontendPath, 'index.html'));
|
|
60
62
|
});
|
|
63
|
+
// Also handle root redirect if base path is set
|
|
64
|
+
if (this.basePath) {
|
|
65
|
+
this.app.get('/', (_req, res) => {
|
|
66
|
+
res.redirect(this.basePath);
|
|
67
|
+
});
|
|
68
|
+
}
|
|
61
69
|
}
|
|
62
70
|
}
|
|
63
71
|
else {
|
|
64
72
|
console.warn('Frontend dist directory not found. Server will run without frontend.');
|
|
65
|
-
this.
|
|
73
|
+
const rootPath = this.basePath || '/';
|
|
74
|
+
this.app.get(rootPath, (_req, res) => {
|
|
66
75
|
res
|
|
67
76
|
.status(404)
|
|
68
77
|
.send('Frontend not found. MCPHub API is running, but the UI is not available.');
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,MAAM,MAAM,mBAAmB,CAAC;AACvC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,MAAM,IAA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e,EAAE,MAAM,CAAC,CAAC,CAAC;oBACjE,IAAI,GAAG,CAAC,IAAI,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,KAAK,oBAAoB,EAAE,CAAC;wBAC/D,IAAI,KAAK,EAAE,CAAC;4BACV,OAAO,CAAC,GAAG,CAAC,gCAAgC,eAAe,EAAE,CAAC,CAAC;wBACjE,CAAC;wBACD,OAAO,IAAI,CAAC;oBACd,CAAC;gBACH,CAAC;gBAAC,OAAO,CAAC,EAAE,CAAC;oBACX,IAAI,KAAK,EAAE,CAAC;wBACV,OAAO,CAAC,KAAK,CAAC,0CAA0C,eAAe,GAAG,EAAE,CAAC,CAAC,CAAC;oBACjF,CAAC;oBACD,sCAAsC;gBACxC,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED,eAAe,SAAS,CAAC"}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// filepath: /Users/sunmeng/code/github/mcphub/src/services/logService.ts
|
|
2
|
-
import { spawn } from 'child_process';
|
|
3
1
|
import { EventEmitter } from 'events';
|
|
4
2
|
import * as os from 'os';
|
|
5
3
|
import * as process from 'process';
|
|
@@ -27,14 +25,14 @@ const colors = {
|
|
|
27
25
|
bgBlue: '\x1b[44m',
|
|
28
26
|
bgMagenta: '\x1b[45m',
|
|
29
27
|
bgCyan: '\x1b[46m',
|
|
30
|
-
bgWhite: '\x1b[47m'
|
|
28
|
+
bgWhite: '\x1b[47m',
|
|
31
29
|
};
|
|
32
30
|
// Level colors for different log types
|
|
33
31
|
const levelColors = {
|
|
34
32
|
info: colors.green,
|
|
35
33
|
error: colors.red,
|
|
36
34
|
warn: colors.yellow,
|
|
37
|
-
debug: colors.cyan
|
|
35
|
+
debug: colors.cyan,
|
|
38
36
|
};
|
|
39
37
|
// Maximum number of logs to keep in memory
|
|
40
38
|
const MAX_LOGS = 1000;
|
|
@@ -42,7 +40,6 @@ class LogService {
|
|
|
42
40
|
constructor() {
|
|
43
41
|
this.logs = [];
|
|
44
42
|
this.logEmitter = new EventEmitter();
|
|
45
|
-
this.childProcesses = {};
|
|
46
43
|
this.mainProcessId = process.pid.toString();
|
|
47
44
|
this.hostname = os.hostname();
|
|
48
45
|
this.overrideConsole();
|
|
@@ -66,42 +63,75 @@ class LogService {
|
|
|
66
63
|
const originalConsoleError = console.error;
|
|
67
64
|
const originalConsoleWarn = console.warn;
|
|
68
65
|
const originalConsoleDebug = console.debug;
|
|
66
|
+
// Helper method to handle common logic for all console methods
|
|
67
|
+
const handleConsoleMethod = (type, originalMethod, ...args) => {
|
|
68
|
+
const firstArg = args.length > 0 ? this.formatArgument(args[0]) : { text: '' };
|
|
69
|
+
const remainingArgs = args.slice(1).map((arg) => this.formatArgument(arg).text);
|
|
70
|
+
const combinedMessage = [firstArg.text, ...remainingArgs].join(' ');
|
|
71
|
+
const source = firstArg.source || 'main';
|
|
72
|
+
const processId = firstArg.processId;
|
|
73
|
+
this.addLog(type, source, combinedMessage, processId);
|
|
74
|
+
originalMethod.apply(console, [
|
|
75
|
+
this.formatLogMessage(type, source, combinedMessage, processId),
|
|
76
|
+
]);
|
|
77
|
+
};
|
|
69
78
|
console.log = (...args) => {
|
|
70
|
-
|
|
71
|
-
this.addLog('info', 'main', message);
|
|
72
|
-
originalConsoleLog.apply(console, [this.formatLogMessage('info', 'main', message)]);
|
|
79
|
+
handleConsoleMethod('info', originalConsoleLog, ...args);
|
|
73
80
|
};
|
|
74
81
|
console.error = (...args) => {
|
|
75
|
-
|
|
76
|
-
this.addLog('error', 'main', message);
|
|
77
|
-
originalConsoleError.apply(console, [this.formatLogMessage('error', 'main', message)]);
|
|
82
|
+
handleConsoleMethod('error', originalConsoleError, ...args);
|
|
78
83
|
};
|
|
79
84
|
console.warn = (...args) => {
|
|
80
|
-
|
|
81
|
-
this.addLog('warn', 'main', message);
|
|
82
|
-
originalConsoleWarn.apply(console, [this.formatLogMessage('warn', 'main', message)]);
|
|
85
|
+
handleConsoleMethod('warn', originalConsoleWarn, ...args);
|
|
83
86
|
};
|
|
84
87
|
console.debug = (...args) => {
|
|
85
|
-
|
|
86
|
-
this.addLog('debug', 'main', message);
|
|
87
|
-
originalConsoleDebug.apply(console, [this.formatLogMessage('debug', 'main', message)]);
|
|
88
|
+
handleConsoleMethod('debug', originalConsoleDebug, ...args);
|
|
88
89
|
};
|
|
89
90
|
}
|
|
90
|
-
// Format an argument for logging
|
|
91
|
+
// Format an argument for logging and extract structured information
|
|
91
92
|
formatArgument(arg) {
|
|
93
|
+
// Handle null and undefined
|
|
92
94
|
if (arg === null)
|
|
93
|
-
return 'null';
|
|
95
|
+
return { text: 'null' };
|
|
94
96
|
if (arg === undefined)
|
|
95
|
-
return 'undefined';
|
|
97
|
+
return { text: 'undefined' };
|
|
98
|
+
// Handle objects
|
|
96
99
|
if (typeof arg === 'object') {
|
|
97
100
|
try {
|
|
98
|
-
return JSON.stringify(arg, null, 2);
|
|
101
|
+
return { text: JSON.stringify(arg, null, 2) };
|
|
99
102
|
}
|
|
100
103
|
catch (e) {
|
|
101
|
-
return String(arg);
|
|
104
|
+
return { text: String(arg) };
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
// Handle strings with potential structured information
|
|
108
|
+
const argStr = String(arg);
|
|
109
|
+
// Check for patterns like [processId] [source] message or [processId] [source-processId] message
|
|
110
|
+
const structuredPattern = /^\s*\[([^\]]+)\]\s*\[([^\]]+)\]\s*(.*)/;
|
|
111
|
+
const match = argStr.match(structuredPattern);
|
|
112
|
+
if (match) {
|
|
113
|
+
const [_, firstBracket, secondBracket, remainingText] = match;
|
|
114
|
+
// Check if the second bracket has a format like 'source-processId'
|
|
115
|
+
const sourcePidPattern = /^([^-]+)-(.+)$/;
|
|
116
|
+
const sourcePidMatch = secondBracket.match(sourcePidPattern);
|
|
117
|
+
if (sourcePidMatch) {
|
|
118
|
+
// If we have a 'source-processId' format in the second bracket
|
|
119
|
+
const [_, source, extractedProcessId] = sourcePidMatch;
|
|
120
|
+
return {
|
|
121
|
+
text: remainingText.trim(),
|
|
122
|
+
source: source.trim(),
|
|
123
|
+
processId: firstBracket.trim(),
|
|
124
|
+
};
|
|
102
125
|
}
|
|
126
|
+
// Otherwise treat first bracket as processId and second as source
|
|
127
|
+
return {
|
|
128
|
+
text: remainingText.trim(),
|
|
129
|
+
source: secondBracket.trim(),
|
|
130
|
+
processId: firstBracket.trim(),
|
|
131
|
+
};
|
|
103
132
|
}
|
|
104
|
-
|
|
133
|
+
// Return original string if no structured format is detected
|
|
134
|
+
return { text: argStr };
|
|
105
135
|
}
|
|
106
136
|
// Add a log entry to the logs array
|
|
107
137
|
addLog(type, source, message, processId) {
|
|
@@ -110,7 +140,7 @@ class LogService {
|
|
|
110
140
|
type,
|
|
111
141
|
source,
|
|
112
142
|
message,
|
|
113
|
-
processId: processId || this.mainProcessId
|
|
143
|
+
processId: processId || this.mainProcessId,
|
|
114
144
|
};
|
|
115
145
|
this.logs.push(log);
|
|
116
146
|
// Limit the number of logs kept in memory
|
|
@@ -120,32 +150,6 @@ class LogService {
|
|
|
120
150
|
// Emit the log event for SSE subscribers
|
|
121
151
|
this.logEmitter.emit('log', log);
|
|
122
152
|
}
|
|
123
|
-
// Capture output from a child process
|
|
124
|
-
captureChildProcess(command, args, processId) {
|
|
125
|
-
const childProcess = spawn(command, args);
|
|
126
|
-
this.childProcesses[processId] = childProcess;
|
|
127
|
-
childProcess.stdout.on('data', (data) => {
|
|
128
|
-
const output = data.toString().trim();
|
|
129
|
-
if (output) {
|
|
130
|
-
this.addLog('info', 'child-process', output, processId);
|
|
131
|
-
console.log(this.formatLogMessage('info', 'child-process', output, processId));
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
childProcess.stderr.on('data', (data) => {
|
|
135
|
-
const output = data.toString().trim();
|
|
136
|
-
if (output) {
|
|
137
|
-
this.addLog('error', 'child-process', output, processId);
|
|
138
|
-
console.error(this.formatLogMessage('error', 'child-process', output, processId));
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
childProcess.on('close', (code) => {
|
|
142
|
-
const message = `Process exited with code ${code}`;
|
|
143
|
-
this.addLog('info', 'child-process', message, processId);
|
|
144
|
-
console.log(this.formatLogMessage('info', 'child-process', message, processId));
|
|
145
|
-
delete this.childProcesses[processId];
|
|
146
|
-
});
|
|
147
|
-
return childProcess;
|
|
148
|
-
}
|
|
149
153
|
// Get all logs
|
|
150
154
|
getLogs() {
|
|
151
155
|
return this.logs;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logService.js","sourceRoot":"","sources":["../../src/services/logService.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"logService.js","sourceRoot":"","sources":["../../src/services/logService.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAUnC,sCAAsC;AACtC,MAAM,MAAM,GAAG;IACb,KAAK,EAAE,SAAS;IAChB,MAAM,EAAE,SAAS;IACjB,GAAG,EAAE,SAAS;IACd,UAAU,EAAE,SAAS;IACrB,KAAK,EAAE,SAAS;IAChB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,SAAS;IAEjB,KAAK,EAAE,UAAU;IACjB,GAAG,EAAE,UAAU;IACf,KAAK,EAAE,UAAU;IACjB,MAAM,EAAE,UAAU;IAClB,IAAI,EAAE,UAAU;IAChB,OAAO,EAAE,UAAU;IACnB,IAAI,EAAE,UAAU;IAChB,KAAK,EAAE,UAAU;IAEjB,OAAO,EAAE,UAAU;IACnB,KAAK,EAAE,UAAU;IACjB,OAAO,EAAE,UAAU;IACnB,QAAQ,EAAE,UAAU;IACpB,MAAM,EAAE,UAAU;IAClB,SAAS,EAAE,UAAU;IACrB,MAAM,EAAE,UAAU;IAClB,OAAO,EAAE,UAAU;CACpB,CAAC;AAEF,uCAAuC;AACvC,MAAM,WAAW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