You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit introduces several significant updates:
1. **Streamable HTTP Transport:**
* The proxy server now supports connecting to backend MCP servers удовольствие Streamable HTTP transport (`type: "http"` in `mcp_server.json`).
* A new `/mcp` endpoint has been added to the proxy server itself to expose aggregated services via Streamable HTTP.
2. **Configuration Changes (IMPORTANT):**
* **`mcp_server.json` now requires a `type` field** for each server configuration (`"stdio"`, `"sse"`, or `"http"`). Users upgrading MUST update their `mcp_server.json` to include this field for existing server entries.
* Environment variables for client authentication to the proxy's HTTP endpoints have been renamed:
* `MCP_PROXY_SSE_ALLOWED_KEYS` is now `ALLOWED_KEYS`
* `MCP_PROXY_SSE_ALLOWED_TOKENS` is now `ALLOWED_TOKENS`
* Users MUST update their environment variables if they were using the old names.
3. **Admin Web UI Enhancements:**
* The UI now supports configuring all three server types (Stdio, SSE, HTTP).
* "Add HTTP Server" button functionality is integrated.
* The "Parse From Config" feature will default `type` to "sse" if a URL is present and `type` is missing, for smoother transitions.
4. **Logging and Startup Improvements:**
* `SESSION_SECRET` handling is more robust: if not set or default, a new secret is generated and saved to `config/.session_secret` with a notification, rather than just a warning.
* Startup logs now clearly display the `/sse` and `/mcp` endpoint URLs, along with guidance on using API keys if configured.
**Action Required by Users:**
* **Update `mcp_server.json`**: Add the `type` field (`"stdio"`, `"sse"`, or `"http"`) to all existing server entries.
* **Update Environment Variables**: Rename `MCP_PROXY_SSE_ALLOWED_KEYS` to `ALLOWED_KEYS` and `MCP_PROXY_SSE_ALLOWED_TOKENS` to `ALLOWED_TOKENS` in your environment setup.
* It is recommended to review and potentially reset/recreate `config/mcp_server.json` and `config/tool_config.json` if upgrading from a much older version to ensure compatibility with the new structures and UI functionalities.
Copy file name to clipboardExpand all lines: README.md
+51-20Lines changed: 51 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,8 +14,8 @@
14
14
15
15
This server acts as a central hub for Model Context Protocol (MCP) resource servers. It can:
16
16
17
-
- Connect to and manage multiple backend MCP servers (both Stdioand SSE types).
18
-
- Expose their combined capabilities (tools, resources) through a single, unified SSE interface **or** act as a single Stdio-based MCP server itself.
17
+
- Connect to and manage multiple backend MCP servers (Stdio, SSE, and Streamable HTTP types).
18
+
- Expose their combined capabilities (tools, resources) through a single, unified SSE interface, a Streamable HTTP interface,**or** act as a single Stdio-based MCP server itself.
19
19
- Handle routing of requests to the appropriate backend servers.
20
20
- Aggregate responses if needed (though primarily acts as a proxy).
21
21
- Support multiple simultaneous SSE client connections with optional API key authentication.
@@ -30,7 +30,7 @@ This server acts as a central hub for Model Context Protocol (MCP) resource serv
30
30
31
31
### ✨ Optional Web Admin UI (`ENABLE_ADMIN_UI=true`)
32
32
Provides a browser-based interface for managing the proxy server configuration and connected tools. Features include:
33
-
-**Server Configuration**: View, add, edit, and delete server entries (`mcp_server.json`). Supports both Stdioand SSE server types with relevant options (command, args, env, url, apiKey, bearerToken, install config).
33
+
-**Server Configuration**: View, add, edit, and delete server entries (`mcp_server.json`). Supports Stdio, SSE, and HTTP server types with relevant options (type, command, args, env, url, apiKey, bearerToken, install config).
34
34
-**Tool Configuration**: View all tools discovered from active backend servers. Enable or disable specific tools. Override the display name and description for each tool (`tool_config.json`).
35
35
-**Live Reload**: Apply server and tool configuration changes by triggering a configuration reload without needing to restart the entire proxy server process.
36
36
-**Stdio Server Installation**: For Stdio servers, you can define installation commands in the configuration. The Admin UI allows you to:
@@ -51,6 +51,7 @@ Example `config/mcp_server.json`:
51
51
{
52
52
"mcpServers": {
53
53
"unique-server-key1": {
54
+
"type": "stdio",
54
55
"name": "My Stdio Server",
55
56
"active": true,
56
57
"command": "/path/to/server/executable",
@@ -65,12 +66,21 @@ Example `config/mcp_server.json`:
@@ -84,13 +94,14 @@ Example `config/mcp_server.json`:
84
94
-`mcpServers`: (Required) An object where each key is a unique identifier for a backend server.
85
95
-`name`: (Optional) A user-friendly display name for the server (used in Admin UI).
86
96
-`active`: (Optional, default: `true`) Set to `false` to prevent the proxy from connecting to this server.
87
-
-`command`: (Required for Stdio type) The command to execute the server process.
88
-
-`args`: (Optional for Stdio type) An array of string arguments to pass to the command.
89
-
-`env`: (Optional for Stdio type) An object of environment variables (`KEY: "value"`) to set for the server process. These are merged with the proxy server's environment.
90
-
-`url`: (Required for SSE type) The full URL of the backend server's SSE endpoint.
91
-
-`apiKey`: (Optional for SSE type) An API key to send in the `X-Api-Key` header when the proxy connects to *this specific backend* SSE server.
92
-
-`bearerToken`: (Optional for SSE type) A token to send in the `Authorization: Bearer <token>` header when connecting to *this specific backend* SSE server. (If both `apiKey` and `bearerToken` are provided, `bearerToken` takes precedence).
93
-
-`installDirectory`: (Optional for Stdio type) The absolute path where the server *itself* should be installed (e.g., `/opt/my-server-files`). Used by the Admin UI's installation feature.
97
+
-`type`: (Required) Specifies the transport type. Must be one of `"stdio"`, `"sse"`, or `"http"`.
98
+
-`command`: (Required if `type` is "stdio") The command to execute the server process.
99
+
-`args`: (Optional if `type` is "stdio") An array of string arguments to pass to the command.
100
+
-`env`: (Optional if `type` is "stdio") An object of environment variables (`KEY: "value"`) to set for the server process. These are merged with the proxy server's environment.
101
+
-`url`: (Required if `type` is "sse" or "http") The full URL of the backend server's endpoint (e.g., SSE endpoint for "sse", MCP endpoint for "http").
102
+
-`apiKey`: (Optional if `type` is "sse" or "http") An API key to send in the `X-Api-Key` header when the proxy connects to *this specific backend* server.
103
+
-`bearerToken`: (Optional if `type` is "sse" or "http") A token to send in the `Authorization: Bearer <token>` header when connecting to *this specific backend* server. (If both `apiKey` and `bearerToken` are provided, `bearerToken` generally takes precedence for that specific backend connection).
104
+
-`installDirectory`: (Optional if `type` is "stdio") The absolute path where the server *itself* should be installed (e.g., `/opt/my-server-files`). Used by the Admin UI's installation feature.
94
105
- If provided in `mcp_server.json`, this exact path is used.
95
106
- If omitted, the effective directory depends on the `TOOLS_FOLDER` environment variable (see Environment Variables section).
96
107
- If `TOOLS_FOLDER` is set and not empty, the server will be installed in a subdirectory named after the server key within this folder (e.g., `${TOOLS_FOLDER}/<server_key>`).
@@ -123,15 +134,15 @@ Example `config/tool_config.json`:
123
134
124
135
### 3. Environment Variables
125
136
126
-
-**`PORT`**: Port for the proxy server's main SSE endpoint (and Admin UI if enabled). Default: `3663`. **Note:** This is only used when running in SSE mode (e.g., via `npm run dev:sse` or the Docker container). The `npm run dev` script runs in Stdio mode.
137
+
-**`PORT`**: Port for the proxy server's HTTP-based endpoints (`/sse`, `/mcp`, and Admin UI if enabled). Default: `3663`. **Note:** This is only used when running in a mode that starts an HTTP server (e.g., via `npm run dev:sse` or the Docker container). The `npm run dev` script runs in Stdio mode.
127
138
```bash
128
139
export PORT=8080
129
140
```
130
-
- **`MCP_PROXY_SSE_ALLOWED_KEYS`**: (Optional) Comma-separated list of API keys to secure the proxy's main `/sse` endpoint (only applicable in SSE mode). If neither `MCP_PROXY_SSE_ALLOWED_KEYS` nor `MCP_PROXY_SSE_ALLOWED_TOKENS` are set, authentication is disabled. Clients must provide a key via `X-Api-Key` header or `?key=` query parameter.
141
+
- **`ALLOWED_KEYS`**: (Optional) Comma-separated list of API keys to secure the proxy's HTTP-based endpoints (`/sse`, `/mcp`). If neither `ALLOWED_KEYS` nor `ALLOWED_TOKENS` are set, authentication is disabled for these endpoints. Clients must provide a key via `X-Api-Key` header or `?key=` query parameter.
- **`MCP_PROXY_SSE_ALLOWED_TOKENS`**: (Optional) Comma-separated list of Bearer Tokens to secure the proxy's main `/sse` endpoint (only applicable in SSE mode). If neither `MCP_PROXY_SSE_ALLOWED_KEYS` nor `MCP_PROXY_SSE_ALLOWED_TOKENS` are set, authentication is disabled. Clients must provide a token via the `Authorization: Bearer <token>` header. If both `MCP_PROXY_SSE_ALLOWED_KEYS` and `MCP_PROXY_SSE_ALLOWED_TOKENS` are configured, Bearer Token authentication will be attempted first.
145
+
- **`ALLOWED_TOKENS`**: (Optional) Comma-separated list of Bearer Tokens to secure the proxy's HTTP-based endpoints (`/sse`, `/mcp`). If neither `ALLOWED_KEYS` nor `ALLOWED_TOKENS` are set, authentication is disabled. Clients must provide a token via the `Authorization: Bearer <token>` header. If both `ALLOWED_KEYS` and `ALLOWED_TOKENS` are configured, Bearer Token authentication will be attempted first.
-e TOOLS_FOLDER=/my/custom_tools_volume # Optional: Override default /tools for server installations
248
259
-v ./my_config:/mcp-proxy-server/config \
249
260
-v /path/on/host/to/tools:/my/custom_tools_volume `# Mount a volume for TOOLS_FOLDER if overridden` \
@@ -285,18 +296,23 @@ This proxy server can be used in two main ways:
285
296
```
286
297
- Replace `/path/to/mcp-proxy-server/build/index.js` with the actual path to the built entry point of this proxy server project. Ensure the `config` directory is correctly located relative to where the command is run, or use absolute paths in the proxy's own config if needed.
287
298
288
-
**2. As an SSE MCP Server:**
289
-
Run the proxy server in SSE mode (e.g., `npm run dev:sse` or the Docker container). Then, configure your MCP client to connect to the proxy's SSE endpoint (e.g., `http://localhost:3663/sse`). If authentication is enabled on the proxy (via `MCP_PROXY_SSE_ALLOWED_KEYS` or `MCP_PROXY_SSE_ALLOWED_TOKENS`), the client needs to provide the corresponding credentials.
299
+
**2. As an SSE or Streamable HTTP MCP Server:**
300
+
Run the proxy server in a mode that starts its HTTP server (e.g., `npm run dev:sse` or the Docker container). Then, configure your MCP client to connect to the proxy's appropriate endpoint:
301
+
- For SSE: `http://localhost:3663/sse`
302
+
- For Streamable HTTP: `http://localhost:3663/mcp`
303
+
304
+
If authentication is enabled on the proxy (via `ALLOWED_KEYS` or `ALLOWED_TOKENS`), the client needs to provide the corresponding credentials.
290
305
291
-
**Authentication Methods:**
292
-
* **API Key:** Provide the key in the client configuration. For broader compatibility, providing it via the URL query parameter `?key=...` is recommended. Some clients might also support providing it in the `X-Api-Key` header.
306
+
**Authentication Methods (for `/sse` and `/mcp`):**
307
+
* **API Key:** Provide the key in the client configuration. For the `/sse` endpoint, the URL query parameter `?key=...` is supported. For both `/sse` and `/mcp`, the `X-Api-Key` header is supported.
293
308
* **Bearer Token:** Set the `Authorization: Bearer <token>` header in the client configuration.
294
309
295
-
Example for Claude Desktop (`claude_desktop_config.json`):
310
+
Example for Claude Desktop (`claude_desktop_config.json`) connecting to SSE:
296
311
```json
297
312
{
298
313
"mcpServers": {
299
314
"my-proxy-sse": {
315
+
"type": "sse", // Important for clients that distinguish
300
316
"name": "MCP Proxy (SSE)",
301
317
// If using API Key authentication, append ?key=<your_key>
302
318
"url": "http://localhost:3663/sse?key=clientkey1"
@@ -310,6 +326,21 @@ This proxy server can be used in two main ways:
310
326
}
311
327
```
312
328
329
+
Example for a generic Streamable HTTP client configuration:
330
+
```json
331
+
{
332
+
"mcpServers": {
333
+
"my-proxy-http": {
334
+
"type": "http", // Or the client's specific designation
335
+
"name": "MCP Proxy (Streamable HTTP)",
336
+
"url": "http://localhost:3663/mcp",
337
+
// Authentication headers would be configured according to the client's capabilities
0 commit comments