修复 Docker 构建 + 端口可配置

- Dockerfile 设置 GOPROXY=https://goproxy.cn,direct 解决国内网络问题
- 新增 addr 配置项,支持自定义端口,默认 :8080
- docker-compose 端口改为 ${OPS_MCP_PORT:-9090}
- 移除 EXPOSE 指令(端口通过 compose 管理)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
yangzhaohan
2026-07-06 10:47:31 +08:00
parent 093511bbdd
commit 843024d7da
6 changed files with 13 additions and 8 deletions
+3 -3
View File
@@ -16,7 +16,7 @@ import (
const version = "0.1.0"
// Run 启动 MCP Server。
func Run(transport string, tools ...tool.Tool) error {
func Run(transport, addr string, tools ...tool.Tool) error {
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
@@ -60,8 +60,8 @@ func Run(transport string, tools ...tool.Tool) error {
slog.Info("starting MCP server", "transport", "stdio")
return server.ServeStdio(mcpServer)
case "sse":
slog.Info("starting MCP server", "transport", "sse", "addr", ":8080")
return server.NewSSEServer(mcpServer).Start(":8080")
slog.Info("starting MCP server", "transport", "sse", "addr", addr)
return server.NewSSEServer(mcpServer).Start(addr)
default:
return fmt.Errorf("unknown transport: %s", transport)
}