Skip to content

Commit ec95b40

Browse files
committed
feat: add UserAgent
1 parent 87f78f3 commit ec95b40

File tree

6 files changed

+35
-24
lines changed

6 files changed

+35
-24
lines changed

.goreleaser.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
version: 2
22

3-
project_name: mcp_scaleway_functions
3+
project_name: mcp-scaleway-functions
44

55
before:
66
hooks:
@@ -9,9 +9,9 @@ before:
99
builds:
1010
- env:
1111
- CGO_ENABLED=0
12-
main: ./cmd/mcp_scaleway_functions
12+
main: ./cmd/mcp-scaleway-functions
1313
ldflags:
14-
- -s -w -X main.Version={{.Version}}
14+
- -s -w -X {{ .ModulePath }}/internal/constants.Version={{ .Version }}
1515
goos:
1616
- linux
1717
- windows

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ This is an unofficial implementation of a Model Context Protocol (MCP) server to
1010
1111
## Getting Started
1212

13-
Download the latest release from the [releases page](https://github.com/cyclimse/mcp_scaleway_functions/releases) or build it from source using Go.
13+
Download the latest release from the [releases page](https://github.com/cyclimse/mcp-scaleway-functions/releases) or build it from source using Go.
1414

1515
Run the MCP server:
1616

1717
```bash
18-
./mcp_scaleway_functions
18+
./mcp-scaleway-functions
1919
```
2020

2121
By default, the MCP server runs with the SSE transport on `http://localhost:8080`, but you can also change it to use Standard I/O (stdio) transport via the `--transport stdio` flag.
@@ -26,7 +26,7 @@ Then, configure your IDE to use the MCP server. Here's an example with VSCode an
2626
// In .vscode/mcp.json
2727
{
2828
"servers": {
29-
"mcp_scaleway_functions": {
29+
"mcp-scaleway-functions": {
3030
"url": "http://localhost:8080",
3131
"type": "http",
3232
}
@@ -43,7 +43,7 @@ You can use the standard [Scaleway environment variables](https://www.scaleway.c
4343
For instance, you can set a region to work in via the `SCW_DEFAULT_REGION` environment variable.
4444

4545
```bash
46-
SCW_DEFAULT_REGION=nl-ams ./mcp_scaleway_functions
46+
SCW_DEFAULT_REGION=nl-ams ./mcp-scaleway-functions
4747
```
4848

4949
## Available Tools
Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,6 @@ import (
2121
"github.com/scaleway/scaleway-sdk-go/scw"
2222
)
2323

24-
// Version is the current version of the server. It is set at build time.
25-
//
26-
//nolint:gochecknoglobals
27-
var Version = "dev"
28-
2924
type cliContext struct {
3025
Logger *slog.Logger
3126
}
@@ -54,7 +49,10 @@ func (cmd *serveCmd) Run(cliCtx *cliContext) error {
5449
return fmt.Errorf("loading Scaleway profile: %w", err)
5550
}
5651

57-
scwClient, err := scw.NewClient(scw.WithProfile(p))
52+
scwClient, err := scw.NewClient(
53+
scw.WithProfile(p),
54+
scw.WithUserAgent(constants.UserAgent),
55+
)
5856
if err != nil {
5957
return fmt.Errorf("creating Scaleway client: %w", err)
6058
}
@@ -65,9 +63,9 @@ func (cmd *serveCmd) Run(cliCtx *cliContext) error {
6563

6664
tools := scaleway.NewTools(scwClient)
6765
server := mcp.NewServer(&mcp.Implementation{
68-
Name: "mcp_scaleway_functions",
66+
Name: constants.ProjectName,
6967
Title: "MCP Scaleway Serverless Functions",
70-
Version: Version,
68+
Version: constants.Version,
7169
}, nil)
7270

7371
tools.Register(server)
@@ -147,7 +145,10 @@ func main() {
147145

148146
ctx := kong.Parse(&cli)
149147

150-
logger := slog.New(tint.NewHandler(w, nil))
148+
logger := slog.New(tint.NewHandler(w, nil)).With(
149+
slog.String("component", "main"),
150+
slog.String("version", constants.Version),
151+
)
151152
slog.SetDefault(slog.New(
152153
tint.NewHandler(w, &tint.Options{
153154
Level: cli.LogLevel,

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ go 1.25.0
55
require (
66
github.com/alecthomas/kong v1.12.1
77
github.com/lmittmann/tint v1.1.2
8-
github.com/modelcontextprotocol/go-sdk v0.6.0
8+
github.com/modelcontextprotocol/go-sdk v0.7.0
99
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.35
1010
github.com/stretchr/testify v1.10.0
1111
)
@@ -19,7 +19,7 @@ require (
1919
github.com/fatih/structs v1.1.0 // indirect
2020
github.com/fsnotify/fsnotify v1.9.0 // indirect
2121
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
22-
github.com/google/jsonschema-go v0.2.3 // indirect
22+
github.com/google/jsonschema-go v0.3.0 // indirect
2323
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
2424
github.com/huandu/xstrings v1.5.0 // indirect
2525
github.com/inconshreveable/mousetrap v1.1.0 // indirect

go.sum

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ github.com/go-viper/mapstructure/v2 v2.4.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlnd
2626
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
2727
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
2828
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
29-
github.com/google/jsonschema-go v0.2.3 h1:dkP3B96OtZKKFvdrUSaDkL+YDx8Uw9uC4Y+eukpCnmM=
30-
github.com/google/jsonschema-go v0.2.3/go.mod h1:r5quNTdLOYEz95Ru18zA0ydNbBuYoo9tgaYcxEYhJVE=
29+
github.com/google/jsonschema-go v0.3.0 h1:6AH2TxVNtk3IlvkkhjrtbUc4S8AvO0Xii0DxIygDg+Q=
30+
github.com/google/jsonschema-go v0.3.0/go.mod h1:r5quNTdLOYEz95Ru18zA0ydNbBuYoo9tgaYcxEYhJVE=
3131
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4=
3232
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ=
3333
github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM=
@@ -71,8 +71,8 @@ github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa1
7171
github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s=
7272
github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ=
7373
github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
74-
github.com/modelcontextprotocol/go-sdk v0.6.0 h1:cmtMYfRAUtEtCiuorOWPj7ygcypfuB2FgFEDBqZqgy4=
75-
github.com/modelcontextprotocol/go-sdk v0.6.0/go.mod h1:djQKZ74bEV+UMAmyG/L0coVhV0HM3fpVtGuUPls0znc=
74+
github.com/modelcontextprotocol/go-sdk v0.7.0 h1:XEQfn3bDx2cAdSUKty3tYEMll5dtRgBUDX88Q65fai0=
75+
github.com/modelcontextprotocol/go-sdk v0.7.0/go.mod h1:nYtYQroQ2KQiM0/SbyEPUWQ6xs4B95gJjEalc9AQyOs=
7676
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
7777
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
7878
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=

internal/constants/constants.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
11
package constants
22

3+
//nolint:gochecknoglobals
4+
var (
5+
// Version is the current version of the server. It is set at build time.
6+
Version = "dev"
7+
UserAgent = ProjectName + "/" + Version
8+
)
9+
310
const (
4-
RequiredPermissionSet = "FunctionsFullAccess"
11+
ProjectName = "mcp-scaleway-functions"
512

613
// TagCreatedByScalewayMCP is the tag added to all resources created by this MCP tool.
714
// It's used as an extra safety measure to avoid deleting resources not created by this tool.
8-
TagCreatedByScalewayMCP = "created_by=scaleway_mcp"
15+
TagCreatedByScalewayMCP = "created_by=" + ProjectName
16+
17+
// RequiredPermissionSet is the minimum permission set required for the Scaleway API key.
18+
RequiredPermissionSet = "FunctionsFullAccess"
919
)

0 commit comments

Comments
 (0)