Files
MyGoNavi/internal/mcpserver/run.go
Syngnat 5b843ee25b feat(ai-mcp): 完善外部客户端安装链路并收紧 SQL 安全控制
- 新增 GoNavi MCP stdio server 与 Claude/Codex 用户级安装入口

- 增加安装状态检测、刷新复制能力和浏览器联调 mock

- 外部 execute_sql 对齐 GoNavi safetyLevel 并补充前端/后端验证
2026-06-07 20:27:50 +08:00

30 lines
625 B
Go

package mcpserver
import (
"context"
"github.com/modelcontextprotocol/go-sdk/mcp"
)
// RunAppStdioServer 启动基于真实 GoNavi App 的 stdio MCP server。
func RunAppStdioServer(ctx context.Context) error {
if ctx == nil {
ctx = context.Background()
}
backend := NewAppBackend(ctx)
defer backend.Close(ctx)
return RunStdioServer(ctx, backend)
}
// RunStdioServer 使用指定 backend 启动 stdio MCP server。
func RunStdioServer(ctx context.Context, backend Backend) error {
if ctx == nil {
ctx = context.Background()
}
server := NewServer(backend)
return server.Run(ctx, &mcp.StdioTransport{})
}