Merge pull request #9954 from dolthub/ca/dolt-mcp

[no-release-notes] bump dolt-mcp, add dolt-mcp initialization log lines when configured
This commit is contained in:
Dustin Brown
2025-10-13 16:37:32 -07:00
committed by GitHub
3 changed files with 20 additions and 6 deletions

View File

@@ -16,6 +16,7 @@ package sqlserver
import (
"context"
"fmt"
"net"
"strconv"
@@ -55,8 +56,10 @@ func (c *logrusZapCore) With(fields []zapcore.Field) zapcore.Core {
}
func (c *logrusZapCore) Enabled(lvl zapcore.Level) bool {
// Respect logrus current level
return zapToLogrusLevel(lvl) >= c.l.GetLevel()
// Respect logrus current level: allow messages at or above the configured level.
// Note: logrus levels are ordered with lower numeric values being more severe.
// So we log when entryLevel <= loggerLevel (e.g., Info(4) should pass when logger is Debug(5)).
return zapToLogrusLevel(lvl) <= c.l.GetLevel()
}
func (c *logrusZapCore) Check(ent zapcore.Entry, ce *zapcore.CheckedEntry) *zapcore.CheckedEntry {
@@ -143,6 +146,12 @@ func mcpRun(cfg *Config, lgr *logrus.Logger, state *svcs.ServiceState, cancelPtr
DatabaseName: dbName,
}
// Announce MCP startup using a concise config string similar to the main server
// HP is the MCP HTTP bind host:port; SQL_HP is the SQL server host:port used by MCP.
mcpBindHost := "0.0.0.0"
confInfo := fmt.Sprintf("HP=\"%s:%d\"|SQL_HP=\"%s:%d\"|U=\"%s\"|DB=\"%s\"", mcpBindHost, *cfg.MCP.Port, dbConf.Host, dbConf.Port, *cfg.MCP.User, dbName)
lgr.Infof("Starting Dolt MCP server with Config %s", confInfo)
srv, err := pkgmcp.NewMCPHTTPServer(
logger,
dbConf,
@@ -157,7 +166,12 @@ func mcpRun(cfg *Config, lgr *logrus.Logger, state *svcs.ServiceState, cancelPtr
runCtx, cancel := context.WithCancel(ctx)
*cancelPtr = cancel
g, gctx := errgroup.WithContext(runCtx)
g.Go(func() error { srv.ListenAndServe(gctx); return nil })
g.Go(func() error {
// Log readiness from the parent logger so it appears in Dolt output
lgr.Infof("Dolt MCP server ready. Accepting connections.")
srv.ListenAndServe(gctx)
return nil
})
*groupPtr = g
}
}

View File

@@ -58,7 +58,7 @@ require (
github.com/cespare/xxhash/v2 v2.3.0
github.com/creasty/defaults v1.6.0
github.com/dolthub/aws-sdk-go-ini-parser v0.0.0-20250305001723-2821c37f6c12
github.com/dolthub/dolt-mcp v0.2.2-0.20250917171427-13e4520d1c36
github.com/dolthub/dolt-mcp v0.2.2
github.com/dolthub/eventsapi_schema v0.0.0-20250915094920-eadfd39051ca
github.com/dolthub/flatbuffers/v23 v23.3.3-dh.2
github.com/dolthub/go-mysql-server v0.20.1-0.20251010202444-31b74b212d80

View File

@@ -203,8 +203,8 @@ github.com/denisenkom/go-mssqldb v0.10.0 h1:QykgLZBorFE95+gO3u9esLd0BmbvpWp0/waN
github.com/denisenkom/go-mssqldb v0.10.0/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU=
github.com/dolthub/aws-sdk-go-ini-parser v0.0.0-20250305001723-2821c37f6c12 h1:IdqX7J8vi/Kn3T3Ee0VzqnLqwFmgA2hr8WZETPcQjfM=
github.com/dolthub/aws-sdk-go-ini-parser v0.0.0-20250305001723-2821c37f6c12/go.mod h1:rN7X8BHwkjPcfMQQ2QTAq/xM3leUSGLfb+1Js7Y6TVo=
github.com/dolthub/dolt-mcp v0.2.2-0.20250917171427-13e4520d1c36 h1:1OJhO12aBkZG7WQzAbu1WKCLSPT4AeoSEYeRwCirIi4=
github.com/dolthub/dolt-mcp v0.2.2-0.20250917171427-13e4520d1c36/go.mod h1:S8OtLV2B//aelmZlGnFO44q4YH+Tyfl7jQ9djb4gPJE=
github.com/dolthub/dolt-mcp v0.2.2 h1:bpROmam74n95uU4EA3BpOIVlTDT0pzeFMBwe/YRq2mI=
github.com/dolthub/dolt-mcp v0.2.2/go.mod h1:S++DJ4QWTAXq+0TNzFa7Oq3IhoT456DJHwAINFAHgDQ=
github.com/dolthub/eventsapi_schema v0.0.0-20250915094920-eadfd39051ca h1:BGFz/0OlKIuC6qHIZQbvPapFvdAJkeEyGXWVgL5clmE=
github.com/dolthub/eventsapi_schema v0.0.0-20250915094920-eadfd39051ca/go.mod h1:CoDLfgPqHyBtth0Cp+fi/CmC4R81zJNX4wPjShdZ+Bw=
github.com/dolthub/flatbuffers/v23 v23.3.3-dh.2 h1:u3PMzfF8RkKd3lB9pZ2bfn0qEG+1Gms9599cr0REMww=