### Install Go Color Library Source: https://github.com/docker/mcp-gateway/blob/main/vendor/github.com/fatih/color/README.md Use 'go get' to install the color library. This is the initial setup step before using any of its features. ```bash go get github.com/fatih/color ``` -------------------------------- ### Install ULID Go Library Source: https://github.com/docker/mcp-gateway/blob/main/vendor/github.com/oklog/ulid/README.md Use 'go get' to install the ULID library. No additional setup is required for basic usage. ```shell go get github.com/oklog/ulid ``` -------------------------------- ### Install go-isatty Source: https://github.com/docker/mcp-gateway/blob/main/vendor/github.com/mattn/go-isatty/README.md Install the go-isatty library using the go get command. ```bash go get github.com/mattn/go-isatty ``` -------------------------------- ### Install regexp2 Source: https://github.com/docker/mcp-gateway/blob/main/vendor/github.com/dlclark/regexp2/README.md Use `go get` to install the regexp2 library. ```go go get github.com/dlclark/regexp2 ``` -------------------------------- ### Install goccy/go-json Source: https://github.com/docker/mcp-gateway/blob/main/vendor/github.com/goccy/go-json/README.md Use 'go get' to install the library. This command fetches and installs the specified package and its dependencies. ```bash go get github.com/goccy/go-json ``` -------------------------------- ### Install Afero Source: https://github.com/docker/mcp-gateway/blob/main/vendor/github.com/spf13/afero/README.md Use 'go get' to install the Afero library. Then, import it into your Go application. ```bash go get github.com/spf13/afero ``` ```go import "github.com/spf13/afero" ``` -------------------------------- ### Install goccy/go-yaml Source: https://github.com/docker/mcp-gateway/blob/main/vendor/github.com/goccy/go-yaml/README.md Use 'go get' to install the library. This command fetches and installs the specified package. ```sh go get github.com/goccy/go-yaml ``` -------------------------------- ### Initialize Go Module and Get Tool Source: https://github.com/docker/mcp-gateway/blob/main/vendor/github.com/docker/cli-docs-tool/README.md Set up a Go submodule in a 'docs' folder and install the documentation generation tool. Ensure your go.mod file includes the cli-docs-tool. ```console $ mkdir docs $ cd ./docs $ go mod init github.com/docker/buildx/docs $ go get github.com/docker/cli-docs-tool ``` ```text module github.com/docker/buildx/docs go 1.16 require ( github.com/docker/cli-docs-tool v0.0.0 ) ``` -------------------------------- ### Install sqlx Source: https://github.com/docker/mcp-gateway/blob/main/vendor/github.com/jmoiron/sqlx/README.md Use `go get` to install the sqlx library. Ensure your Go version is compatible with recent releases. ```bash go get github.com/jmoiron/sqlx ``` -------------------------------- ### Install Go Locales Source: https://github.com/docker/mcp-gateway/blob/main/vendor/github.com/go-playground/locales/README.md Use 'go get' to install the Go Locales library. ```shell go get github.com/go-playground/locales ``` -------------------------------- ### Install Locafero Source: https://github.com/docker/mcp-gateway/blob/main/vendor/github.com/sagikazarmark/locafero/README.md Use this command to install the Locafero library using go get. ```shell go get github.com/sagikazarmark/locafero ``` -------------------------------- ### Install easyjson for Go >= 1.17 Source: https://github.com/docker/mcp-gateway/blob/main/vendor/github.com/mailru/easyjson/README.md Install easyjson using 'go get' and 'go install' for Go 1.17 and later. ```sh # for Go >= 1.17 go get github.com/mailru/easyjson && go install github.com/mailru/easyjson/...@latest ``` -------------------------------- ### Run local Go Doc site Source: https://github.com/docker/mcp-gateway/blob/main/vendor/go.opentelemetry.io/otel/CONTRIBUTING.md Commands to install and start a local documentation server for Go packages. ```sh go install golang.org/x/pkgsite/cmd/pkgsite@latest pkgsite ``` -------------------------------- ### Install go-logging using go get Source: https://github.com/docker/mcp-gateway/blob/main/vendor/gopkg.in/op/go-logging.v1/README.md Use this command to install or update the go-logging library. Ensure your GOPATH is set correctly. ```bash go get github.com/op/go-logging ``` -------------------------------- ### Install Cobra Library Source: https://github.com/docker/mcp-gateway/blob/main/vendor/github.com/spf13/cobra/README.md Use 'go get' to install the latest version of the Cobra library. ```bash go get -u github.com/spf13/cobra@latest ``` -------------------------------- ### Create Bootstrap Catalog with Docker Examples Source: https://github.com/docker/mcp-gateway/blob/main/docs/feature-specs/catalog-management/implementation-checklist.md This bash command creates a bootstrap catalog file with Docker and Docker Hub server entries. It serves as an example for users to understand the catalog format and get started. ```bash # Create bootstrap catalog with Docker examples docker mcp catalog bootstrap ./my-custom-catalog.yaml ``` -------------------------------- ### Install Golang Semver Library Source: https://github.com/docker/mcp-gateway/blob/main/vendor/github.com/blang/semver/README.md Use 'go get' to install the library. It's recommended to vendor dependencies or use specific version tags. ```bash $ go get github.com/blang/semver ``` -------------------------------- ### Install utfbom Package Source: https://github.com/docker/mcp-gateway/blob/main/vendor/github.com/dimchansky/utfbom/README.md Use 'go get' to install the utfbom package. This command fetches and installs the package and its dependencies. ```go go get -u github.com/dimchansky/utfbom ``` -------------------------------- ### Install go-colorable Package Source: https://github.com/docker/mcp-gateway/blob/main/vendor/github.com/mattn/go-colorable/README.md Install the go-colorable package using the go get command. This command fetches and installs the package and its dependencies. ```bash $ go get github.com/mattn/go-colorable ``` -------------------------------- ### Install mapstructure Go Library Source: https://github.com/docker/mcp-gateway/blob/main/vendor/github.com/mitchellh/mapstructure/README.md Use standard go get to install the mapstructure library. ```bash go get github.com/mitchellh/mapstructure ``` -------------------------------- ### Install Zap Logging Library Source: https://github.com/docker/mcp-gateway/blob/main/vendor/go.uber.org/zap/README.md Use go get to install the Zap library. Zap supports the two most recent minor versions of Go. ```bash go get -u go.uber.org/zap ``` -------------------------------- ### Build Go OpenTelemetry Metrics Example Source: https://github.com/docker/mcp-gateway/blob/main/examples/otel/metrics/README.md Compiles the Go OpenTelemetry metrics example. This command should be run after navigating to the example's directory. ```bash go build -o otel_metric_example otel_metric_example.go ``` -------------------------------- ### Install Golang Source Map Consumer Source: https://github.com/docker/mcp-gateway/blob/main/vendor/github.com/go-sourcemap/sourcemap/README.md Use 'go get' to install the latest version of the sourcemap library. ```shell go get -u github.com/go-sourcemap/sourcemap ``` -------------------------------- ### Install glua Interpreter Source: https://github.com/docker/mcp-gateway/blob/main/vendor/github.com/yuin/gopher-lua/README.rst Use go get to install the glua command-line interpreter for GopherLua. ```bash go get github.com/yuin/gopher-lua/cmd/glua ``` -------------------------------- ### Install Go Validator Package Source: https://github.com/docker/mcp-gateway/blob/main/vendor/github.com/go-playground/validator/v10/README.md Use 'go get' to install the validator package. Then import it into your Go code. ```go go get github.com/go-playground/validator/v10 ``` ```go import "github.com/go-playground/validator/v10" ``` -------------------------------- ### Install easyjson for Go < 1.17 Source: https://github.com/docker/mcp-gateway/blob/main/vendor/github.com/mailru/easyjson/README.md Use 'go get -u' to install easyjson for older Go versions. ```sh # for Go < 1.17 go get -u github.com/mailru/easyjson/... ``` -------------------------------- ### Go: Main function for channel communication example Source: https://github.com/docker/mcp-gateway/blob/main/vendor/github.com/yuin/gopher-lua/README.rst Initializes two channels, starts sender and receiver goroutines, and waits for a duration to allow communication to occur. ```go func main() { ch := make(chan lua.LValue) quit := make(chan lua.LValue) go receiver(ch, quit) go sender(ch, quit) time.Sleep(3 * time.Second) } ``` -------------------------------- ### Example Tool Registration Output Source: https://github.com/docker/mcp-gateway/blob/main/examples/tool_registrations/README.md This is an example of the JSON output for tool registrations, showing details for 'list_directory' and 'read_file' tools from the 'filesystem' server. ```json { "list_directory": { "server_name": "filesystem", "tool": { "name": "list_directory", "description": "List contents of a directory", "inputSchema": { "type": "object", "properties": { "path": { "type": "string", "description": "Directory path to list" } }, "required": ["path"] } } }, "read_file": { "server_name": "filesystem", "tool": { "name": "read_file", "description": "Read contents of a file", "inputSchema": { "type": "object", "properties": { "path": { "type": "string", "description": "File path to read" } }, "required": ["path"] } } } } ``` -------------------------------- ### HTTP Interceptor Examples Source: https://github.com/docker/mcp-gateway/blob/main/examples/interceptors/README.md Examples of configuring before and after HTTP interceptors. ```text --interceptor=before:http:http://interceptor:8080/before --interceptor=after:http:http://interceptor:8080/after ``` -------------------------------- ### Install and Upgrade Go Properties Library Source: https://github.com/docker/mcp-gateway/blob/main/vendor/github.com/magiconair/properties/README.md Use this command to install or upgrade the properties library to the latest version. ```bash go get -u github.com/magiconair/properties ``` -------------------------------- ### Basic Chi Router Setup Source: https://github.com/docker/mcp-gateway/blob/main/vendor/github.com/go-chi/chi/README.md Sets up a basic Chi router with a single GET route and a logger middleware. Use this for simple HTTP services. ```go package main import ( "net/http" "github.com/go-chi/chi" "github.com/go-chi/chi/middleware" ) func main() { r := chi.NewRouter() r.Use(middleware.Logger) r.Get("/", func(w http.ResponseWriter, r *http.Request) { w.Write([]byte("welcome")) }) http.ListenAndServe(":3000", r) } ``` -------------------------------- ### Install Docker MCP Gateway Plugin Source: https://github.com/docker/mcp-gateway/blob/main/README.md Clone the repository, build, and install the Docker MCP Gateway CLI plugin. Ensure you have Go 1.24+ installed. ```bash # Clone the repository git clone https://github.com/docker/mcp-gateway.git cd mcp-gateway mkdir -p "$HOME/.docker/cli-plugins/" # Build and install the plugin make docker-mcp ``` -------------------------------- ### Install blackfriday-tool Source: https://github.com/docker/mcp-gateway/blob/main/vendor/github.com/russross/blackfriday/v2/README.md Use this command to download and install the `blackfriday-tool`, a command-line tool for processing markdown files. This also installs the blackfriday package. ```bash go get github.com/russross/blackfriday-tool ``` -------------------------------- ### Install regexp2 with Code Generation Source: https://github.com/docker/mcp-gateway/blob/main/vendor/github.com/dlclark/regexp2/README.md To use the code generation utility (currently in beta), install the `code_gen` branch. ```go go get github.com/dlclark/regexp2@code_gen ``` -------------------------------- ### Development Workflow Example Source: https://github.com/docker/mcp-gateway/blob/main/docs/feature-specs/dynamic_servers.md Demonstrates the interaction flow for finding and adding a filesystem server. ```text AI: I need to work with files. Let me find filesystem tools. Tool: mcp-find -> query: "filesystem" AI: Great! I'll add the filesystem server. Tool: mcp-add -> name: "filesystem" AI: Now I can use file operations. ``` -------------------------------- ### Run Go OpenTelemetry Metrics Example Source: https://github.com/docker/mcp-gateway/blob/main/examples/otel/metrics/README.md Executes the compiled Go OpenTelemetry metrics example. This will send metrics to a running OpenTelemetry collector. ```bash ./otel_metric_example ``` -------------------------------- ### Bootstrap a Starter Catalog File Source: https://github.com/docker/mcp-gateway/blob/main/docs/feature-specs/catalog-management/feature-spec.md Create a starter catalog file that includes examples of Docker Hub and Docker CLI entries. This file can be modified to add custom servers and then imported or used as a source for other commands. ```bash # Create a starter catalog file with Docker Hub and Docker CLI as examples docker mcp catalog bootstrap ./my-starter-catalog.yaml # File contains properly formatted Docker and DockerHub entries as reference # User can modify file to add their own servers # Then import or use as source for other commands docker mcp catalog import ./my-starter-catalog.yaml # OR docker mcp catalog add existing-catalog my-server ./my-starter-catalog.yaml ``` -------------------------------- ### Server Configuration Example Source: https://github.com/docker/mcp-gateway/blob/main/docs/feature-specs/dynamic_servers.md Demonstrates setting specific configuration keys for a server, such as allowed paths. ```text AI: I need to configure the filesystem server with specific paths. Tool: mcp-config-set -> server: "filesystem", key: "allowed_paths", value: ["/workspace"] AI: Configuration updated. The server now has restricted access. ``` -------------------------------- ### Bootstrap Starter Catalog Source: https://github.com/docker/mcp-gateway/blob/main/docs/feature-specs/catalog-management/implementation-checklist.md Creates a starter catalog file './starter-catalog.yaml' containing example Docker and DockerHub server configurations. ```bash docker mcp catalog bootstrap ./starter-catalog.yaml ``` -------------------------------- ### Commented TOML Configuration Example Source: https://github.com/docker/mcp-gateway/blob/main/vendor/github.com/pelletier/go-toml/v2/README.md Example of a TOML configuration file that includes comments and commented-out values, demonstrating go-toml's ability to preserve these. ```toml # Host IP to connect to. host = '127.0.0.1' # Port of the remote server. port = 4242 # Encryption parameters (optional) # [TLS] # cipher = 'AEAD-AES128-GCM-SHA256' # version = 'TLS 1.3' ``` -------------------------------- ### Basic Golang Logging Example Source: https://github.com/docker/mcp-gateway/blob/main/vendor/gopkg.in/op/go-logging.v1/README.md Demonstrates setting up multiple log backends with custom formatting and log levels. Use this to configure flexible logging in your Go applications. ```go package main import ( "os" "github.com/op/go-logging" ) var log = logging.MustGetLogger("example") // Example format string. Everything except the message has a custom color // which is dependent on the log level. Many fields have a custom output // formatting too, eg. the time returns the hour down to the milli second. var format = logging.MustStringFormatter( `%{color}%{time:15:04:05.000} %{shortfunc} ▶ %{level:.4s} %{id:03x}%{color:reset} %{message}`, ) // Password is just an example type implementing the Redactor interface. Any // time this is logged, the Redacted() function will be called. type Password string func (p Password) Redacted() interface{} { return logging.Redact(string(p)) } func main() { // For demo purposes, create two backend for os.Stderr. backend1 := logging.NewLogBackend(os.Stderr, "", 0) backend2 := logging.NewLogBackend(os.Stderr, "", 0) // For messages written to backend2 we want to add some additional // information to the output, including the used log level and the name of // the function. backend2Formatter := logging.NewBackendFormatter(backend2, format) // Only errors and more severe messages should be sent to backend1 backend1Leveled := logging.AddModuleLevel(backend1) backend1Leveled.SetLevel(logging.ERROR, "") // Set the backends to be used. logging.SetBackend(backend1Leveled, backend2Formatter) log.Debugf("debug %s", Password("secret")) log.Info("info") log.Notice("notice") log.Warning("warning") log.Error("err") log.Critical("crit") } ``` -------------------------------- ### Install aec Package Source: https://github.com/docker/mcp-gateway/blob/main/vendor/github.com/morikuni/aec/README.md Use 'go get' to install the aec package. This command fetches and installs the package and its dependencies. ```bash go get github.com/morikuni/aec ``` -------------------------------- ### Importing Official Servers Example Source: https://github.com/docker/mcp-gateway/blob/main/docs/feature-specs/dynamic_servers.md Demonstrates importing multiple servers from the official registry URL. ```text AI: I want to use servers from the official registry. Tool: mcp-official-registry-import -> url: "https://registry.mcp.dev/servers.json" AI: Successfully imported 12 servers. I can now use them. ``` -------------------------------- ### Bootstrap a Starter Catalog Source: https://github.com/docker/mcp-gateway/blob/main/docs/catalog.md Use the bootstrap command to create a starter catalog file with Docker's official server entries as examples. This file can then be modified for custom servers. ```bash # Create a starter catalog with Docker Hub and Docker CLI server examples docker mcp catalog bootstrap ./my-starter-catalog.yaml # The file now contains properly formatted server definitions you can modify ``` -------------------------------- ### Install uuid Package Source: https://github.com/docker/mcp-gateway/blob/main/vendor/github.com/google/uuid/README.md Use 'go get' to install the uuid package. This command fetches and installs the package and its dependencies. ```sh go get github.com/google/uuid ``` -------------------------------- ### Initializing OsFs Backend Source: https://github.com/docker/mcp-gateway/blob/main/vendor/github.com/spf13/afero/README.md Demonstrates the initialization of the OsFs backend, which wraps native OS file system calls. This is suitable for production use and can be swapped for testing. ```go appfs := afero.NewOsFs() appfs.MkdirAll("src/a", 0755) ``` -------------------------------- ### Install Universal Translator Source: https://github.com/docker/mcp-gateway/blob/main/vendor/github.com/go-playground/universal-translator/README.md Use 'go get' to install the Universal Translator package. ```shell go get github.com/go-playground/universal-translator ``` -------------------------------- ### Start and Open Docs Server Source: https://github.com/docker/mcp-gateway/blob/main/vendor/github.com/golang-migrate/migrate/v4/CONTRIBUTING.md Generate project documentation and open it in your browser using the godoc server. Repeatedly calling 'make docs' refreshes the server. ```bash make docs && make open-docs ``` -------------------------------- ### Go Project Migration Example Source: https://github.com/docker/mcp-gateway/blob/main/vendor/github.com/golang-migrate/migrate/v4/README.md Integrate database migrations into your Go project using the migrate library. This example shows how to set up migrations from a GitHub source and apply them to a PostgreSQL database. ```go import ( "github.com/golang-migrate/migrate/v4" _ "github.com/golang-migrate/migrate/v4/database/postgres" _ "github.com/golang-migrate/migrate/v4/source/github" ) func main() { m, err := migrate.New( "github://mattes:personal-access-token@mattes/migrate_test", "postgres://localhost:5432/database?sslmode=enable") m.Steps(2) } ``` -------------------------------- ### Install Mimetype Package Source: https://github.com/docker/mcp-gateway/blob/main/vendor/github.com/gabriel-vasile/mimetype/README.md Use 'go get' to install the mimetype package for your Go project. ```bash go get github.com/gabriel-vasile/mimetype ``` -------------------------------- ### Create Starter Catalog File Source: https://github.com/docker/mcp-gateway/blob/main/docs/feature-specs/catalog-management/feature-spec.md Generates a starter catalog YAML file with example Docker and Docker Hub server entries. This file can be modified by the user to define custom catalogs. ```bash docker mcp catalog bootstrap ./my-starter-catalog.yaml ``` -------------------------------- ### Install zstd Package Source: https://github.com/docker/mcp-gateway/blob/main/vendor/github.com/klauspost/compress/zstd/README.md Install the zstd package using go get. The package is located at github.com/klauspost/compress/zstd. ```bash go get -u github.com/klauspost/compress ``` -------------------------------- ### Install GopherLua Source: https://github.com/docker/mcp-gateway/blob/main/vendor/github.com/yuin/gopher-lua/README.rst Use 'go get' to install the GopherLua package. Requires Go version 1.9 or later. ```bash go get github.com/yuin/gopher-lua ``` -------------------------------- ### Initialize Properties from Various Sources in Go Source: https://github.com/docker/mcp-gateway/blob/main/vendor/github.com/magiconair/properties/README.md Demonstrates initializing a properties object from files, maps, strings, URLs, and command-line flags. Ensure necessary imports are included. ```go import ( "flag" "github.com/magiconair/properties" ) func main() { // init from a file p := properties.MustLoadFile("${HOME}/config.properties", properties.UTF8) // or multiple files p = properties.MustLoadFiles([]string{ "${HOME}/config.properties", "${HOME}/config-${USER}.properties", }, properties.UTF8, true) // or from a map p = properties.LoadMap(map[string]string{"key": "value", "abc": "def"}) // or from a string p = properties.MustLoadString("key=value\nabc=def") // or from a URL p = properties.MustLoadURL("http://host/path") // or from multiple URLs p = properties.MustLoadURL([]string{ "http://host/config", "http://host/config-${USER}", }, true) // or from flags p.MustFlag(flag.CommandLine) // get values through getters host := p.MustGetString("host") port := p.GetInt("port", 8080) // or through Decode type Config struct { Host string `properties:"host"` Port int `properties:"port,default=9000"` Accept []string `properties:"accept,default=image/png;image;gif"` Timeout time.Duration `properties:"timeout,default=5s"` } var cfg Config if err := p.Decode(&cfg); err != nil { log.Fatal(err) } } ``` -------------------------------- ### Development Workflow: Create and Test Profile Source: https://github.com/docker/mcp-gateway/blob/main/docs/profiles.md Initiate a development profile with a catalog server and test it with the gateway. This is the first step in setting up a local development environment. ```bash # 1. Create a development profile docker mcp profile create --name dev \ --server catalog://mcp/docker-mcp-catalog:latest/filesystem # 2. Test it with the gateway docker mcp gateway run --profile dev ``` -------------------------------- ### Docker Credential Helper Get Example Source: https://github.com/docker/mcp-gateway/blob/main/vendor/github.com/google/go-containerregistry/pkg/authn/README.md Example of invoking a Docker credential helper ('docker-credential-gcr') to retrieve credentials for a registry. ```bash $ echo "gcr.io" | docker-credential-gcr get {"Username":"_token","Secret":""} ``` -------------------------------- ### Create Catalog from Local Server Definition File Source: https://github.com/docker/mcp-gateway/blob/main/docs/profiles.md Create a catalog using a local server definition file, specified with the `file://` prefix. ```bash # Create a catalog from a local server definition file docker mcp catalog create my-catalog --title my-catalog --server file://./my-server.yaml ``` -------------------------------- ### Example Starter Catalog Content Source: https://github.com/docker/mcp-gateway/blob/main/docs/feature-specs/catalog-management/feature-spec.md An example of the content generated by `docker mcp catalog bootstrap`. It includes definitions for Docker Hub and Docker CLI servers. ```yaml registry: dockerhub: description: "Docker Hub official MCP server." title: "Docker Hub" image: "mcp/dockerhub@sha256:..." tools: [...] # ... complete server definition docker: description: "Use the Docker CLI." title: "Docker" type: "poci" # ... complete server definition ``` -------------------------------- ### Run Embeddings Pull Example Source: https://github.com/docker/mcp-gateway/blob/main/examples/embeddings/README.md Execute the pull example script to download embeddings from an OCI registry and install them locally. This script is idempotent and will not overwrite existing local embeddings. ```bash # From repository root go run ./examples/embeddings/pull/main.go ``` -------------------------------- ### Install memory Package Source: https://github.com/docker/mcp-gateway/blob/main/vendor/modernc.org/memory/README.md Use this command to get the memory package for your Go project. ```bash $ go get modernc.org/memory ``` -------------------------------- ### Initialize and Use VectorDBClient in Go Source: https://github.com/docker/mcp-gateway/blob/main/pkg/gateway/embeddings/README.md Demonstrates the basic usage of the VectorDBClient, including client creation (which starts the Docker container), collection creation, adding a vector with metadata, and searching for similar vectors. Ensure the vector dimension matches your embedding model (e.g., 1536 for OpenAI). ```go package main import ( "context" "log" "github.com/docker/mcp-gateway/pkg/gateway/embeddings" ) func main() { ctx := context.Background() // Create client (this starts the container) // The dimension parameter specifies the vector dimension (1536 for OpenAI embeddings) client, err := embeddings.NewVectorDBClient(ctx, "./data", 1536, nil) if err != nil { log.Fatal(err) } defer client.Close() // Create a collection _, err = client.CreateCollection(ctx, "my-vectors") if err != nil { log.Fatal(err) } // Add a vector (1536 dimensions for OpenAI embeddings) vector := make([]float64, 1536) for i := range vector { vector[i] = 0.1 // Your actual embedding values here } metadata := map[string]interface{}{ "text": "This is my document", "source": "example.txt", } _, err = client.AddVector(ctx, "my-vectors", vector, metadata) if err != nil { log.Fatal(err) } // Search for similar vectors results, err := client.SearchVectors(ctx, vector, &embeddings.SearchOptions{ CollectionName: "my-vectors", Limit: 10, }) if err != nil { log.Fatal(err) } for _, result := range results { log.Printf("Match: ID=%d, Distance=%f, Metadata=%v\n", result.ID, result.Distance, result.Metadata) } } ``` -------------------------------- ### Run OpenTelemetry Collector Source: https://github.com/docker/mcp-gateway/blob/main/examples/otel/metrics/README.md Starts a Docker container for the OpenTelemetry collector. Ensure this collector is running before executing the Go example. ```bash # Run the OpenTelemetry collector docker run -p 4317:4317 -p 4318:4318 \ otel/opentelemetry-collector-contrib:latest \ --config-file=/etc/otel-collector-config.yaml ``` -------------------------------- ### Production Deployment Catalog Setup Source: https://github.com/docker/mcp-gateway/blob/main/docs/catalog.md Commands to create a production catalog and add only production-ready servers. This ensures that only stable and validated services are deployed to the production environment. ```bash # 1. Create production catalog docker mcp catalog create prod-servers # 2. Add only production-ready servers docker mcp catalog add prod-servers monitoring ./monitoring-server.yaml docker mcp catalog add prod-servers logging ./logging-server.yaml # 3. Export for backup and deployment docker mcp catalog export prod-servers ./prod-catalog-backup.yaml ``` -------------------------------- ### Node Interface Source: https://github.com/docker/mcp-gateway/blob/main/vendor/github.com/dop251/goja/ast/README.markdown The base interface for all AST nodes, providing methods to get the start and end indices of the node in the source code. ```APIDOC ## Node Interface ### Description The `Node` interface defines the fundamental contract for all nodes within the Abstract Syntax Tree (AST). It provides methods to retrieve the starting and ending positions of the node in the original source code. ### Methods - `Idx0() file.Idx`: Returns the index of the first character belonging to the node. - `Idx1() file.Idx`: Returns the index of the first character immediately after the node. ``` -------------------------------- ### Manual Build and Run (Go) Source: https://github.com/docker/mcp-gateway/blob/main/examples/sqlite-vec/README.md Manually build the MCP Gateway binary using Go commands. This involves downloading dependencies, enabling CGO for extensions, and then running the compiled binary. ```bash # Install dependencies go mod download # Build the binary CGO_ENABLED=1 go build -tags "sqlite_extensions" -o sqlite-vec-mcp main.go # Run locally (for testing) ./sqlite-vec-mcp ``` -------------------------------- ### Import Blackfriday v2 Package Source: https://github.com/docker/mcp-gateway/blob/main/vendor/github.com/russross/blackfriday/v2/README.md Import the Blackfriday v2 package into your Go project. This can be done directly in your code, and `go get` will handle the installation. ```go import "github.com/russross/blackfriday/v2" ``` -------------------------------- ### Download Go Project Sources Source: https://github.com/docker/mcp-gateway/blob/main/vendor/github.com/go-chi/chi/CONTRIBUTING.md Use this command to download the Go project sources and navigate to the project directory. Ensure Go is installed and GOPATH is configured. ```bash go get -u -d github.com/go-chi/chi cd $GOPATH/src/github.com/go-chi/chi ``` -------------------------------- ### Create a ConnectRPC Client Source: https://github.com/docker/mcp-gateway/blob/main/vendor/connectrpc.com/connect/README.md This example shows how to initialize a Ping service client and perform a request to the server running on localhost:8080. ```go package main import ( "context" "log" "net/http" pingv1 "connectrpc.com/connect/internal/gen/connect/ping/v1" "connectrpc.com/connect/internal/gen/simple/connect/ping/v1/pingv1connect" ) func main() { client := pingv1connect.NewPingServiceClient( http.DefaultClient, "http://localhost:8080/", ) req := &pingv1.PingRequest{Number: 42} res, err := client.Ping(context.Background(), req) if err != nil { log.Fatalln(err) } log.Println(res) } ``` -------------------------------- ### Fetch gRPC-Go Package Source: https://github.com/docker/mcp-gateway/blob/main/vendor/google.golang.org/grpc/README.md Use 'go get' to update or install the gRPC-Go package. This command is also suggested to resolve 'undefined: grpc.SupportPackageIsVersion' compilation errors. ```sh go get -u google.golang.org/grpc ``` -------------------------------- ### Example .gitignore File Source: https://github.com/docker/mcp-gateway/blob/main/vendor/github.com/shibumi/go-pathspec/README.md This is a sample .gitignore file content. It demonstrates a global filename pattern matching rule. ```gitignore # gitignore test file parse.go ``` -------------------------------- ### Node Interface Definition Source: https://github.com/docker/mcp-gateway/blob/main/vendor/github.com/dop251/goja/ast/README.markdown Defines the base Node interface for all AST nodes, providing methods to get the start and end indices of the node in the source code. ```go type Node interface { Idx0() file.Idx // The index of the first character belonging to the node Idx1() file.Idx // The index of the first character immediately after the node } All nodes implement the Node interface. ``` -------------------------------- ### Show Makefile Help Source: https://github.com/docker/mcp-gateway/blob/main/examples/sqlite-vec/README.md Display all available commands and their descriptions from the project's Makefile. This is a useful starting point for understanding the build and development workflow. ```bash # Show all available commands make help ``` -------------------------------- ### Run the MCP Gateway with Default Profile Source: https://github.com/docker/mcp-gateway/blob/main/README.md Start the MCP gateway using the default profile. This command is suitable for single-client or multi-client setups using stdio transport. ```bash docker mcp gateway run ``` -------------------------------- ### Check if Terminal and Get Window Size Source: https://github.com/docker/mcp-gateway/blob/main/vendor/github.com/moby/term/README.md This example demonstrates how to check if a file descriptor is associated with a terminal and retrieve its dimensions (height and width). Ensure the 'term' package is imported. ```go package main import ( "log" "os" "github.com/moby/term" ) func main() { fd := os.Stdin.Fd() if term.IsTerminal(fd) { ws, err := term.GetWinsize(fd) if err != nil { log.Fatalf("term.GetWinsize: %s", err) } log.Printf("%d:%d\n", ws.Height, ws.Width) } } ``` -------------------------------- ### Using Denco as an HTTP Request Multiplexer Source: https://github.com/docker/mcp-gateway/blob/main/vendor/github.com/go-openapi/runtime/middleware/denco/README.md Set up Denco as an HTTP request multiplexer to handle different routes and HTTP methods. This example demonstrates defining handlers for GET and POST requests. ```go package main import ( "fmt" "log" "net/http" "github.com/go-openapi/runtime/middleware/denco" ) func Index(w http.ResponseWriter, r *http.Request, params denco.Params) { fmt.Fprintf(w, "Welcome to Denco!\n") } func User(w http.ResponseWriter, r *http.Request, params denco.Params) { fmt.Fprintf(w, "Hello %s!\n", params.Get("name")) } func main() { mux := denco.NewMux() handler, err := mux.Build([]denco.Handler{ mux.GET("/", Index), mux.GET("/user/:name", User), mux.POST("/user/:name", User), }) if err != nil { panic(err) } log.Fatal(http.ListenAndServe(":8080", handler)) } ``` -------------------------------- ### Create a Catalog from an Existing Profile Source: https://github.com/docker/mcp-gateway/blob/main/README.md Create a new catalog based on the servers and configurations defined in an existing profile. Specify the profile ID using `--from-profile`. ```bash docker mcp catalog create myorg/catalog:latest --from-profile dev-tools ``` -------------------------------- ### Install netdb Go Package Source: https://github.com/docker/mcp-gateway/blob/main/vendor/modernc.org/libc/honnef.co/go/netdb/README.md Use this command to install the netdb package. Ensure you have Go installed and configured. ```sh go get honnef.co/go/netdb ``` -------------------------------- ### Create Profile with Catalog References Source: https://github.com/docker/mcp-gateway/blob/main/docs/profiles.md Create a new profile named 'catalog-servers' referencing servers from an existing catalog. ```bash docker mcp profile create --name catalog-servers \ --server catalog://mcp/docker-mcp-catalog/github+slack ``` -------------------------------- ### Run Benchmarks Source: https://github.com/docker/mcp-gateway/blob/main/vendor/github.com/goccy/go-json/README.md Navigate to the benchmarks directory and run 'go test -bench .' to execute the performance benchmarks for the library. ```bash cd benchmarks go test -bench . ```