@samanhappy/mcphub 0.0.18 → 0.0.21

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/bin/cli.js CHANGED
@@ -5,26 +5,53 @@ import { fileURLToPath } from 'url';
5
5
  import { execSync } from 'child_process';
6
6
  import fs from 'fs';
7
7
 
8
+ // Enable debug logging if needed
9
+ // process.env.DEBUG = 'true';
10
+
8
11
  const __filename = fileURLToPath(import.meta.url);
9
12
  const __dirname = path.dirname(__filename);
10
13
 
11
- // Try to find the package root directory
14
+ // Start with more debug information
15
+ console.log('📋 MCPHub CLI');
16
+ console.log(`📁 CLI script location: ${__dirname}`);
17
+
18
+ // The npm package directory structure when installed is:
19
+ // node_modules/@samanhappy/mcphub/
20
+ // - dist/
21
+ // - bin/
22
+ // - frontend/dist/
23
+
24
+ // Get the package root - this is where package.json is located
12
25
  function findPackageRoot() {
13
- // Possible locations for the package root
26
+ const isDebug = process.env.DEBUG === 'true';
27
+
28
+ // Possible locations for package.json
14
29
  const possibleRoots = [
15
- // Local development
30
+ // Standard npm package location
16
31
  path.resolve(__dirname, '..'),
17
- // When installed as dependency (node_modules/mcphub/bin)
18
- path.resolve(__dirname, '..', '..', '..'),
19
- // Global install or npx context
20
- path.resolve(path.dirname(process.argv[1]), '..')
32
+ // When installed via npx
33
+ path.resolve(__dirname, '..', '..', '..')
21
34
  ];
22
-
35
+
36
+ // Special handling for npx
37
+ if (process.argv[1] && process.argv[1].includes('_npx')) {
38
+ const npxDir = path.dirname(process.argv[1]);
39
+ possibleRoots.unshift(path.resolve(npxDir, '..'));
40
+ }
41
+
42
+ if (isDebug) {
43
+ console.log('DEBUG: Checking for package.json in:', possibleRoots);
44
+ }
45
+
23
46
  for (const root of possibleRoots) {
24
- if (fs.existsSync(path.join(root, 'package.json'))) {
47
+ const packageJsonPath = path.join(root, 'package.json');
48
+ if (fs.existsSync(packageJsonPath)) {
25
49
  try {
26
- const pkg = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8'));
27
- if (pkg.name === 'mcphub') {
50
+ const pkg = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
51
+ if (pkg.name === 'mcphub' || pkg.name === '@samanhappy/mcphub') {
52
+ if (isDebug) {
53
+ console.log(`DEBUG: Found package.json at ${packageJsonPath}`);
54
+ }
28
55
  return root;
29
56
  }
30
57
  } catch (e) {
@@ -33,31 +60,37 @@ function findPackageRoot() {
33
60
  }
34
61
  }
35
62
 
36
- // Default to the directory above this script
63
+ console.log('⚠️ Could not find package.json, using default path');
37
64
  return path.resolve(__dirname, '..');
38
65
  }
39
66
 
67
+ // Locate and check the frontend distribution
68
+ function checkFrontend(packageRoot) {
69
+ const isDebug = process.env.DEBUG === 'true';
70
+ const frontendDistPath = path.join(packageRoot, 'frontend', 'dist');
71
+
72
+ if (isDebug) {
73
+ console.log(`DEBUG: Checking frontend at: ${frontendDistPath}`);
74
+ }
75
+
76
+ if (fs.existsSync(frontendDistPath) && fs.existsSync(path.join(frontendDistPath, 'index.html'))) {
77
+ console.log('✅ Frontend distribution found');
78
+ return true;
79
+ } else {
80
+ console.log('⚠️ Frontend distribution not found at', frontendDistPath);
81
+ return false;
82
+ }
83
+ }
84
+
40
85
  const projectRoot = findPackageRoot();
41
86
  console.log(`📦 Using package root: ${projectRoot}`);
42
87
 
43
- // Check if frontend dist exists, if not, build it
44
- const frontendDistPath = path.join(projectRoot, 'frontend', 'dist');
45
- if (!fs.existsSync(frontendDistPath) || !fs.existsSync(path.join(frontendDistPath, 'index.html'))) {
46
- console.log('📦 Frontend dist not found, building...');
47
- try {
48
- execSync('npm run frontend:build', { stdio: 'inherit', cwd: projectRoot });
49
- console.log('✅ Frontend build successful');
50
- } catch (error) {
51
- console.error('❌ Failed to build frontend:', error);
52
- console.log('⚠️ Will start server without frontend. Please build frontend manually.');
53
- }
54
- } else {
55
- console.log('✅ Frontend dist found');
56
- }
88
+ // Check if frontend exists
89
+ checkFrontend(projectRoot);
57
90
 
58
91
  // Start the server
59
92
  console.log('🚀 Starting MCPHub server...');
60
- import('../dist/index.js').catch(err => {
93
+ import(path.join(projectRoot, 'dist', 'index.js')).catch(err => {
61
94
  console.error('Failed to start MCPHub:', err);
62
95
  process.exit(1);
63
96
  });
package/dist/server.js CHANGED
@@ -14,6 +14,7 @@ const __filename = fileURLToPath(import.meta.url);
14
14
  const __dirname = path.dirname(__filename);
15
15
  export class AppServer {
16
16
  constructor() {
17
+ this.frontendPath = null;
17
18
  this.app = express();
18
19
  this.port = config.port;
19
20
  }
@@ -26,10 +27,8 @@ export class AppServer {
26
27
  initMiddlewares(this.app);
27
28
  initRoutes(this.app);
28
29
  console.log('Server initialized successfully');
29
- // Serve static frontend files
30
- const frontendDistPath = this.getFrontendDistPath();
31
- console.log(`Serving frontend from: ${frontendDistPath}`);
32
- this.app.use(express.static(frontendDistPath));
30
+ // Find and serve frontend
31
+ this.findAndServeFrontend();
33
32
  initMcpServer(config.mcpHubName, config.mcpHubVersion)
34
33
  .then(() => {
35
34
  console.log('MCP server initialized successfully');
@@ -42,20 +41,6 @@ export class AppServer {
42
41
  .catch((error) => {
43
42
  console.error('Error initializing MCP server:', error);
44
43
  throw error;
45
- })
46
- .finally(() => {
47
- // Make sure frontend index.html exists before setting this route
48
- if (fs.existsSync(path.join(this.getFrontendDistPath(), 'index.html'))) {
49
- this.app.get('*', (_req, res) => {
50
- res.sendFile(path.join(this.getFrontendDistPath(), 'index.html'));
51
- });
52
- }
53
- else {
54
- console.error('Frontend files not found. Please make sure the frontend is built correctly.');
55
- this.app.get('*', (_req, res) => {
56
- res.status(500).send('Frontend not found. Please run "npm run build" to build the project.');
57
- });
58
- }
59
44
  });
60
45
  }
61
46
  catch (error) {
@@ -63,37 +48,108 @@ export class AppServer {
63
48
  throw error;
64
49
  }
65
50
  }
51
+ findAndServeFrontend() {
52
+ // Find frontend path
53
+ this.frontendPath = this.findFrontendDistPath();
54
+ if (this.frontendPath) {
55
+ console.log(`Serving frontend from: ${this.frontendPath}`);
56
+ this.app.use(express.static(this.frontendPath));
57
+ // Add the wildcard route for SPA
58
+ if (fs.existsSync(path.join(this.frontendPath, 'index.html'))) {
59
+ this.app.get('*', (_req, res) => {
60
+ res.sendFile(path.join(this.frontendPath, 'index.html'));
61
+ });
62
+ }
63
+ }
64
+ else {
65
+ console.warn('Frontend dist directory not found. Server will run without frontend.');
66
+ this.app.get('/', (_req, res) => {
67
+ res.status(404).send('Frontend not found. MCPHub API is running, but the UI is not available.');
68
+ });
69
+ }
70
+ }
66
71
  start() {
67
72
  this.app.listen(this.port, () => {
68
73
  console.log(`Server is running on port ${this.port}`);
69
- console.log(`Open http://localhost:${this.port} in your browser to access MCPHub`);
74
+ if (this.frontendPath) {
75
+ console.log(`Open http://localhost:${this.port} in your browser to access MCPHub UI`);
76
+ }
77
+ else {
78
+ console.log(`MCPHub API is running on http://localhost:${this.port}, but the UI is not available`);
79
+ }
70
80
  });
71
81
  }
72
82
  getApp() {
73
83
  return this.app;
74
84
  }
75
85
  // Helper method to find frontend dist path in different environments
76
- getFrontendDistPath() {
77
- const possiblePaths = [
78
- // 1. When running as npm package (from node_modules)
79
- path.join(__dirname, '..', '..', 'frontend', 'dist'),
80
- path.join(__dirname, '..', '..', '..', 'frontend', 'dist'),
81
- // 2. When running in the package directory with node_modules/.bin/mcphub
82
- path.join(__dirname, '..', '..', '..', '..', 'frontend', 'dist'),
83
- // 3. When running in local development environment
84
- path.join(process.cwd(), 'frontend', 'dist'),
85
- // 4. When installed globally
86
- path.join(__dirname, '..', '..', '..', '..', '..', 'frontend', 'dist'),
87
- // 5. Check for npm package path resolution
88
- path.join(path.dirname(path.dirname(process.argv[1])), 'frontend', 'dist')
86
+ findFrontendDistPath() {
87
+ // Debug flag for detailed logging
88
+ const debug = process.env.DEBUG === 'true';
89
+ if (debug) {
90
+ console.log('DEBUG: Current directory:', process.cwd());
91
+ console.log('DEBUG: Script directory:', __dirname);
92
+ }
93
+ // First, find the package root directory
94
+ const packageRoot = this.findPackageRoot();
95
+ if (debug) {
96
+ console.log('DEBUG: Using package root:', packageRoot);
97
+ }
98
+ if (!packageRoot) {
99
+ console.warn('Could not determine package root directory');
100
+ return null;
101
+ }
102
+ // Check for frontend dist in the standard location
103
+ const frontendDistPath = path.join(packageRoot, 'frontend', 'dist');
104
+ if (debug) {
105
+ console.log(`DEBUG: Checking frontend at: ${frontendDistPath}`);
106
+ }
107
+ if (fs.existsSync(frontendDistPath) && fs.existsSync(path.join(frontendDistPath, 'index.html'))) {
108
+ return frontendDistPath;
109
+ }
110
+ console.warn('Frontend distribution not found at', frontendDistPath);
111
+ return null;
112
+ }
113
+ // Helper method to find the package root (where package.json is located)
114
+ findPackageRoot() {
115
+ const debug = process.env.DEBUG === 'true';
116
+ // Possible locations for package.json
117
+ const possibleRoots = [
118
+ // Standard npm package location
119
+ path.resolve(__dirname, '..', '..'),
120
+ // Current working directory
121
+ process.cwd(),
122
+ // When running from dist directory
123
+ path.resolve(__dirname, '..'),
124
+ // When installed via npx
125
+ path.resolve(__dirname, '..', '..', '..')
89
126
  ];
90
- for (const possiblePath of possiblePaths) {
91
- if (fs.existsSync(possiblePath) && fs.existsSync(path.join(possiblePath, 'index.html'))) {
92
- return possiblePath;
127
+ // Special handling for npx
128
+ if (process.argv[1] && process.argv[1].includes('_npx')) {
129
+ const npxDir = path.dirname(process.argv[1]);
130
+ possibleRoots.unshift(path.resolve(npxDir, '..'));
131
+ }
132
+ if (debug) {
133
+ console.log('DEBUG: Checking for package.json in:', possibleRoots);
134
+ }
135
+ for (const root of possibleRoots) {
136
+ const packageJsonPath = path.join(root, 'package.json');
137
+ if (fs.existsSync(packageJsonPath)) {
138
+ try {
139
+ const pkg = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
140
+ if (pkg.name === 'mcphub' || pkg.name === '@samanhappy/mcphub') {
141
+ if (debug) {
142
+ console.log(`DEBUG: Found package.json at ${packageJsonPath}`);
143
+ }
144
+ return root;
145
+ }
146
+ }
147
+ catch (e) {
148
+ // Continue to the next potential root
149
+ }
93
150
  }
94
151
  }
95
- console.warn('Could not find frontend dist folder in any of the expected locations');
96
- return path.join(process.cwd(), 'frontend', 'dist');
152
+ return null;
97
153
  }
98
154
  }
99
155
  export default AppServer;
@@ -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,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAEzD,gCAAgC;AAChC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAE3C,MAAM,OAAO,SAAS;IAIpB;QACE,IAAI,CAAC,GAAG,GAAG,OAAO,EAAE,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,UAAU;QACd,IAAI,CAAC;YACH,mEAAmE;YACnE,eAAe,EAAE,CAAC;YAElB,kDAAkD;YAClD,MAAM,qBAAqB,EAAE,CAAC;YAE9B,eAAe,CAAC,IAA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H,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED,eAAe,SAAS,CAAC"}
package/package.json CHANGED
@@ -1,17 +1,15 @@
1
1
  {
2
2
  "name": "@samanhappy/mcphub",
3
- "version": "0.0.18",
3
+ "version": "0.0.21",
4
4
  "description": "A hub server for mcp servers",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
7
7
  "bin": {
8
- "mcphub": "./bin/cli.js"
8
+ "mcphub": "bin/cli.js"
9
9
  },
10
10
  "files": [
11
11
  "dist",
12
12
  "bin",
13
- "mcp_settings.json",
14
- "servers.json",
15
13
  "frontend/dist",
16
14
  "README.md",
17
15
  "LICENSE"
@@ -28,7 +26,7 @@
28
26
  "frontend:build": "cd frontend && vite build",
29
27
  "frontend:preview": "cd frontend && vite preview",
30
28
  "dev": "concurrently \"npm run backend:dev\" \"npm run frontend:dev\"",
31
- "prepublishOnly": "npm run build"
29
+ "prepublishOnly": "npm run build && node scripts/verify-dist.js"
32
30
  },
33
31
  "keywords": [
34
32
  "typescript",
package/mcp_settings.json DELETED
@@ -1,45 +0,0 @@
1
- {
2
- "mcpServers": {
3
- "amap": {
4
- "command": "npx",
5
- "args": [
6
- "-y",
7
- "@amap/amap-maps-mcp-server"
8
- ],
9
- "env": {
10
- "AMAP_MAPS_API_KEY": "your-api-key"
11
- }
12
- },
13
- "playwright": {
14
- "command": "npx",
15
- "args": [
16
- "@playwright/mcp@latest",
17
- "--headless"
18
- ]
19
- },
20
- "fetch": {
21
- "command": "uvx",
22
- "args": [
23
- "mcp-server-fetch"
24
- ]
25
- },
26
- "slack": {
27
- "command": "npx",
28
- "args": [
29
- "-y",
30
- "@modelcontextprotocol/server-slack"
31
- ],
32
- "env": {
33
- "SLACK_BOT_TOKEN": "your-bot-token",
34
- "SLACK_TEAM_ID": "your-team-id"
35
- }
36
- }
37
- },
38
- "users": [
39
- {
40
- "username": "admin",
41
- "password": "$2b$10$Vt7krIvjNgyN67LXqly0uOcTpN0LI55cYRbcKC71pUDAP0nJ7RPa.",
42
- "isAdmin": true
43
- }
44
- ]
45
- }