mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-06-14 18:39:54 +08:00
- 新增 GoNavi MCP stdio server 与 Claude/Codex 用户级安装入口 - 增加安装状态检测、刷新复制能力和浏览器联调 mock - 外部 execute_sql 对齐 GoNavi safetyLevel 并补充前端/后端验证
30 lines
625 B
Go
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{})
|
|
}
|