@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.
Files changed (3) hide show
  1. package/README.md +8 -2
  2. package/package.json +1 -1
  3. 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
- ### `config/mcp-servers.json`
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
- À créer dans le **répertoire courant** depuis lequel tu lances le gateway (pas dans le package lui-même). Un fichier `config/mcp-servers.example.json` est disponible comme point de départ.
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imenam/mcp-http-gateway",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "type": "module",
5
5
  "description": "HTTP gateway that exposes MCP servers as REST routes — bridge between MCP and any HTTP-capable agent",
6
6
  "main": "server.js",
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
- // GATEWAY_CONFIG overrides the default path (config/mcp-servers.json in cwd).
75
- const configPath = process.env.GATEWAY_CONFIG
76
- ? path.resolve(process.env.GATEWAY_CONFIG)
77
- : path.join(process.cwd(), 'config', 'mcp-servers.json');
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