Skip to content

Commit da5373c

Browse files
committed
Add Smithery support: smithery.yaml, PORT env var, Dockerfile update
- Add smithery.yaml for container-based HTTP publishing on Smithery - Support PORT environment variable as fallback in config defaults - Update Dockerfile to use PORT instead of SENTINEL_GATE_SERVER_HTTP_ADDR
1 parent e053036 commit da5373c

3 files changed

Lines changed: 21 additions & 2 deletions

File tree

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ COPY --from=perms /data /data
6060
VOLUME ["/data"]
6161
ENV SENTINEL_GATE_STATE_PATH=/data/state.json
6262
# Bind to all interfaces inside container (default is localhost-only for security).
63-
ENV SENTINEL_GATE_SERVER_HTTP_ADDR=":8080"
63+
# Cloud platforms (Smithery, Cloud Run) override PORT at runtime.
64+
ENV PORT=8080
6465

6566
# Run as non-root user
6667
USER nonroot:nonroot

internal/config/config.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
// For Pro features, see the sentinel-gate-pro module.
2020
package config
2121

22+
import "os"
2223

2324
// OSSConfig is the top-level configuration for Sentinel Gate OSS.
2425
// It contains only the essential fields for a minimalist MCP proxy.
@@ -278,8 +279,13 @@ type AuditFileConfig struct {
278279
func (c *OSSConfig) SetDefaults() {
279280
// Server defaults — bind to localhost only for security.
280281
// Users who need network access must explicitly set http_addr: ":8080" or "0.0.0.0:8080".
282+
// Cloud platforms (Smithery, Cloud Run, etc.) set PORT to indicate the listening port.
281283
if c.Server.HTTPAddr == "" {
282-
c.Server.HTTPAddr = "127.0.0.1:8080"
284+
if port := os.Getenv("PORT"); port != "" {
285+
c.Server.HTTPAddr = ":" + port
286+
} else {
287+
c.Server.HTTPAddr = "127.0.0.1:8080"
288+
}
283289
}
284290
if c.Server.LogLevel == "" {
285291
c.Server.LogLevel = "info"

smithery.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Smithery configuration for SentinelGate
2+
# https://smithery.ai/docs/build/project-config/smithery-yaml
3+
runtime: "container"
4+
build:
5+
dockerfile: "Dockerfile"
6+
dockerBuildPath: "."
7+
startCommand:
8+
type: "http"
9+
configSchema:
10+
type: "object"
11+
properties: {}
12+
required: []

0 commit comments

Comments
 (0)