All checks were successful
Release / release (push) Successful in 29s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
39 lines
1.1 KiB
Go
39 lines
1.1 KiB
Go
package app
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/mark3labs/mcp-go/server"
|
|
|
|
"forge.lclr.dev/AI/mcp-framework/bootstrap"
|
|
"forge.lclr.dev/AI/xdebug-mcp/internal/cache"
|
|
"forge.lclr.dev/AI/xdebug-mcp/internal/tools"
|
|
"forge.lclr.dev/AI/xdebug-mcp/mcpgen"
|
|
)
|
|
|
|
func Run(ctx context.Context, args []string, version string) error {
|
|
c := cache.New(cache.DefaultCapacity)
|
|
|
|
return bootstrap.Run(ctx, bootstrap.Options{
|
|
BinaryName: mcpgen.BinaryName,
|
|
Description: mcpgen.DefaultDescription,
|
|
Version: version,
|
|
Args: args,
|
|
Hooks: bootstrap.Hooks{
|
|
MCP: func(ctx context.Context, inv bootstrap.Invocation) error {
|
|
return runMCP(c, version)
|
|
},
|
|
Update: func(ctx context.Context, inv bootstrap.Invocation) error {
|
|
return mcpgen.RunUpdate(ctx, inv.Args, version, inv.Stdout)
|
|
},
|
|
},
|
|
})
|
|
}
|
|
|
|
func runMCP(c *cache.Cache, version string) error {
|
|
s := server.NewMCPServer(mcpgen.BinaryName, version)
|
|
s.AddTool(tools.AnalyzeTool(), tools.AnalyzeHandler(c))
|
|
s.AddTool(tools.CallersTool(), tools.CallersHandler(c))
|
|
s.AddTool(tools.CalleesTool(), tools.CalleesHandler(c))
|
|
return server.ServeStdio(s)
|
|
}
|