Skip to content

Commit cd09c5e

Browse files
- Works locally.
1 parent 04aae8b commit cd09c5e

File tree

20 files changed

+504
-99
lines changed

20 files changed

+504
-99
lines changed

.vscode/launch.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,16 @@
380380
"true",
381381
"false"
382382
]
383+
},
384+
{
385+
"type": "pickString",
386+
"id": "mcpServerType",
387+
"description": "MCP server type",
388+
"default": "stdio",
389+
"options": [
390+
"http",
391+
"stdio"
392+
]
383393
}
384394
],
385395
"configurations": [
@@ -465,6 +475,19 @@
465475
"--dbInternal=${input:dbInternalString}",
466476
"--export.alias=${input:exportAliasString}",
467477
"--pgsrv.debug.enable=${input:serverDebugPublish}",
478+
"--mcp.server.type=${input:mcpServerType}",
479+
],
480+
},
481+
{
482+
"name": "run MCP client",
483+
"type": "go",
484+
"request": "launch",
485+
"envFile": "${workspaceFolder}/.vscode/.env",
486+
"mode": "debug",
487+
"program": "${workspaceFolder}/mcp_client/cmd",
488+
"args": [
489+
"exec",
490+
"--client-type=http",
468491
],
469492
},
470493
{

.vscode/mcp.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
"args": [
6161
"mcp",
6262
"--tls.allowInsecure",
63+
"--mcp.server.type=stdio",
6364
"--auth=${input:authString}",
6465
"--registry=${input:registryString}"
6566
]

cicd/python/build.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def build_stackql(verbose :bool) -> int:
1414
os.environ['BUILDMINORVERSION'] = os.environ.get('BUILDMINORVERSION', '1')
1515
os.environ['BUILDPATCHVERSION'] = os.environ.get('BUILDPATCHVERSION', '1')
1616
os.environ['CGO_ENABLED'] = os.environ.get('CGO_ENABLED', '1')
17-
return subprocess.call(
17+
rv = subprocess.call(
1818
f'go build {"-x -v" if verbose else ""} --tags "sqlite_stackql" -ldflags "-X github.com/stackql/stackql/internal/stackql/cmd.BuildMajorVersion={os.environ.get("BUILDMAJORVERSION")} '
1919
f'-X github.com/stackql/stackql/internal/stackql/cmd.BuildMinorVersion={os.environ.get("BUILDMINORVERSION")} '
2020
f'-X github.com/stackql/stackql/internal/stackql/cmd.BuildPatchVersion={os.environ.get("BUILDPATCHVERSION")} '
@@ -26,6 +26,14 @@ def build_stackql(verbose :bool) -> int:
2626
'-o build/ ./stackql',
2727
shell=True
2828
)
29+
if rv != 0:
30+
return rv
31+
return subprocess.call(
32+
'go build '
33+
f'{"-x -v" if verbose else ""} '
34+
'-o build/stackql_mcp_client ./mcp_client/cmd',
35+
shell=True
36+
)
2937

3038

3139
def unit_test_stackql(verbose :bool) -> int:
@@ -34,7 +42,7 @@ def unit_test_stackql(verbose :bool) -> int:
3442
shell=True
3543
)
3644

37-
def sanitise_val(val :any) -> str:
45+
def sanitise_val(val) -> str:
3846
if isinstance(val, bool):
3947
return str(val).lower()
4048
return str(val)

internal/stackql/cmd/exec.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright © 2019 stackql [email protected]
2+
Copyright © 2025 stackql [email protected]
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

internal/stackql/cmd/mcp.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright © 2019 stackql [email protected]
2+
Copyright © 2025 stackql [email protected]
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@ package cmd
1717

1818
import (
1919
"context"
20+
"encoding/json"
2021

2122
"github.com/spf13/cobra"
2223

@@ -26,6 +27,11 @@ import (
2627
"github.com/stackql/stackql/pkg/mcp_server"
2728
)
2829

30+
var (
31+
mcpServerType string // overwritten by flag
32+
mcpConfig string // overwritten by flag
33+
)
34+
2935
//nolint:gochecknoglobals // cobra pattern
3036
var mcpSrvCmd = &cobra.Command{
3137
Use: "mcp",
@@ -43,8 +49,11 @@ var mcpSrvCmd = &cobra.Command{
4349
handlerCtx, err := entryutil.BuildHandlerContext(runtimeCtx, nil, queryCache, inputBundle, false)
4450
iqlerror.PrintErrorAndExitOneIfError(err)
4551
iqlerror.PrintErrorAndExitOneIfNil(handlerCtx, "handler context is unexpectedly nil")
52+
var config mcp_server.Config
53+
json.Unmarshal([]byte(mcpConfig), &config) //nolint:errcheck // TODO: investigate
54+
config.Server.Transport = mcpServerType
4655
server, serverErr := mcp_server.NewExampleBackendServer(
47-
nil,
56+
&config,
4857
logging.GetLogger(),
4958
)
5059
// server, serverErr := mcp_server.NewExampleHTTPBackendServer(

internal/stackql/cmd/registry.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright © 2019 stackql [email protected]
2+
Copyright © 2025 stackql [email protected]
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

internal/stackql/cmd/root.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright © 2019 stackql [email protected]
2+
Copyright © 2025 stackql [email protected]
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
@@ -198,6 +198,9 @@ func init() {
198198
rootCmd.AddCommand(registryCmd)
199199
rootCmd.AddCommand(srvCmd)
200200
rootCmd.AddCommand(mcpSrvCmd)
201+
202+
mcpSrvCmd.PersistentFlags().StringVar(&mcpConfig, "mcp.config", "{}", "MCP server config file path (YAML or JSON)")
203+
mcpSrvCmd.PersistentFlags().StringVar(&mcpServerType, "mcp.server.type", "http", "MCP server type (http or stdio for now)")
201204
}
202205

203206
func mergeConfigFromFile(runtimeCtx *dto.RuntimeCtx, flagSet pflag.FlagSet) {

internal/stackql/cmd/shell.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright © 2019 stackql [email protected]
2+
Copyright © 2025 stackql [email protected]
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

internal/stackql/cmd/srv.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright © 2019 stackql [email protected]
2+
Copyright © 2025 stackql [email protected]
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.

mcp_client/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.stackql
2+
__debug_bin

0 commit comments

Comments
 (0)