Skip to content

Commit 0ac99d3

Browse files
committed
refactor: Update routing prefixes from '/mcp' to '/gateway' across configuration and code files
1 parent e195305 commit 0ac99d3

13 files changed

Lines changed: 31 additions & 26 deletions

File tree

configs/proxy-mcp-exp.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ tenant: "default"
33

44
routers:
55
- server: "amap-maps"
6-
prefix: "/mcp/stdio-proxy"
6+
prefix: "/gateway/stdio-proxy"
77
cors:
88
allowOrigins:
99
- "*"
@@ -15,13 +15,13 @@ routers:
1515
- "Content-Type"
1616
- "Authorization"
1717
- "Mcp-Session-Id"
18-
- "mcp-protocol-version"
18+
- "mcp-protocol-version"
1919
exposeHeaders:
2020
- "Mcp-Session-Id"
2121
- "mcp-protocol-version"
2222
allowCredentials: true
2323
- server: "mock-user-sse"
24-
prefix: "/mcp/sse-proxy"
24+
prefix: "/gateway/sse-proxy"
2525
cors:
2626
allowOrigins:
2727
- "*"
@@ -39,7 +39,7 @@ routers:
3939
- "mcp-protocol-version"
4040
allowCredentials: true
4141
- server: "mock-user-mcp"
42-
prefix: "/mcp/streamable-http-proxy"
42+
prefix: "/gateway/streamable-http-proxy"
4343
cors:
4444
allowOrigins:
4545
- "*"

configs/proxy-mock-server.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ tenant: "default"
33

44
routers:
55
- server: "mock-server"
6-
prefix: "/mcp/user"
6+
prefix: "/gateway/user"
77
cors:
88
allowOrigins:
99
- "*"

deploy/docker/allinone/nginx.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ http {
5050
proxy_set_header X-Forwarded-Proto $scheme;
5151
}
5252

53-
location /mcp/ {
53+
location /gateway/ {
5454
proxy_pass http://mcp-gateway/;
5555
proxy_set_header Host $host;
5656
proxy_set_header X-Real-IP $remote_addr;

deploy/docker/multi/nginx.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ http {
5050
proxy_set_header X-Forwarded-Proto $scheme;
5151
}
5252

53-
location /mcp/ {
53+
location /gateway/ {
5454
proxy_pass http://mcp-gateway;
5555
proxy_set_header Host $host;
5656
proxy_set_header X-Real-IP $remote_addr;

deploy/helm/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ config:
217217

218218
VITE_API_BASE_URL: "/api"
219219
VITE_WS_BASE_URL: "/ws"
220-
VITE_MCP_GATEWAY_BASE_URL: "/mcp"
220+
VITE_MCP_GATEWAY_BASE_URL: "/gateway"
221221
VITE_BASE_URL: "/"
222222
APISERVER_JWT_SECRET_KEY: ""
223223
APISERVER_JWT_DURATION: "24h"

deploy/k8s/multi/ingress/ingress.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ spec:
88
- host: localhost
99
http:
1010
paths:
11-
- path: /mcp
11+
- path: /gateway
1212
pathType: Prefix
1313
backend:
1414
service:

deploy/k8s/multi/referernce/proxy-mock-server.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ tenant: "default"
33

44
routers:
55
- server: "mock-server"
6-
prefix: "/mcp/user"
6+
prefix: "/gateway/user"
77
cors:
88
allowOrigins:
99
- "*"

deploy/k8s/multi/traefik/traefik.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ spec:
77
entryPoints:
88
- web
99
routes:
10-
- match: Host(`localhost`) && PathPrefix(`/mcp`)
10+
- match: Host(`localhost`) && PathPrefix(`/gateway`)
1111
kind: Rule
1212
services:
1313
- name: mcp-gateway

internal/apiserver/database/util.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func InitDefaultTenant(db *gorm.DB) error {
2626
// Create default tenant
2727
defaultTenant := &Tenant{
2828
Name: "default",
29-
Prefix: "/mcp",
29+
Prefix: "/gateway",
3030
Description: "Default tenant for MCP Gateway",
3131
IsActive: true,
3232
CreatedAt: time.Now(),

internal/core/state/state.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package state
33
import (
44
"context"
55
"fmt"
6+
"time"
67

78
"github.com/ifuryst/lol"
89
"github.com/amoylab/unla/internal/common/cnst"
@@ -244,7 +245,11 @@ func startMCPServer(ctx context.Context, logger *zap.Logger, prefix string, mcpS
244245
return
245246
}
246247

247-
if err := transport.Start(ctx, template.NewContext()); err != nil {
248+
// Create a new context to avoid being canceled when the main context is canceled during shutdown
249+
startCtx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
250+
defer cancel()
251+
252+
if err := transport.Start(startCtx, template.NewContext()); err != nil {
248253
logger.Error("failed to start server for preinstall",
249254
zap.String("prefix", prefix),
250255
zap.String("command", mcpServer.Command),
@@ -258,7 +263,7 @@ func startMCPServer(ctx context.Context, logger *zap.Logger, prefix string, mcpS
258263

259264
if needStop {
260265
// Stop the server after successful start
261-
if err := transport.Stop(ctx); err != nil {
266+
if err := transport.Stop(startCtx); err != nil {
262267
logger.Error("failed to stop server for preinstall",
263268
zap.String("prefix", prefix),
264269
zap.String("command", mcpServer.Command),

0 commit comments

Comments
 (0)