@imenam/mcp-http-gateway 2.0.0 → 2.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.
- package/README.md +8 -2
- package/package.json +1 -1
- package/server.js +6 -4
package/README.md
CHANGED
|
@@ -45,11 +45,17 @@ npm install @imenam/mcp-http-gateway
|
|
|
45
45
|
|
|
46
46
|
```env
|
|
47
47
|
GATEWAY_PORT=3500
|
|
48
|
+
GATEWAY_CONFIG_DIR=./config
|
|
48
49
|
```
|
|
49
50
|
|
|
50
|
-
|
|
51
|
+
| Variable | Défaut | Description |
|
|
52
|
+
|---|---|---|
|
|
53
|
+
| `GATEWAY_PORT` | `3500` | Port HTTP du gateway |
|
|
54
|
+
| `GATEWAY_CONFIG_DIR` | `./config` (relatif au cwd) | Dossier contenant `mcp-servers.json` |
|
|
51
55
|
|
|
52
|
-
|
|
56
|
+
### `mcp-servers.json`
|
|
57
|
+
|
|
58
|
+
À créer dans le dossier de configuration (`./config` par défaut, ou le chemin pointé par `GATEWAY_CONFIG_DIR`). Un fichier `config/mcp-servers.example.json` est fourni comme point de départ.
|
|
53
59
|
|
|
54
60
|
Même format que la configuration `mcpServers` de Cursor. Ajouter `MCP_SERVER_ROUTE` dans `env` pour définir la route HTTP du MCP, et `description` pour la documentation.
|
|
55
61
|
|
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -71,10 +71,12 @@ function registerMcpRoutes(app, route, client, name) {
|
|
|
71
71
|
async function main() {
|
|
72
72
|
const GATEWAY_PORT = parseInt(process.env.GATEWAY_PORT ?? '3500', 10);
|
|
73
73
|
|
|
74
|
-
//
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
74
|
+
// GATEWAY_CONFIG_DIR overrides the directory in which mcp-servers.json is looked up
|
|
75
|
+
// (defaults to ./config relative to cwd).
|
|
76
|
+
const configDir = process.env.GATEWAY_CONFIG_DIR
|
|
77
|
+
? path.resolve(process.env.GATEWAY_CONFIG_DIR)
|
|
78
|
+
: path.join(process.cwd(), 'config');
|
|
79
|
+
const configPath = path.join(configDir, 'mcp-servers.json');
|
|
78
80
|
const config = JSON.parse(readFileSync(configPath, 'utf-8'));
|
|
79
81
|
const servers = config.mcpServers ?? {};
|
|
80
82
|
|