--- url: /docs.md description: >- Documentation for Nirantara's open-source projects: k3sctl, mssql-mcp-go, postgres-mcp-go, and omniroute-operator. --- # Documentation Nirantara builds cloud-native platforms, Kubernetes operators, and AI infrastructure. This site documents the four projects that make up the platform today. ## k3sctl {#k3sctl} Declarative lifecycle management for K3s clusters over SSH. * [Overview](./k3sctl/) * [Installation](./k3sctl/installation.md) * [Configuration](./k3sctl/configuration.md) * [Commands](./k3sctl/commands.md) ## mssql-mcp-go {#mssql-mcp-go} A read-only Model Context Protocol server for Microsoft SQL Server. * [Overview](./mssql-mcp-go/) * [Installation](./mssql-mcp-go/installation.md) * [Configuration](./mssql-mcp-go/configuration.md) * [Tools](./mssql-mcp-go/tools.md) ## postgres-mcp-go {#postgres-mcp-go} A read-only Model Context Protocol server for PostgreSQL. * [Overview](./postgres-mcp-go/) * [Installation](./postgres-mcp-go/installation.md) * [Configuration](./postgres-mcp-go/configuration.md) * [Tools](./postgres-mcp-go/tools.md) ## omniroute-operator {#omniroute-operator} A Kubernetes operator for OmniRoute, the unified AI proxy/router. * [Overview](./omniroute-operator/) * [Installation](./omniroute-operator/installation.md) * [OmniRoute CR](./omniroute-operator/omniroute-cr.md) * [Local development](./omniroute-operator/local-development.md) ## Using an AI coding assistant [Documentation for coding agents](../agents.md) is a compact map of every page, plus the details that are easiest to get wrong when generating configuration. Every page is also available as raw Markdown by appending `.md` to its URL, and the whole corpus is at [/llms.txt](/llms.txt). --- --- url: /docs/k3sctl.md description: >- Declarative lifecycle management for K3s clusters over SSH — install, upgrade, reconfigure, back up, and reset from one YAML file. --- # k3sctl `k3sctl` is a declarative lifecycle management tool for [K3s](https://k3s.io) clusters, created and inspired by [k0sctl](https://github.com/k0sproject/k0sctl). Point it at a YAML file describing your hosts and it installs, upgrades, reconfigures, backs up, and resets the cluster over SSH. **Single-node (localhost)** — no SSH required: ```sh k3sctl init --localhost --name dev > k3sctl.yaml k3sctl apply --config k3sctl.yaml k3sctl kubeconfig --config k3sctl.yaml > kubeconfig.yaml ``` **Multi-node (SSH)** — server + agent: ```sh k3sctl init --name demo --address 10.0.0.1 --agent --agent-address 10.0.0.2 > k3sctl.yaml k3sctl apply --config k3sctl.yaml k3sctl kubeconfig --config k3sctl.yaml > kubeconfig.yaml ``` See the [Quick Start](./quick-start.md) guide for step-by-step instructions covering single-node, multi-node, and high-availability setups. ## What it does * Declarative cluster configuration with servers and agents in one file. * Installs and upgrades K3s binaries from GitHub releases, a URL, a local file, or an existing installation on the host. * Generates server and agent configuration plus systemd units. * Supports labels, taints, extra install flags, environment variables, and arbitrary file uploads. * Applies additional Kubernetes manifests bundled in the configuration file. * Automated etcd snapshots with S3 upload, retention, and pruning, plus etcd member validation and restore from a snapshot. * Fetches a ready-to-use admin kubeconfig. * Idempotent `apply`: safe to re-run, and only changes what drifted. * Rolling upgrades with drain and cordon for both servers and agents. * Configuration validation (`config validate`) and diff (`config diff`). * Air-gap install: upload pre-downloaded image bundles for offline clusters. * Dry-run mode with `--dry-run`. * Private registry mirrors and authentication (`registries`). * Secrets encryption at rest with key rotation and re-encryption (`secretsEncrypt`). * Certificate Authority rotation (`certRotate.rotateCA`). * Cluster join token rotation (`token.rotate`). * Post-apply cluster health verification (`healthCheck`). * Pre-flight checks for cgroups, kernel modules, ports, and disk (`preflight`). * Declarative networking: cluster/service CIDRs, DNS, flannel backend, egress selector mode, NodePort range, and ServiceLB namespace (`network`). * Component disabling: turn off packaged components like traefik, servicelb, metrics-server, and individual subsystems like kube-proxy or the Helm controller (`disable`). * TLS SAN management: add Subject Alternative Names to the API server certificate (`tls`). * Kubeconfig output control: file mode, group, and cluster name (`kubeconfig`). * External datastore: MySQL, PostgreSQL, or etcd endpoint with TLS (`datastore`). * API server listener: advertise address/port, bind address, HTTPS port (`server`). * Security hardening: SELinux, kernel defaults protection, and encryption provider selection (`security`). * Typed component arguments: pass arguments directly to kube-apiserver, kube-controller-manager, kubelet, kube-proxy, etcd, and others (`componentArgs`). * Container runtime: system default registry, pause image, snapshotter, default runtime override, and custom resolv.conf (`runtime`). * Embedded container registry: enable the K3s built-in Spegel distributed registry (`embeddedRegistry`). * Image credential provider: external kubelet credential plugin for pulling images from private registries (`imageCredentialProvider`). * Per-host node networking: external IPs, internal/external DNS names for multi-homed and cloud nodes (`nodeExternalIP`, `nodeInternalDNS`, `nodeExternalDNS`). * Local storage: custom path for the built-in local-path provisioner (`localStorage`). * Advanced etcd tuning: expose metrics, disable automatic snapshots, snapshot naming, and reconcile interval (`etcdAdvanced`). * Advanced flannel options: interface selection, custom flannel and CNI configuration file paths (`network.flannelIface`, `flannelConf`, `flannelCNIConf`). * Advanced S3 snapshot storage: session tokens, bucket lookup type, proxy, config secret, timeout, and per-S3 retention (`etcdSnapshots.s3`). * Token files: read server and agent tokens from files instead of inline values (`token.tokenFile`, `token.agentTokenFile`). * Kubeconfig output path: write the kubeconfig to a custom location (`kubeconfig.path`). * Supervisor metrics and pprof: expose the supervisor metrics and profiling endpoints (`server.supervisorMetrics`, `server.enablePprof`). * Rootless mode: run K3s without root privileges, and prefer bundled binaries over host-installed versions (`security.rootless`, `security.preferBundledBin`). * CRI endpoint override: point K3s at a custom container runtime or image service socket (`runtime.containerRuntimeEndpoint`, `runtime.imageServiceEndpoint`). * Registry endpoint control: disable the default network endpoint for the embedded Spegel registry (`embeddedRegistry.disableDefaultRegistryEndpoint`). * Agent load balancer port: configure the port the agent uses to reach the control plane (`agent.lbServerPort`). * Per-host node ID: append the machine ID to the node name for uniqueness in auto-scaled or cloned environments (`withNodeID`). ::: warning Linux hosts only. `k3sctl` drives the cluster over SSH, so each host must be reachable and must provide `sudo` or a root login. ::: ## How it works 1. `k3sctl` reads the `Cluster` document from your config file. 2. It connects to each host over SSH and detects the OS and architecture. 3. It uploads or downloads the requested K3s version, writes the server or agent configuration and the systemd unit, then starts K3s. 4. Once the API server answers, it applies any additional manifests found in the same file with `kubectl apply`. 5. `k3sctl kubeconfig` reads the admin kubeconfig back so you can use it locally. Because the desired state is the file, re-running `apply` after editing it is the normal way to change a cluster. ## Requirements * Linux hosts for servers and agents (or the local machine for single-node). * SSH access with a key or agent (not needed for localhost mode). * Root or passwordless `sudo` on each host. `k3sctl` handles `sudo` internally — do not prefix commands with `sudo`. ## Next steps * [Quick Start](./quick-start.md): step-by-step guides for single-node, multi-node, and HA clusters. * [Installation](./installation.md): release binary, `go install`, or build from source. * [Configuration](./configuration.md): every host, K3s, and drain option. * [Commands](./commands.md): the full CLI and the flags accepted by `apply`. --- --- url: /docs/k3sctl/installation.md description: Install k3sctl from a release binary, with Go, or build it from source. --- # Installation `k3sctl` ships as a single static binary. Pick the method that fits your workflow. ## Homebrew (macOS / Linux) ```sh brew install nirantarasi/tap/k3sctl ``` ## Shell script (Linux / macOS) ```sh OS=$(uname -s | tr '[:upper:]' '[:lower:]') ARCH=$(uname -m) case "$ARCH" in x86_64) ARCH="amd64" ;; aarch64) ARCH="arm64" ;; armv7l) ARCH="arm" ;; esac VERSION=$(curl -sI https://github.com/nirantarasi/k3sctl/releases/latest | grep -i location | sed 's/.*tag\///' | tr -d '\r\n') TMPDIR=$(mktemp -d) curl -sSfL "https://github.com/nirantarasi/k3sctl/releases/download/${VERSION}/k3sctl_${VERSION#v}_${OS}_${ARCH}.tar.gz" | tar xz -C "$TMPDIR" sudo install -m 755 "$TMPDIR/k3sctl" /usr/local/bin/k3sctl rm -rf "$TMPDIR" ``` Release assets are published for Linux, macOS, and Windows on `amd64`, `arm64`, and `arm`. ## Debian / Ubuntu ```sh VERSION=$(curl -sI https://github.com/nirantarasi/k3sctl/releases/latest | grep -i location | sed 's/.*tag\///' | tr -d '\r\n') curl -sSfL -O "https://github.com/nirantarasi/k3sctl/releases/download/${VERSION}/k3sctl_${VERSION#v}_linux_amd64.deb" sudo dpkg -i k3sctl_*.deb rm -f k3sctl_*.deb ``` ## RHEL / Fedora ```sh VERSION=$(curl -sI https://github.com/nirantarasi/k3sctl/releases/latest | grep -i location | sed 's/.*tag\///' | tr -d '\r\n') curl -sSfL -O "https://github.com/nirantarasi/k3sctl/releases/download/${VERSION}/k3sctl_${VERSION#v}_linux_amd64.rpm" sudo rpm -i k3sctl_*.rpm rm -f k3sctl_*.rpm ``` ## Alpine ```sh VERSION=$(curl -sI https://github.com/nirantarasi/k3sctl/releases/latest | grep -i location | sed 's/.*tag\///' | tr -d '\r\n') curl -sSfL -O "https://github.com/nirantarasi/k3sctl/releases/download/${VERSION}/k3sctl_${VERSION#v}_linux_amd64.apk" sudo apk add --allow-untrusted k3sctl_*.apk rm -f k3sctl_*.apk ``` ## With Go If you already have a Go toolchain: ```sh go install github.com/nirantarasi/k3sctl@latest ``` This installs `k3sctl` into `$(go env GOPATH)/bin`. ## Build from source ```sh git clone https://github.com/nirantarasi/k3sctl.git cd k3sctl go build -o k3sctl . ./k3sctl version ``` ## Verify the installation ```sh k3sctl version k3sctl --help ``` ## Shell completion `k3sctl` can print a completion script for your shell: ```sh # Bash source <(k3sctl completion bash) # Zsh k3sctl completion zsh > "${fpath[1]}/_k3sctl" ``` Run `k3sctl completion --help` for the shells your build supports. ## Next steps Generate a starter configuration, edit it, and apply it: ```sh k3sctl init --name demo --address 10.0.0.1 --agent --agent-address 10.0.0.2 > k3sctl.yaml k3sctl apply --config k3sctl.yaml ``` See [Configuration](./configuration.md) for the full file reference and [Commands](./commands.md) for every subcommand. --- --- url: /docs/k3sctl/configuration.md description: >- The k3sctl Cluster file — hosts, roles, SSH access, K3s settings, networking, security, TLS, datastore, component args, runtime, embedded registry, image credential providers, local storage, etcd snapshots and tuning, registries, health checks, token files, kubeconfig path, supervisor metrics, rootless mode, CRI endpoints, agent load balancer, node ID, and additional manifests. --- # Configuration A `k3sctl` configuration is a single `Cluster` document with `apiVersion: k3sctl.k3sproject.io/v1beta1`. ```yaml apiVersion: k3sctl.k3sproject.io/v1beta1 kind: Cluster metadata: name: demo spec: hosts: - role: server ssh: address: 10.0.0.1 user: root port: 22 keyPath: ~/.ssh/id_ed25519 privateAddress: 10.0.0.1 # advertises this IP to the cluster installFlags: - --disable=traefik labels: node-role.example.com/edge: "true" taints: - dedicated=edge:NoSchedule environment: ETCD_UNSUPPORTED_ARCH: arm # rendered into the systemd unit files: - src: ./configs/registries.yaml dst: /etc/rancher/k3s/registries.yaml perm: "0600" hooks: apply: before: - echo preparing after: - echo done - role: agent ssh: address: 10.0.0.2 user: root port: 22 keyPath: ~/.ssh/id_ed25519 withNodeID: true # append machine ID to node name nodeExternalIP: # per-host external IPs - 203.0.113.10 nodeInternalDNS: # per-host internal DNS names - agent1.internal.example.com nodeExternalDNS: # per-host external DNS names - agent1.example.com k3s: version: v1.30.0+k3s1 config: # merged into config.yaml on every host write-kubeconfig-mode: "0644" disable: - servicelb extraArgs: - --kubelet-arg=eviction-hard=memory.available<100Mi etcdSnapshots: # automated etcd snapshot scheduling scheduled: true scheduleCron: "0 */12 * * *" retention: 5 dir: /var/lib/rancher/k3s/server/db/snapshots compress: true s3: enabled: true endpoint: s3.amazonaws.com bucket: my-k3s-backups region: us-east-1 folder: snapshots accessKey: AKIAIOSFODNN7EXAMPLE secretKey: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY sessionToken: FwoGZXIv... # STS session token bucketLookupType: auto # auto, dns, or path proxy: http://proxy.example.com:8080 configSecret: my-s3-secret timeout: 30s retention: 10 # per-S3 retention override prune: # prune old snapshots on apply enabled: true retention: 10 name: on-demand secretsEncrypt: # secrets encryption at rest enabled: true rotateKeys: true # dynamically rotate encryption keys reencrypt: true # re-encrypt all secrets with new keys certRotate: # certificate rotation on apply enabled: true rotateCA: true # rotate the root CA (full cluster restart) token: # cluster tokens serverToken: my-server-secret agentToken: my-agent-secret tokenFile: /etc/rancher/k3s/token # read token from a file agentTokenFile: /etc/rancher/k3s/agent-token rotate: true # rotate token and restart all nodes registries: # private registry configuration mirrors: docker.io: endpoint: - https://registry.example.com configs: registry.example.com: auth: username: myuser password: mypass tls: caFile: /path/to/ca.pem insecureSkipVerify: false healthCheck: # post-apply health verification enabled: true timeout: 120s preflight: # pre-flight checks before apply enabled: true checkCgroups: true checkModules: true checkPorts: true checkDisk: true minDiskGB: 10 airgap: # air-gap (offline) installation enabled: true imageBundle: /path/to/k3s-airgap-images-amd64.tar.zst network: # cluster networking clusterCIDR: - 10.42.0.0/16 serviceCIDR: - 10.43.0.0/16 clusterDNS: - 10.43.0.10 clusterDomain: cluster.local nodePortRange: "30000-32767" flannelBackend: vxlan # none, vxlan, host-gw, wireguard-native flannelIPv6Masq: false flannelExternalIP: false flannelIface: eth1 # network interface for flannel flannelConf: /etc/flannel.json # custom flannel config file flannelCNIConf: /etc/cni/net.d/10-flannel.conflist egressSelectorMode: agent # agent, cluster, pod, disabled serviceLBNamespace: kube-system disable: # disable packaged components components: - traefik - servicelb scheduler: false cloudController: false kubeProxy: false networkPolicy: false helmController: false tls: # API server TLS SANs sans: - lb.example.com - 10.0.0.100 sanSecurity: true kubeconfig: # kubeconfig output settings mode: "0644" group: admin name: my-cluster path: /output/kubeconfig.yaml # custom kubeconfig output path datastore: # external datastore (MySQL/Postgres/etcd) endpoint: "postgres://user:pass@db:5432/k3s" caFile: /etc/ssl/ca.pem certFile: /etc/ssl/cert.pem keyFile: /etc/ssl/key.pem server: # API server listener settings advertiseAddress: 10.0.0.50 advertisePort: 6443 bindAddress: 0.0.0.0 httpsPort: 6443 supervisorMetrics: true # expose supervisor metrics endpoint enablePprof: true # enable pprof profiling endpoint security: # security hardening selinux: true protectKernelDefaults: true encryptionProvider: secretbox # aescbc or secretbox rootless: true # run K3s in rootless mode preferBundledBin: true # prefer bundled binaries over host ones componentArgs: # typed pass-through args for K3s components kubeAPIServer: - "--audit-log-path=/var/log/audit.log" kubeControllerManager: - "--node-cidr-mask-size=24" kubeScheduler: [] kubeCloudControllerManager: [] kubelet: - "--max-pods=110" kubeProxy: - "--proxy-mode=ipvs" etcd: - "--quota-backend-bytes=8589934592" helmController: [] runtime: # container runtime settings systemDefaultRegistry: registry.example.com pauseImage: registry.example.com/pause:3.9 snapshotter: stargz defaultRuntime: nvidia resolvConf: /etc/k3s-resolv.conf # custom resolv.conf for containers containerRuntimeEndpoint: unix:///run/containerd/containerd.sock imageServiceEndpoint: unix:///run/containerd/containerd.sock embeddedRegistry: # built-in Spegel distributed registry enabled: true disableDefaultRegistryEndpoint: false # disable the default registry endpoint imageCredentialProvider: # kubelet image credential provider binDir: /var/lib/rancher/credentialprovider/bin config: /var/lib/rancher/credentialprovider/config.yaml agent: # agent-specific settings lbServerPort: 6444 # agent load balancer port (0-65535) localStorage: # local-path provisioner settings path: /opt/local-path-provisioner etcdAdvanced: # advanced etcd tuning exposeMetrics: true disableSnapshots: false snapshotName: my-cluster snapshotReconcileInterval: 5m options: drain: enabled: true timeout: 5m gracePeriod: -1 ignoreDaemonSets: true deleteEmptyDirData: true disableEviction: false concurrency: limit: 30 uploads: 5 evictTaint: enabled: false ``` ## Hosts `spec.hosts` is a list. Each entry describes one machine and the role it plays. | Key | Description | |---|---| | `role` | `server` (default) or `agent` | | `ssh` / `openSSH` / `localhost` | How to reach the host | | `privateAddress` | Address used for the node IP and API advertisements | | `privateInterface` | Network interface whose address is used for node IP and API advertisements | | `hostname` | Override the host name reported to the cluster | | `installFlags` | Extra `k3s server` / `k3s agent` command-line flags | | `labels`, `taints` | Convenience shortcuts for `--node-label` and `--node-taint` | | `environment` | Environment variables written to the host and the systemd unit | | `files` | Files to upload, from a local path or a URL | | `hooks` | Commands to run before or after `apply` | | `dataDir` | Overrides the K3s data directory | | `uploadBinary` | Upload a locally built binary instead of downloading one | | `k3sBinaryPath` | Use an existing binary already on the host | | `nodeExternalIP` | List of external IPs advertised for the node (passed as `--node-external-ip`) | | `nodeInternalDNS` | List of internal DNS names for the node | | `nodeExternalDNS` | List of external DNS names for the node | | `withNodeID` | Append the machine ID to the node name for uniqueness | | `noFlannel` | Disable the flannel CNI | | `os` | Override OS detection | ### SSH access The `ssh` block takes an `address`, `user`, `port`, and `keyPath`. Use `openSSH` to reuse your OpenSSH client configuration, or `localhost: true` when the host is the machine running `k3sctl` (no SSH needed): ```yaml spec: hosts: - localhost: true role: server ``` Localhost mode is single-node only and cannot be combined with agent hosts. ### Files and hooks `files` entries copy a local path or download a URL to `dst` on the host. Use `perm` to set the mode. `hooks.apply.before` and `hooks.apply.after` run shell commands around the apply step, which is useful for pre-flight checks and post-install verification. ## K3s `spec.k3s` controls the K3s installation itself. | Key | Description | |---|---| | `version` | K3s version to install, for example `v1.30.0+k3s1` | | `config` | Mapping merged into `config.yaml` on every host | | `extraArgs` | Extra arguments passed to the K3s service | | `etcdSnapshots` | Automated etcd snapshot scheduling, S3 upload, and pruning | | `secretsEncrypt` | Secrets encryption at rest with key rotation and re-encryption | | `certRotate` | Rotate TLS certificates and optionally the root CA | | `token` | Explicit server/agent join tokens and optional rotation | | `registries` | Private registry mirrors and authentication | | `healthCheck` | Post-apply cluster health verification | | `preflight` | Pre-flight checks run before apply | | `airgap` | Air-gap (offline) installation settings | | `network` | Cluster and service CIDRs, DNS, flannel backend, egress mode, NodePort range | | `disable` | Disable packaged components and individual K3s subsystems | | `tls` | Subject Alternative Names for the API server certificate | | `kubeconfig` | Write-kubeconfig mode, group, and name | | `datastore` | External datastore endpoint (MySQL/Postgres/etcd) with TLS | | `server` | API server advertise address/port, bind address, HTTPS port | | `security` | SELinux, protect-kernel-defaults, encryption provider | | `componentArgs` | Typed pass-through args for kube-apiserver, kubelet, etcd, and others | | `runtime` | System default registry, pause image, snapshotter, default runtime, resolv.conf | | `embeddedRegistry` | Enable the built-in Spegel distributed container registry | | `imageCredentialProvider` | Kubelet image credential provider binary directory and config | | `localStorage` | Custom path for the local-path provisioner | | `etcdAdvanced` | Advanced etcd settings: metrics, snapshots, reconcile interval | | `agent` | Agent-specific settings: load balancer server port | Binary sources can also be a URL, a local file, or an existing installation on the host; see the host-level `uploadBinary` and `k3sBinaryPath` options above. ### etcdSnapshots | Key | Description | |---|---| | `scheduled` | Enable scheduled snapshots | | `scheduleCron` | Cron expression for the snapshot schedule | | `retention` | Number of snapshots to retain | | `dir` | Local directory for snapshots | | `compress` | Compress snapshots | | `s3.enabled` | Store snapshots in S3 | | `s3.endpoint` | S3 endpoint | | `s3.endpointCa` | Path to a CA certificate for the S3 endpoint | | `s3.skipSslVerify` | Skip TLS verification for S3 | | `s3.accessKey` | S3 access key | | `s3.secretKey` | S3 secret key | | `s3.bucket` | S3 bucket name (required when S3 is enabled) | | `s3.region` | S3 region | | `s3.folder` | Folder within the bucket | | `s3.insecure` | Use HTTP instead of HTTPS | | `s3.sessionToken` | STS session token for temporary AWS credentials | | `s3.bucketLookupType` | Bucket lookup style: `auto`, `dns`, or `path` (default `auto`) | | `s3.proxy` | HTTP proxy URL for S3 requests | | `s3.configSecret` | Name of a Kubernetes secret containing the S3 configuration | | `s3.timeout` | Timeout for S3 operations, for example `"30s"` | | `s3.retention` | Per-S3 snapshot retention count (overrides the top-level `retention`) | #### etcdSnapshots.prune | Key | Description | |---|---| | `enabled` | Enable pruning of old etcd snapshots on apply | | `retention` | Number of snapshots to retain (required when enabled, must be greater than 0) | | `name` | Snapshot name filter for pruning, for example `on-demand` | ### secretsEncrypt | Key | Description | |---|---| | `enabled` | Enable K3s secrets encryption at rest | | `rotateKeys` | Dynamically rotate encryption keys | | `reencrypt` | Re-encrypt all secrets with the new keys | ### certRotate | Key | Description | |---|---| | `enabled` | Rotate K3s TLS certificates on each server during `apply` | | `rotateCA` | Rotate the root Certificate Authority; triggers a full cluster restart | ### token | Key | Description | |---|---| | `serverToken` | Token used for server-to-server communication | | `agentToken` | Token used for agent-to-server communication | | `tokenFile` | Path to a file containing the server token (mutually exclusive with `serverToken`) | | `agentTokenFile` | Path to a file containing the agent token (mutually exclusive with `agentToken`) | | `rotate` | Rotate the cluster join token and restart all nodes | ### registries | Key | Description | |---|---| | `mirrors..endpoint` | List of mirror endpoint URLs for the given registry | | `configs..auth.username` | Registry authentication username | | `configs..auth.password` | Registry authentication password | | `configs..auth.token` | Registry authentication token | | `configs..tls.certFile` | Path to a client TLS certificate | | `configs..tls.keyFile` | Path to a client TLS key | | `configs..tls.caFile` | Path to a CA certificate for the registry | | `configs..tls.insecureSkipVerify` | Skip TLS verification for the registry | The registries configuration is written to `/etc/rancher/k3s/registries.yaml` on all nodes during apply. ### healthCheck | Key | Description | |---|---| | `enabled` | Enable post-apply cluster health verification | | `timeout` | Maximum wait time for health checks, for example `120s` or `5m` | When enabled, the health check verifies the API server responds to `/healthz` and all nodes reach `Ready` status before the apply completes. ### preflight | Key | Description | |---|---| | `enabled` | Enable pre-flight checks | | `checkCgroups` | Verify cgroup v1/v2 controllers are available | | `checkModules` | Verify required kernel modules are loaded | | `checkPorts` | Verify required ports are not in use | | `checkDisk` | Verify minimum disk space is available | | `minDiskGB` | Minimum disk space in GB | ### airgap | Key | Description | |---|---| | `enabled` | Enable air-gap mode (skip downloading K3s images from the internet) | | `imageBundle` | Local path to a K3s air-gap image bundle, for example `k3s-airgap-images-amd64.tar.zst` | When enabled, the bundle is uploaded to `/agent/images/` on every host. ### network Declarative cluster networking configuration. All fields are server-only. | Key | Description | |---|---| | `clusterCIDR` | Pod CIDR ranges, for example `["10.42.0.0/16"]` or dual-stack `["10.42.0.0/16", "fd42::/48"]` | | `serviceCIDR` | Service CIDR ranges, for example `["10.43.0.0/16"]` | | `clusterDNS` | Cluster DNS service addresses, for example `["10.43.0.10"]` | | `clusterDomain` | Cluster domain, for example `cluster.local` | | `nodePortRange` | NodePort service port range, for example `"30000-32767"` | | `flannelBackend` | Flannel backend: `none`, `vxlan`, `host-gw`, or `wireguard-native` | | `flannelIPv6Masq` | Enable IPv6 masquerading for flannel | | `flannelExternalIP` | Use node external IPs for flannel traffic | | `flannelIface` | Network interface to use for flannel, for example `"eth1"` | | `flannelConf` | Path to a custom flannel configuration file | | `flannelCNIConf` | Path to a custom flannel CNI configuration file | | `egressSelectorMode` | Egress selector mode: `agent`, `cluster`, `pod`, or `disabled` | | `serviceLBNamespace` | Namespace for the built-in ServiceLB controller | ### disable Disable packaged K3s components and subsystems. Server-only. | Key | Description | |---|---| | `components` | List of packaged components to disable, for example `["traefik", "servicelb", "metrics-server", "coredns"]` | | `scheduler` | Disable the kube-scheduler | | `cloudController` | Disable the cloud controller manager | | `kubeProxy` | Disable kube-proxy | | `networkPolicy` | Disable the network policy controller | | `helmController` | Disable the Helm controller | ### tls TLS Subject Alternative Names for the API server certificate. Server-only. | Key | Description | |---|---| | `sans` | Additional SANs for the API server TLS certificate, for example `["lb.example.com", "10.0.0.100"]` | | `sanSecurity` | Enable TLS SAN security mode | ### kubeconfig Controls how the admin kubeconfig file is written on server nodes. Server-only. | Key | Description | |---|---| | `mode` | File permission mode for `kubeconfig`, for example `"0644"` | | `group` | Group ownership for the kubeconfig file | | `name` | Cluster name written into the kubeconfig | | `path` | Custom output path for the kubeconfig file | ### datastore External datastore configuration for MySQL, PostgreSQL, or etcd. Server-only. TLS fields require `endpoint` to be set. | Key | Description | |---|---| | `endpoint` | Datastore connection string, for example `"postgres://user:pass@db:5432/k3s"` | | `caFile` | Path to the CA certificate for the datastore TLS connection | | `certFile` | Path to the client certificate for the datastore TLS connection | | `keyFile` | Path to the client key for the datastore TLS connection | ### server API server listener settings. Server-only. | Key | Description | |---|---| | `advertiseAddress` | Address the API server advertises to cluster members | | `advertisePort` | Port the API server advertises (default `6443`) | | `bindAddress` | Address the API server binds to, for example `"0.0.0.0"` | | `httpsPort` | HTTPS listen port for the API server | | `supervisorMetrics` | Enable the supervisor metrics endpoint | | `enablePprof` | Enable the pprof profiling endpoint on the supervisor | ### security Security hardening options. Applied to both server and agent nodes. | Key | Description | |---|---| | `selinux` | Enable SELinux support in K3s | | `protectKernelDefaults` | Protect kernel defaults; K3s will error if required kernel parameters are not set | | `encryptionProvider` | Secrets encryption provider: `aescbc` or `secretbox` | | `rootless` | Run K3s in rootless mode (no root privileges required) | | `preferBundledBin` | Prefer K3s bundled binaries (containerd, runc, etc.) over host-installed versions | ### componentArgs Typed pass-through arguments for Kubernetes components. Server-only args are applied only to server configs; `kubelet` and `kubeProxy` are applied to both server and agent configs. | Key | Applies to | Description | |---|---|---| | `kubeAPIServer` | Server | Extra arguments for kube-apiserver | | `kubeControllerManager` | Server | Extra arguments for kube-controller-manager | | `kubeScheduler` | Server | Extra arguments for kube-scheduler | | `kubeCloudControllerManager` | Server | Extra arguments for kube-cloud-controller-manager | | `kubelet` | Server + Agent | Extra arguments for kubelet | | `kubeProxy` | Server + Agent | Extra arguments for kube-proxy | | `etcd` | Server | Extra arguments for etcd | | `helmController` | Server | Extra arguments for the Helm controller | ### runtime Container runtime settings. Applied to both server and agent nodes. | Key | Description | |---|---| | `systemDefaultRegistry` | Default registry for all system images, for example `"registry.example.com"` | | `pauseImage` | Override the pause container image | | `snapshotter` | Containerd snapshotter, for example `"stargz"` | | `defaultRuntime` | Default container runtime, for example `"nvidia"` | | `resolvConf` | Path to a custom `resolv.conf` for containers, for example `"/etc/k3s-resolv.conf"` | | `containerRuntimeEndpoint` | CRI endpoint for the container runtime, for example `"unix:///run/containerd/containerd.sock"` | | `imageServiceEndpoint` | CRI endpoint for the image service, for example `"unix:///run/containerd/containerd.sock"` | ### embeddedRegistry Enable the built-in Spegel distributed container registry. Server-only. | Key | Description | |---|---| | `enabled` | Enable the embedded Spegel distributed registry for peer-to-peer image sharing | | `disableDefaultRegistryEndpoint` | Disable the default network endpoint for the embedded registry | When enabled, K3s runs a built-in registry that distributes container images across cluster nodes using peer-to-peer replication instead of pulling from an external registry for every node. ### imageCredentialProvider Kubelet image credential provider for authenticating with private container registries. Applied to both server and agent nodes. | Key | Description | |---|---| | `binDir` | Directory containing credential provider plugin binaries (required) | | `config` | Path to the credential provider configuration file (required) | Both `binDir` and `config` must be set together. K3s passes them as `--image-credential-provider-bin-dir` and `--image-credential-provider-config`. ### localStorage Local-path provisioner settings. Server-only. | Key | Description | |---|---| | `path` | Storage path used by the built-in local-path provisioner, for example `"/opt/local-path-provisioner"` | ### etcdAdvanced Advanced etcd tuning options. Server-only. | Key | Description | |---|---| | `exposeMetrics` | Expose etcd metrics to the `/metrics` endpoint | | `disableSnapshots` | Disable automatic etcd snapshots | | `snapshotName` | Name prefix for etcd snapshots | | `snapshotReconcileInterval` | Interval for snapshot reconciliation, for example `"5m"` | ### agent Agent-specific settings. Applied only to agent nodes. | Key | Description | |---|---| | `lbServerPort` | Port for the agent load balancer that fronts the control plane (0–65535) | ## Options `spec.options` controls how `k3sctl` performs disruptive operations. ### Drain `drain` controls how nodes are drained during upgrades and reconfiguration. ```yaml spec: options: drain: enabled: true timeout: 5m gracePeriod: -1 ignoreDaemonSets: true deleteEmptyDirData: true disableEviction: false ``` | Key | Description | |---|---| | `enabled` | Drain nodes before restarting them (default `true`) | | `timeout` | Drain timeout (default `5m`) | | `gracePeriod` | Grace period passed to `kubectl drain` (default `-1`) | | `ignoreDaemonSets` | Ignore DaemonSet pods when draining (default `true`) | | `deleteEmptyDirData` | Delete `emptyDir` data when draining (default `true`) | | `disableEviction` | Force delete pods instead of evicting them (default `false`) | ### Concurrency ```yaml spec: options: concurrency: limit: 30 uploads: 5 ``` | Key | Description | |---|---| | `limit` | Maximum number of hosts to process in parallel (default `30`) | | `uploads` | Maximum number of concurrent file uploads (default `5`) | ### Evict taint ```yaml spec: options: evictTaint: enabled: false ``` | Key | Description | |---|---| | `enabled` | Taint nodes before eviction during disruptive operations (default `false`) | ## Additional manifests Any other YAML documents in the configuration file are applied to the cluster after installation. Separate them with `---`: ```yaml # ... Cluster document ... --- apiVersion: v1 kind: ConfigMap metadata: name: example data: key: value ``` Each document must be a valid Kubernetes manifest. `k3sctl` passes them to `kubectl apply` on the server node. --- --- url: /docs/k3sctl/commands.md description: The k3sctl CLI — apply, reset, kubeconfig, restore, config, init, and more. --- # Commands | Command | Description | |---|---| | `k3sctl apply` | Install or update the cluster | | `k3sctl reset` | Remove K3s from the hosts | | `k3sctl kubeconfig` | Print the admin kubeconfig | | `k3sctl restore` | Restore the cluster from an etcd snapshot | | `k3sctl config diff` | Show differences between desired config and actual cluster state | | `k3sctl config validate` | Validate a cluster configuration file | | `k3sctl init` | Print a configuration template | | `k3sctl version` | Print version information | | `k3sctl completion` | Print a shell completion script | ## Global flags | Flag | Description | |---|---| | `--debug` | Enable debug logging | | `--trace` | Enable trace logging | | `--no-redact` | Do not redact sensitive values from output | ## apply `apply` reconciles the cluster with the configuration file. It is idempotent: re-running it only changes what drifted. ```sh k3sctl apply --config k3sctl.yaml ``` | Flag | Description | |---|---| | `--dry-run` | Show what would change without changing it | | `--no-wait` | Do not wait for the cluster to become ready | | `--no-drain` | Skip node draining during the operation | | `--restore-from` | Restore an etcd snapshot before applying | | `--kubeconfig-out` | Write the admin kubeconfig to a file | | `--kubeconfig-api-address` | Override the API address in the kubeconfig | | `--kubeconfig-user` | Override the user in the kubeconfig | | `--kubeconfig-cluster` | Override the cluster name in the kubeconfig | | `--concurrency` | Number of hosts to operate on concurrently | | `--concurrent-uploads` | Number of concurrent file uploads | | `--disable-downgrade-check` | Allow installing an older K3s version | | `--force` | Skip confirmation prompts | ## restore `restore` stops K3s, resets etcd state, and restores the cluster from a snapshot. It prompts for confirmation unless `--force` is given. ```sh k3sctl restore --config k3sctl.yaml --from /path/to/snapshot.db ``` | Flag | Description | |---|---| | `--from` / `-f` | Path to the etcd snapshot to restore from (required) | | `--force` | Skip the confirmation prompt | ## config `config` groups configuration-only commands that do not change the cluster. ### diff Preview what `apply` would change by comparing the desired configuration with the actual cluster state. ```sh k3sctl config diff --config k3sctl.yaml ``` ### validate Validate a configuration file without connecting to any host. ```sh k3sctl config validate --config k3sctl.yaml ``` ## Common workflows ### Generate a config Single-node localhost (no SSH): ```sh k3sctl init --localhost --name dev > k3sctl.yaml ``` Multi-node with a server and an agent: ```sh k3sctl init --name demo --address 10.0.0.1 --agent --agent-address 10.0.0.2 > k3sctl.yaml ``` When `version` is left empty in the generated config, `k3sctl` automatically resolves the latest stable K3s release. ### Create a cluster ```sh k3sctl apply --config k3sctl.yaml k3sctl kubeconfig --config k3sctl.yaml > kubeconfig.yaml export KUBECONFIG="$PWD/kubeconfig.yaml" kubectl get nodes ``` `k3sctl` handles `sudo` internally — do not prefix commands with `sudo`. ### Validate and preview before applying ```sh k3sctl config validate --config k3sctl.yaml k3sctl config diff --config k3sctl.yaml k3sctl apply --config k3sctl.yaml --dry-run ``` ### Upgrade K3s Edit the `version` in `k3sctl.yaml`, then: ```sh k3sctl config diff --config k3sctl.yaml k3sctl apply --config k3sctl.yaml ``` `k3sctl` performs a rolling upgrade with drain/cordon. ### Restore etcd ```sh k3sctl restore --config k3sctl.yaml --from /path/to/snapshot.db ``` Snapshots are scheduled with the `etcdSnapshots` configuration block; see [Configuration](./configuration.md) for scheduling, S3 upload, and pruning. ### Tear the cluster down ```sh k3sctl reset --config k3sctl.yaml ``` For step-by-step guides covering single-node, multi-node, and HA topologies, see [Quick Start](./quick-start.md). ## version and completion ```sh k3sctl version k3sctl completion bash k3sctl completion zsh ``` --- --- url: /docs/mssql-mcp-go.md description: >- A read-only Model Context Protocol server for Microsoft SQL Server, written in Go, with 70+ tools for schema, data, performance, security, and migration analysis. --- # mssql-mcp-go `mssql-mcp-go` is a **read-only** [Model Context Protocol](https://modelcontextprotocol.io) (MCP) server for Microsoft SQL Server, written in Go. It gives AI assistants safe, structured access to your databases for schema exploration, data profiling, query analysis, migration planning, and more. ## Why read-only Every query is validated before execution. `INSERT`, `UPDATE`, `DELETE`, `DROP`, `ALTER`, `CREATE`, `TRUNCATE`, and other mutating statements are rejected before they reach the database. Stored procedures and functions are analyzed statically and never executed. That makes the server safe to hand to an assistant that needs to understand a production database without being able to change it. ## Features * **Read-only by design** — mutating SQL is blocked by a validator. * **70+ tools** covering schema discovery, data profiling, performance analysis, security auditing, migration assessment, and monitoring. * **Always Encrypted support** — client-side column decryption with a local PFX certificate. * **Connection pooling** with configurable limits and automatic cleanup. * **Stdio transport** for Claude Desktop, Cline, and other MCP clients. * **Single binary** for Linux, macOS, and Windows, plus a multi-arch container image. ## Quick start Set the connection with environment variables (they always override the config file), then run the server: ```sh export SQLSERVER_HOST=localhost export SQLSERVER_PORT=1433 export SQLSERVER_USER=readonly_user export SQLSERVER_PASSWORD=secret export SQLSERVER_DATABASE=MyDatabase mssql-mcp-go ``` The server starts on stdio by default and waits for an MCP client to connect. See [Configuration](./configuration.md) for `config.yaml` and client setup, and [Tools](./tools.md) for the full tool list. ## Architecture ``` mssql-mcp-go/ cmd/server/ Entry point internal/ adapters/mcp/ MCP protocol, tool registration mssql/ Service layer (queries, analysis) db/ Connection pool, query execution, encryption infrastructure/ Config, logging pkg/version/ Build version info ``` The server registers all tools with the MCP SDK and forwards tool calls to the SQL Server service layer. Every statement passes through the read-only validator first. ## Next steps * [Installation](./installation.md) * [Configuration](./configuration.md) * [Tools](./tools.md) --- --- url: /docs/mssql-mcp-go/installation.md description: Install mssql-mcp-go with Homebrew, a release binary, Docker, or from source. --- # Installation ## Homebrew (macOS / Linux) ```sh brew install nirantarasi/tap/mssql-mcp-go ``` ## Download a binary Pre-built binaries for Linux, macOS, and Windows (`amd64` / `arm64`) are published with every [GitHub release](https://github.com/nirantarasi/mssql-mcp-go/releases). ```sh # Example: the latest release for macOS arm64 curl -LO https://github.com/nirantarasi/mssql-mcp-go/releases/latest/download/mssql-mcp-go_darwin_arm64.tar.gz tar xzf mssql-mcp-go_darwin_arm64.tar.gz sudo mv mssql-mcp-go /usr/local/bin/ ``` ## Docker ```sh docker pull ghcr.io/nirantarasi/mssql-mcp-go:latest docker run --rm \ -e SQLSERVER_HOST=host.docker.internal \ -e SQLSERVER_PORT=1433 \ -e SQLSERVER_USER=readonly_user \ -e SQLSERVER_PASSWORD=secret \ -e SQLSERVER_DATABASE=MyDatabase \ ghcr.io/nirantarasi/mssql-mcp-go:latest ``` ## Build from source Requires Go 1.25 or newer. ```sh git clone https://github.com/nirantarasi/mssql-mcp-go.git cd mssql-mcp-go go build -o dist/mssql-mcp-go ./cmd/server ``` The binary is written to `dist/mssql-mcp-go`. ## Configure and run The server reads `config.yaml` or environment variables. To start from the example file: ```sh cp config.yaml.example config.yaml # edit config.yaml with your database credentials mssql-mcp-go ``` The default transport is stdio, so the process waits for an MCP client on standard input. See [Configuration](./configuration.md) for every option and the Claude Desktop and Cline snippets. --- --- url: /docs/mssql-mcp-go/configuration.md description: >- Configure mssql-mcp-go with config.yaml or environment variables, and connect it to Claude Desktop, Cline, or Docker. --- # Configuration The server reads settings from a `config.yaml` file or from environment variables. **Environment variables always override the file**, which makes secrets easy to inject at runtime. ## config.yaml Start from `config.yaml.example`: ```yaml database: host: "localhost" port: 1433 user: "readonly_user" password: "" # prefer SQLSERVER_PASSWORD database: "MyDatabase" encrypt: "true" # true, false, or disable trust_server_certificate: false connection_timeout: 30 # Always Encrypted: client-side column decryption with a local PFX. encryption: enabled: false key_path: "" # absolute path to the .pfx file key_password: "" # prefer SQLSERVER_ALWAYS_ENCRYPTED_KEY_PASSWORD query: max_length: 5000 # max characters per query max_rows: 1000 # max rows returned timeout: 30s # per-query timeout pool: max_open_conns: 10 max_idle_conns: 5 conn_max_lifetime: 1h logging: level: "info" # debug, info, warn, error format: "json" # json, text mcp: transport: "stdio" # stdio or http port: 9090 ``` ## Environment variables | Variable | Description | |---|---| | `SQLSERVER_HOST` | Database host | | `SQLSERVER_PORT` | Database port (default `1433`) | | `SQLSERVER_USER` | Database user | | `SQLSERVER_PASSWORD` | Database password | | `SQLSERVER_DATABASE` | Database name | | `SQLSERVER_ENCRYPT` | Encryption mode (default `true`) | | `SQLSERVER_TRUST_SERVER_CERTIFICATE` | Trust self-signed certificates | | `SQLSERVER_CONNECTION_TIMEOUT` | Connection timeout in seconds | | `SQLSERVER_ALWAYS_ENCRYPTED_KEY_PATH` | Path to the PFX certificate | | `SQLSERVER_ALWAYS_ENCRYPTED_KEY_PASSWORD` | PFX certificate password | | `QUERY_MAX_LENGTH` | Maximum query length | | `QUERY_MAX_ROWS` | Maximum result rows | | `QUERY_TIMEOUT_SECONDS` | Per-query timeout | | `LOG_LEVEL` | Log level | | `LOG_FORMAT` | Log format | | `CONFIG_PATH` | Path to `config.yaml` | ## MCP client integration ### Claude Desktop Add the server to `claude_desktop_config.json`: ```json { "mcpServers": { "mssql": { "command": "mssql-mcp-go", "env": { "SQLSERVER_HOST": "localhost", "SQLSERVER_PORT": "1433", "SQLSERVER_USER": "readonly_user", "SQLSERVER_PASSWORD": "secret", "SQLSERVER_DATABASE": "MyDatabase", "SQLSERVER_ENCRYPT": "disable" } } } } ``` If you installed with Homebrew, the binary is already on your `PATH`. Otherwise, use its full path. ### Claude Desktop with Docker ```json { "mcpServers": { "mssql": { "command": "docker", "args": [ "run", "--rm", "-i", "-e", "SQLSERVER_HOST=host.docker.internal", "-e", "SQLSERVER_PORT=1433", "-e", "SQLSERVER_USER=readonly_user", "-e", "SQLSERVER_PASSWORD=secret", "-e", "SQLSERVER_DATABASE=MyDatabase", "ghcr.io/nirantarasi/mssql-mcp-go:latest" ] } } } ``` ### Cline (VS Code) Add the server to your Cline MCP settings: ```json { "mssql": { "command": "mssql-mcp-go", "env": { "SQLSERVER_HOST": "localhost", "SQLSERVER_PORT": "1433", "SQLSERVER_USER": "readonly_user", "SQLSERVER_PASSWORD": "secret", "SQLSERVER_DATABASE": "MyDatabase" } } } ``` ## Security notes * Use a login that only has read permissions on the databases the assistant should see. * Prefer environment variables over committing credentials to `config.yaml`. * TLS is on by default (`encrypt: true`). Set `trust_server_certificate: false` unless you are connecting to a server with a self-signed certificate. * Always Encrypted columns are decrypted client-side with the PFX you provide; the key never leaves the machine running the server. --- --- url: /docs/mssql-mcp-go/tools.md description: All tools exposed by mssql-mcp-go, grouped by what they help you do. --- # Tools Every tool below issues read-only catalog queries or validated `SELECT` / `WITH` statements. Mutating SQL is rejected before execution. ## Core query | Tool | Description | |---|---| | `execute_query` | Run a read-only `SELECT` / `WITH` query | | `health_check` | Check connectivity and connection-pool stats | ## Database discovery | Tool | Description | |---|---| | `list_databases` | List accessible databases | | `list_schemas` | List schemas in the current database | | `list_tables` | List tables with row and column counts | | `describe_table` | Columns, keys, and indexes of a table | | `list_columns` | Columns with types and nullability | | `describe_column` | Detailed metadata for a single column | | `table_row_count` | Row count from catalog metadata | ## Relationships and keys | Tool | Description | |---|---| | `table_relationships` | Outbound and inbound foreign keys | | `list_foreign_keys` | Foreign-key constraints, optionally by schema | | `list_primary_keys` | Primary-key constraints, optionally by schema | | `foreign_key_graph` | Full foreign-key graph as nodes and edges | | `list_unique_constraints` | Unique constraints by schema | | `list_check_constraints` | Check constraints by schema | | `list_default_constraints` | Default constraints by schema | ## Stored procedures | Tool | Description | |---|---| | `list_procedures` | List stored procedures | | `get_procedure_definition` | Full T-SQL definition and parameters | | `search_procedures` | Search definitions by keyword | | `analyze_stored_procedure` | Static analysis: tables, views, transactions, and more | | `extract_tables_used` | Tables referenced by a procedure | | `extract_views_used` | Views referenced by a procedure | | `extract_functions_used` | Functions referenced by a procedure | | `extract_called_procedures` | Procedures called with `EXEC` | | `extract_transaction_usage` | Transaction-control usage | | `extract_dynamic_sql` | Dynamic SQL detection | | `extract_cursor_usage` | Cursor declarations | | `extract_temp_tables` | Temp-table usage | | `extract_error_handling` | Error-handling constructs | | `extract_validation_rules` | Validation rules | | `extract_business_rules` | Business-rule comments | ## Views | Tool | Description | |---|---| | `list_views` | List all views | | `get_view_definition` | Definition of a view | | `analyze_view` | Columns and referenced objects | | `trace_view_sources` | Resolve underlying base tables | | `extract_view_dependencies` | Objects a view depends on | ## Functions | Tool | Description | |---|---| | `list_functions` | Scalar, inline, and table-valued functions | | `get_function_definition` | Definition and parameters | | `analyze_function` | Static analysis | | `trace_function_usage` | Objects referencing the function | | `extract_function_dependencies` | Objects a function depends on | ## Triggers | Tool | Description | |---|---| | `list_triggers` | DML triggers with their tables | | `get_trigger_definition` | Definition of a trigger | | `analyze_trigger` | Static analysis | ## Dependencies and search | Tool | Description | |---|---| | `find_object_dependencies` | Objects an object depends on | | `find_object_references` | Objects that reference an object | | `find_table_usage` | All objects referencing a table | | `search_objects_by_keyword` | Search names and definitions | | `generate_erd` | Entity-relationship description | | `dependency_graph` | Recursive dependency graph | | `find_column_usage` | Modules referencing a column | | `find_unused_tables` | Tables with no references | | `find_unused_columns` | Columns with no tracked references | | `find_orphan_tables` | Tables with no foreign-key connections | | `find_circular_dependencies` | Cycles in the foreign-key graph | | `search_tables` | Tables matching a keyword | | `search_columns` | Columns matching a keyword | | `search_views` | Views matching a keyword | | `search_functions` | Functions matching a keyword | ## Data profiling | Tool | Description | |---|---| | `table_statistics` | Row count, column count, and storage stats | | `column_statistics` | Min, max, distinct, and null statistics | | `column_distinct_values` | Top distinct values with frequencies | | `column_null_analysis` | Null count and percentage | | `data_distribution` | Value-frequency distribution | | `sample_table_data` | Sample rows from a table | | `find_duplicate_rows` | Duplicate groups by columns | | `find_candidate_keys` | Single-column candidate-key detection | ## Performance analysis | Tool | Description | |---|---| | `explain_query` | Estimated execution plan | | `estimate_query_cost` | Estimated subtree cost | | `analyze_execution_plan` | Plan with an operator summary | | `find_missing_indexes` | Optimizer-recommended indexes | | `find_unused_indexes` | Indexes that are never read | | `find_fragmented_indexes` | High-fragmentation indexes | | `index_usage_report` | Read and write stats for all indexes | | `slow_query_analysis` | Most expensive cached queries | | `query_performance_report` | Aggregate query stats | ## Security analysis | Tool | Description | |---|---| | `list_logins` | Server-level logins | | `list_users` | Database-level users | | `list_roles` | Database roles | | `list_permissions` | Database permission grants | | `user_permissions` | Permissions for a specific user | | `role_memberships` | Role-membership graph | | `object_permissions` | Permissions on a specific object | ## Migration assessment | Tool | Description | |---|---| | `database_overview` | High-level object counts | | `database_health_report` | Health indicators | | `database_complexity_report` | Structural complexity metrics | | `analyze_database_for_migration` | Comprehensive migration assessment | | `migration_complexity_score` | Weighted complexity score | | `migration_priority_order` | Dependency-based migration order | | `high_risk_objects` | Modules with risky constructs | | `large_table_analysis` | Largest tables by storage | | `legacy_object_analysis` | Stale or legacy objects | | `deprecated_feature_detection` | Deprecated-feature scan | ## Monitoring | Tool | Description | |---|---| | `connection_pool_stats` | Connection-pool statistics | | `database_size_report` | Data and log file sizes | | `table_growth_report` | Largest tables by size | --- --- url: /docs/postgres-mcp-go.md description: >- A read-only Model Context Protocol server for PostgreSQL, written in Go, with 70+ tools for schema, data, performance, security, and migration analysis. --- # postgres-mcp-go `postgres-mcp-go` is a **read-only** [Model Context Protocol](https://modelcontextprotocol.io) (MCP) server for PostgreSQL, written in Go. It gives AI assistants safe, structured access to your databases for schema exploration, data profiling, query analysis, migration planning, and more. ## Why read-only Every query is validated before execution. `INSERT`, `UPDATE`, `DELETE`, `DROP`, `ALTER`, `CREATE`, `TRUNCATE`, and other mutating statements are rejected before they reach the database. Stored procedures and functions are analyzed statically and never executed. That makes the server safe to hand to an assistant that needs to understand a production database without being able to change it. ## Features * **Read-only by design** — mutating SQL is blocked by a validator. * **70+ tools** covering schema discovery, data profiling, performance analysis, security auditing, migration assessment, and monitoring. * **Connection pooling** with configurable limits and automatic cleanup. * **Stdio transport** for Claude Desktop, Cline, and other MCP clients. * **Single binary** for Linux, macOS, and Windows, plus a multi-arch container image. ## Quick start Set the connection with environment variables (they always override the config file), then run the server: ```sh export POSTGRES_HOST=localhost export POSTGRES_PORT=5432 export POSTGRES_USER=readonly_user export POSTGRES_PASSWORD=secret export POSTGRES_DB=mydb postgres-mcp-go ``` The server starts on stdio by default and waits for an MCP client to connect. See [Configuration](./configuration.md) for `config.yaml` and client setup, and [Tools](./tools.md) for the full tool list. ## Architecture ``` postgres-mcp-go/ cmd/server/ Entry point internal/ adapters/mcp/ MCP protocol, tool registration postgres/ Service layer (queries, analysis) db/ Connection pool, query execution infrastructure/ Config, logging pkg/version/ Build version info ``` The server registers all tools with the MCP SDK and forwards tool calls to the PostgreSQL service layer. Every statement passes through the read-only validator first. ## Next steps * [Installation](./installation.md) * [Configuration](./configuration.md) * [Tools](./tools.md) --- --- url: /docs/postgres-mcp-go/installation.md description: >- Install postgres-mcp-go with Homebrew, a release binary, Docker, or from source. --- # Installation ## Homebrew (macOS / Linux) ```sh brew install nirantarasi/tap/postgres-mcp-go ``` ## Download a binary Pre-built binaries for Linux, macOS, and Windows (`amd64` / `arm64`) are published with every [GitHub release](https://github.com/nirantarasi/postgres-mcp-go/releases). ```sh # Example: the latest release for macOS arm64 curl -LO https://github.com/nirantarasi/postgres-mcp-go/releases/latest/download/postgres-mcp-go_darwin_arm64.tar.gz tar xzf postgres-mcp-go_darwin_arm64.tar.gz sudo mv postgres-mcp-go /usr/local/bin/ ``` ## Docker ```sh docker pull ghcr.io/nirantarasi/postgres-mcp-go:latest docker run --rm \ -e POSTGRES_HOST=host.docker.internal \ -e POSTGRES_PORT=5432 \ -e POSTGRES_USER=readonly_user \ -e POSTGRES_PASSWORD=secret \ -e POSTGRES_DB=mydb \ ghcr.io/nirantarasi/postgres-mcp-go:latest ``` ## Build from source Requires Go 1.27 or newer. ```sh git clone https://github.com/nirantarasi/postgres-mcp-go.git cd postgres-mcp-go go build -o dist/postgres-mcp-go ./cmd/server ``` The binary is written to `dist/postgres-mcp-go`. ## Configure and run The server reads `config.yaml` or environment variables. To start from the example file: ```sh cp config.yaml.example config.yaml # edit config.yaml with your database credentials postgres-mcp-go ``` The default transport is stdio, so the process waits for an MCP client on standard input. See [Configuration](./configuration.md) for every option and the Claude Desktop and Cline snippets. --- --- url: /docs/postgres-mcp-go/configuration.md description: >- Configure postgres-mcp-go with config.yaml or environment variables, and connect it to Claude Desktop, Cline, or Docker. --- # Configuration The server reads settings from a `config.yaml` file or from environment variables. **Environment variables always override the file**, which makes secrets easy to inject at runtime. ## config.yaml Start from `config.yaml.example`: ```yaml database: host: "localhost" port: 5432 user: "readonly_user" password: "" # prefer POSTGRES_PASSWORD database: "postgres" ssl_mode: "require" # disable, allow, prefer, require, verify-ca, verify-full search_path: "public" connection_timeout: 30 query: max_length: 5000 # max characters per query max_rows: 1000 # max rows returned timeout: 30s # per-query timeout pool: max_open_conns: 10 max_idle_conns: 5 conn_max_lifetime: 1h logging: level: "info" # debug, info, warn, error format: "json" # json, text file: "" # optional log file path mcp: transport: "stdio" # stdio or http port: 9090 ``` ## Environment variables | Variable | Description | |---|---| | `POSTGRES_HOST` | Database host | | `POSTGRES_PORT` | Database port (default `5432`) | | `POSTGRES_USER` | Database user | | `POSTGRES_PASSWORD` | Database password | | `POSTGRES_DB` | Database name | | `POSTGRES_SSL_MODE` | TLS mode (default `require`) | | `POSTGRES_SEARCH_PATH` | Default schema (default `public`) | | `POSTGRES_CONNECTION_TIMEOUT` | Connection timeout in seconds | | `QUERY_MAX_LENGTH` | Maximum query length | | `QUERY_MAX_ROWS` | Maximum result rows | | `QUERY_TIMEOUT_SECONDS` | Per-query timeout | | `LOG_LEVEL` | Log level | | `LOG_FORMAT` | Log format | | `LOG_FILE` | Log file path | | `CONFIG_PATH` | Path to `config.yaml` | ## MCP client integration ### Claude Desktop Add the server to `claude_desktop_config.json`: ```json { "mcpServers": { "postgres": { "command": "postgres-mcp-go", "env": { "POSTGRES_HOST": "localhost", "POSTGRES_PORT": "5432", "POSTGRES_USER": "readonly_user", "POSTGRES_PASSWORD": "secret", "POSTGRES_DB": "mydb", "POSTGRES_SSL_MODE": "disable" } } } } ``` If you installed with Homebrew, the binary is already on your `PATH`. Otherwise, use its full path. ### Claude Desktop with Docker ```json { "mcpServers": { "postgres": { "command": "docker", "args": [ "run", "--rm", "-i", "-e", "POSTGRES_HOST=host.docker.internal", "-e", "POSTGRES_PORT=5432", "-e", "POSTGRES_USER=readonly_user", "-e", "POSTGRES_PASSWORD=secret", "-e", "POSTGRES_DB=mydb", "ghcr.io/nirantarasi/postgres-mcp-go:latest" ] } } } ``` ### Cline (VS Code) Add the server to your Cline MCP settings: ```json { "postgres": { "command": "postgres-mcp-go", "env": { "POSTGRES_HOST": "localhost", "POSTGRES_PORT": "5432", "POSTGRES_USER": "readonly_user", "POSTGRES_PASSWORD": "secret", "POSTGRES_DB": "mydb" } } } ``` ## Security notes * Use a role that only has read permissions on the databases the assistant should see. * Prefer environment variables over committing credentials to `config.yaml`. * TLS is on by default (`ssl_mode: require`). Use `verify-full` in production, and reserve `disable` for trusted local networks. * Set `search_path` when the objects live outside `public`, so unqualified names resolve as expected. --- --- url: /docs/postgres-mcp-go/tools.md description: All tools exposed by postgres-mcp-go, grouped by what they help you do. --- # Tools Every tool below issues read-only catalog queries or validated `SELECT` / `WITH` statements. Mutating SQL is rejected before execution. ## Core query | Tool | Description | |---|---| | `execute_query` | Run a read-only `SELECT` / `WITH` query | | `health_check` | Check connectivity and connection-pool stats | ## Database discovery | Tool | Description | |---|---| | `list_databases` | List accessible databases | | `list_schemas` | List schemas in the current database | | `list_tables` | List tables with row and column counts | | `describe_table` | Columns, keys, and indexes of a table | | `list_columns` | Columns with types and nullability | | `describe_column` | Detailed metadata for a single column | | `table_row_count` | Row count from catalog metadata | ## Relationships and keys | Tool | Description | |---|---| | `table_relationships` | Outbound and inbound foreign keys | | `list_foreign_keys` | Foreign-key constraints, optionally by schema | | `list_primary_keys` | Primary-key constraints, optionally by schema | | `foreign_key_graph` | Full foreign-key graph as nodes and edges | | `list_unique_constraints` | Unique constraints by schema | | `list_check_constraints` | Check constraints by schema | | `list_default_constraints` | Default constraints by schema | ## Stored procedures | Tool | Description | |---|---| | `list_procedures` | List stored procedures | | `get_procedure_definition` | Full T-SQL definition and parameters | | `search_procedures` | Search definitions by keyword | | `analyze_stored_procedure` | Static analysis: tables, views, transactions, and more | | `extract_tables_used` | Tables referenced by a procedure | | `extract_views_used` | Views referenced by a procedure | | `extract_functions_used` | Functions referenced by a procedure | | `extract_called_procedures` | Procedures called with `EXEC` | | `extract_transaction_usage` | Transaction-control usage | | `extract_dynamic_sql` | Dynamic SQL detection | | `extract_cursor_usage` | Cursor declarations | | `extract_temp_tables` | Temp-table usage | | `extract_error_handling` | Error-handling constructs | | `extract_validation_rules` | Validation rules | | `extract_business_rules` | Business-rule comments | ## Views | Tool | Description | |---|---| | `list_views` | List all views | | `get_view_definition` | Definition of a view | | `analyze_view` | Columns and referenced objects | | `trace_view_sources` | Resolve underlying base tables | | `extract_view_dependencies` | Objects a view depends on | ## Functions | Tool | Description | |---|---| | `list_functions` | Scalar, inline, and table-valued functions | | `get_function_definition` | Definition and parameters | | `analyze_function` | Static analysis | | `trace_function_usage` | Objects referencing the function | | `extract_function_dependencies` | Objects a function depends on | ## Triggers | Tool | Description | |---|---| | `list_triggers` | DML triggers with their tables | | `get_trigger_definition` | Definition of a trigger | | `analyze_trigger` | Static analysis | ## Dependencies and search | Tool | Description | |---|---| | `find_object_dependencies` | Objects an object depends on | | `find_object_references` | Objects that reference an object | | `find_table_usage` | All objects referencing a table | | `search_objects_by_keyword` | Search names and definitions | | `generate_erd` | Entity-relationship description | | `dependency_graph` | Recursive dependency graph | | `find_column_usage` | Modules referencing a column | | `find_unused_tables` | Tables with no references | | `find_unused_columns` | Columns with no tracked references | | `find_orphan_tables` | Tables with no foreign-key connections | | `find_circular_dependencies` | Cycles in the foreign-key graph | | `search_tables` | Tables matching a keyword | | `search_columns` | Columns matching a keyword | | `search_views` | Views matching a keyword | | `search_functions` | Functions matching a keyword | ## Data profiling | Tool | Description | |---|---| | `table_statistics` | Row count, column count, and storage stats | | `column_statistics` | Min, max, distinct, and null statistics | | `column_distinct_values` | Top distinct values with frequencies | | `column_null_analysis` | Null count and percentage | | `data_distribution` | Value-frequency distribution | | `sample_table_data` | Sample rows from a table | | `find_duplicate_rows` | Duplicate groups by columns | | `find_candidate_keys` | Single-column candidate-key detection | ## Performance analysis | Tool | Description | |---|---| | `explain_query` | Estimated execution plan | | `estimate_query_cost` | Estimated subtree cost | | `analyze_execution_plan` | Plan with an operator summary | | `find_missing_indexes` | Optimizer-recommended indexes | | `find_unused_indexes` | Indexes that are never read | | `find_fragmented_indexes` | High-fragmentation indexes | | `index_usage_report` | Read and write stats for all indexes | | `slow_query_analysis` | Most expensive cached queries | | `query_performance_report` | Aggregate query stats | ## Security analysis | Tool | Description | |---|---| | `list_logins` | Server-level logins | | `list_users` | Database-level users | | `list_roles` | Database roles | | `list_permissions` | Database permission grants | | `user_permissions` | Permissions for a specific user | | `role_memberships` | Role-membership graph | | `object_permissions` | Permissions on a specific object | ## Migration assessment | Tool | Description | |---|---| | `database_overview` | High-level object counts | | `database_health_report` | Health indicators | | `database_complexity_report` | Structural complexity metrics | | `analyze_database_for_migration` | Comprehensive migration assessment | | `migration_complexity_score` | Weighted complexity score | | `migration_priority_order` | Dependency-based migration order | | `high_risk_objects` | Modules with risky constructs | | `large_table_analysis` | Largest tables by storage | | `legacy_object_analysis` | Stale or legacy objects | | `deprecated_feature_detection` | Deprecated-feature scan | ## Monitoring | Tool | Description | |---|---| | `connection_pool_stats` | Connection-pool statistics | | `database_size_report` | Data and log file sizes | | `table_growth_report` | Largest tables by size | --- --- url: /docs/omniroute-operator.md description: >- A Kubebuilder operator that deploys and manages OmniRoute — the unified AI proxy/router — on self-hosted Kubernetes. --- # omniroute-operator `omniroute-operator` is a Kubernetes operator built with [Kubebuilder](https://kubebuilder.io/) that deploys and manages [OmniRoute](https://github.com/diegosouzapw/OmniRoute), a unified AI proxy/router, in self-hosted Kubernetes environments. The operator watches `OmniRoute` custom resources and reconciles Deployments, Services, PersistentVolumeClaims, and Ingresses, so you get a managed OmniRoute instance from a single `kubectl apply`. ## Features * Declarative lifecycle via the `gateway.omniroute.ai/v1alpha1` CRD. * Automatic Deployment, Service, PVC, and Ingress reconciliation. * Credentials injected from existing Secrets. * Configuration injected from an existing ConfigMap with `envFrom`. * Auto-derived `NODE_OPTIONS` from memory limits to prevent OOM kills. * Configurable liveness, readiness, and startup probes. * Redis-backed rate limiting, from a URL or a Secret. * Database encryption at rest with `STORAGE_ENCRYPTION_KEY`. * Ingress with TLS, `className`, and annotations. * Reverse-proxy support through `basePath`. * Service annotations for cloud load balancers. * Persistence for OmniRoute's SQLite data directory. * Leader election for highly available operator deployments. * Multi-arch images (`linux/amd64`, `linux/arm64`) and a Helm chart. ## Prerequisites | Tool | Version | |---|---| | Kubernetes | >= 1.28 | | Helm | >= 3.12 | | kubectl | matching your cluster | For local development you also need k3d >= 5.6, Docker >= 24, and Go 1.27. ## How it works 1. You install the operator and its CRD into `omniroute-system`. 2. You create a Secret with OmniRoute's credentials and, optionally, a ConfigMap with environment settings. 3. You apply an `OmniRoute` resource in your application namespace. 4. The operator creates the Deployment, Service, PVC, and (when enabled) the Ingress, then reports readiness on the resource status. ## Deploy a first instance ```sh kubectl create secret generic omniroute-secrets \ --namespace ai-platform \ --from-literal=JWT_SECRET="$(openssl rand -base64 48)" \ --from-literal=API_KEY_SECRET="$(openssl rand -hex 32)" \ --from-literal=INITIAL_PASSWORD="changeme" kubectl apply -f config/samples/gateway_v1alpha1_omniroute.yaml kubectl wait --for=condition=available deployment/omniroute-sample \ --namespace ai-platform --timeout=120s ``` Then reach the UI: ```sh kubectl port-forward svc/omniroute-sample 20128:20128 -n ai-platform ``` Open `http://localhost:20128` and log in with the password from `INITIAL_PASSWORD`. ## Next steps * [Installation](./installation.md): install the operator with Helm. * [OmniRoute CR](./omniroute-cr.md): every field in the custom resource. * [Local development](./local-development.md): a k3d cluster on your machine. --- --- url: /docs/omniroute-operator/installation.md description: Install the omniroute-operator with Helm, then deploy an OmniRoute instance. --- # Installation The operator and the OmniRoute instances it manages are separate concerns. You install the operator once per cluster; each application namespace then gets one or more `OmniRoute` resources. ## Install the operator From the OCI registry: ```sh helm install omniroute-operator oci://ghcr.io/nirantarasi/helm-charts/omniroute-operator \ --namespace omniroute-system --create-namespace ``` Or from the chart in the repository: ```sh helm install omniroute-operator charts/omniroute-operator \ --namespace omniroute-system --create-namespace ``` Verify the controller is running: ```sh kubectl get pods -n omniroute-system ``` ## Helm values | Value | Default | Description | |---|---|---| | `replicaCount` | `1` | Operator pod replicas | | `image.repository` | `ghcr.io/nirantarasi/omniroute-operator` | Operator image | | `image.tag` | `""` (appVersion) | Operator image tag | | `leaderElection.enabled` | `true` | Enable leader election | | `resources.requests.cpu` | `10m` | CPU request | | `resources.requests.memory` | `64Mi` | Memory request | | `resources.limits.cpu` | `500m` | CPU limit | | `resources.limits.memory` | `128Mi` | Memory limit | ## Create the OmniRoute secrets OmniRoute requires three secrets: `JWT_SECRET`, `API_KEY_SECRET`, and `INITIAL_PASSWORD`. ```sh kubectl create secret generic omniroute-secrets \ --namespace ai-platform \ --from-literal=JWT_SECRET="$(openssl rand -base64 48)" \ --from-literal=API_KEY_SECRET="$(openssl rand -hex 32)" \ --from-literal=INITIAL_PASSWORD="changeme" ``` ## Optional: environment configuration All keys in the referenced ConfigMap are injected into the OmniRoute container as environment variables with `envFrom`: ```sh kubectl create configmap omniroute-config \ --namespace ai-platform \ --from-literal=PORT=20128 \ --from-literal=APP_LOG_LEVEL=info \ --from-literal=REQUIRE_API_KEY=false ``` ## Deploy an instance ```sh kubectl apply -f config/samples/gateway_v1alpha1_omniroute.yaml ``` Or apply a minimal resource inline: ```sh kubectl apply -f - <<'EOF' apiVersion: gateway.omniroute.ai/v1alpha1 kind: OmniRoute metadata: name: omniroute namespace: ai-platform spec: image: repository: diegosouzapw/omniroute tag: "3.8.51" replicas: 1 service: type: ClusterIP port: 20128 resources: requests: cpu: 250m memory: 512Mi limits: cpu: "1" memory: 1Gi credentials: existingSecret: omniroute-secrets config: existingConfigMap: omniroute-config persistence: enabled: true size: 1Gi EOF ``` Wait for the Deployment, then reach the UI: ```sh kubectl wait --for=condition=available deployment/omniroute \ --namespace ai-platform --timeout=120s kubectl port-forward svc/omniroute 20128:20128 -n ai-platform ``` Open `http://localhost:20128` and log in with `INITIAL_PASSWORD`. ## Expose OmniRoute The CR supports `ClusterIP`, `NodePort`, `LoadBalancer`, and Ingress. See [OmniRoute CR](./omniroute-cr.md) for the Service and Ingress fields, and the complete spec reference. ```yaml spec: ingress: enabled: true className: nginx host: omniroute.example.com annotations: cert-manager.io/cluster-issuer: letsencrypt-prod tls: secretName: omniroute-tls ``` ## Use the API OmniRoute exposes an OpenAI-compatible API: ```sh curl http://localhost:20128/v1/chat/completions \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-4o", "messages": [{"role": "user", "content": "Hello!"}] }' ``` ## Uninstall ```sh kubectl delete omniroute omniroute -n ai-platform helm uninstall omniroute-operator -n omniroute-system ``` --- --- url: /docs/omniroute-operator/omniroute-cr.md description: Reference for the gateway.omniroute.ai/v1alpha1 OmniRoute custom resource. --- # OmniRoute CR An `OmniRoute` resource describes one OmniRoute deployment. The operator reconciles a Deployment, Service, PVC, and optional Ingress from it. ```yaml apiVersion: gateway.omniroute.ai/v1alpha1 kind: OmniRoute metadata: name: omniroute namespace: ai-platform spec: image: repository: diegosouzapw/omniroute tag: "3.8.51" replicas: 1 service: type: ClusterIP port: 20128 credentials: existingSecret: omniroute-secrets config: existingConfigMap: omniroute-config persistence: enabled: true size: 1Gi ``` ## Core | Field | Type | Default | Description | |---|---|---|---| | `spec.image.repository` | string | `diegosouzapw/omniroute` | OmniRoute container image | | `spec.image.tag` | string | `3.8.51` | Image tag | | `spec.image.pullPolicy` | string | `IfNotPresent` | Image pull policy | | `spec.replicas` | int | `1` | Pod count (max 1 — SQLite is single-writer) | | `spec.resources` | ResourceRequirements | — | CPU and memory requests and limits | | `spec.env` | \[]EnvVar | — | Additional environment variables | ## Service | Field | Type | Default | Description | |---|---|---|---| | `spec.service.type` | string | `ClusterIP` | `ClusterIP`, `NodePort`, or `LoadBalancer` | | `spec.service.port` | int | `20128` | Service port | | `spec.service.annotations` | map\[string]string | — | Service annotations, for example for an AWS NLB | ## Configuration and credentials | Field | Type | Default | Description | |---|---|---|---| | `spec.config.existingConfigMap` | string | — | ConfigMap with OmniRoute environment variables (injected with `envFrom`) | | `spec.credentials.existingSecret` | string | — | Secret with `JWT_SECRET`, `API_KEY_SECRET`, and `INITIAL_PASSWORD` | ## Persistence | Field | Type | Default | Description | |---|---|---|---| | `spec.persistence.enabled` | bool | `true` | Create a PVC for the data directory | | `spec.persistence.size` | string | `1Gi` | PVC storage size | | `spec.persistence.storageClass` | string | cluster default | StorageClass name | | `spec.persistence.accessMode` | string | `ReadWriteOnce` | PVC access mode | ## Health probes | Field | Type | Default | Description | |---|---|---|---| | `spec.probes.livenessPath` | string | `/api/monitoring/health` | HTTP path for the liveness probe | | `spec.probes.readinessPath` | string | `/api/monitoring/health` | HTTP path for the readiness probe | | `spec.probes.startupPath` | string | `/api/monitoring/health` | HTTP path for the startup probe | The operator fills in sensible timing defaults for all three probes. ## Ingress | Field | Type | Default | Description | |---|---|---|---| | `spec.ingress.enabled` | bool | `false` | Create an Ingress resource | | `spec.ingress.className` | string | — | IngressClass name, such as `nginx` | | `spec.ingress.host` | string | — | Hostname for the Ingress rule | | `spec.ingress.tls.secretName` | string | — | TLS Secret name | | `spec.ingress.annotations` | map\[string]string | — | Ingress annotations | ## Redis (rate limiting) | Field | Type | Default | Description | |---|---|---|---| | `spec.redis.url` | string | — | Redis connection URL, such as `redis://redis:6379` | | `spec.redis.existingSecret` | string | — | Secret containing a `REDIS_URL` key | | `spec.redis.keyPrefix` | string | — | Redis key namespace prefix | ## Encryption (database at rest) | Field | Type | Default | Description | |---|---|---|---| | `spec.encryption.existingSecret` | string | — | Secret containing `STORAGE_ENCRYPTION_KEY` | | `spec.encryption.keyVersion` | string | — | Encryption key version, for key rotation | ## Reverse proxy | Field | Type | Default | Description | |---|---|---|---| | `spec.basePath` | string | — | Sets `OMNIROUTE_BASE_PATH`, for example `/omniroute` | ## Auto-derived environment variables The operator sets these from the resource, so you do not repeat them in `spec.env`: | Variable | Source | Description | |---|---|---| | `NODE_OPTIONS` | `spec.resources.limits.memory` | `--max-old-space-size=<75% of the memory limit in MB>` to prevent Node.js OOM kills | | `OMNIROUTE_BASE_PATH` | `spec.basePath` | Reverse-proxy base path | | `REDIS_URL` | `spec.redis.url` or the referenced Secret | Redis connection URL | | `REDIS_KEY_PREFIX` | `spec.redis.keyPrefix` | Redis key namespace prefix | | `STORAGE_ENCRYPTION_KEY` | `spec.encryption.existingSecret` | Database encryption key | | `STORAGE_ENCRYPTION_KEY_VERSION` | `spec.encryption.keyVersion` | Encryption key version | ## Status | Field | Description | |---|---| | `status.conditions` | Standard conditions describing reconciliation | | `status.readyReplicas` | Number of ready OmniRoute replicas | | `status.observedGeneration` | Generation last processed by the operator | | `status.phase` | High-level phase of the deployment | Check it with: ```sh kubectl get omniroute omniroute -n ai-platform -o yaml ``` --- --- url: /docs/omniroute-operator/local-development.md description: >- Run the omniroute-operator against a local k3d cluster, build images, and run the controller outside Kubernetes. --- # Local development You need Docker >= 24, k3d >= 5.6, Go 1.27, kubectl, and Helm >= 3.12. ## Build the operator ```sh go build -trimpath -o bin/manager ./cmd/ ./bin/manager --help ``` Cross-compile the Linux binaries used by the container image: ```sh CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -o dist/linux_amd64/manager ./cmd/ CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -trimpath -o dist/linux_arm64/manager ./cmd/ ``` ## Run the tests ```sh go test -short -timeout=120s ./... go test -race -short -timeout=120s ./... go vet ./... ``` Integration tests require Docker: ```sh INTEGRATION=1 go test -v -timeout=10m -tags=integration ./tests/integration/ ``` ## Create a local cluster ```sh k3d cluster create omniroute \ --port "20128:20128@server:0" \ --k3s-arg "--disable=traefik@server:0" kubectl apply -k config/k3d/infrastructure # namespaces kubectl apply -f config/crd/bases/ # OmniRoute CRD ``` ## Install the operator from source Build the image the same way the Dockerfile expects, import it into k3d, then install the chart with the local image: ```sh CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -trimpath -o dist/linux_amd64/manager ./cmd/ docker build -t omniroute-operator:dev . k3d image import omniroute-operator:dev -c omniroute helm install omniroute-operator charts/omniroute-operator \ --namespace omniroute-system \ --set image.repository=omniroute-operator \ --set image.tag=dev \ --set image.pullPolicy=IfNotPresent ``` Check the controller: ```sh kubectl get pods -n omniroute-system kubectl get crd omniroutes.gateway.omniroute.ai ``` ## Run the controller outside the cluster Useful when you want to debug reconciliation in your IDE. Install the CRD, then run the manager against your kubeconfig: ```sh kubectl apply -f config/crd/bases/ ./bin/manager --health-probe-bind-address=:8081 ``` ## Helm checks ```sh helm lint charts/omniroute-operator --strict helm template omniroute-operator charts/omniroute-operator \ --namespace omniroute-system > /tmp/omniroute-operator.yaml ``` ## Clean up ```sh k3d cluster delete omniroute ``` --- --- url: /agents.md description: >- A compact map of Nirantara's documentation, plus the details that are easiest to get wrong when generating configuration for k3sctl, the MCP servers, or the omniroute-operator. --- # Documentation for coding agents Nirantara maintains four open-source projects. The documentation below is organised per project, and every page is also available as raw Markdown by appending `.md` to its URL. The curated index is at [/llms.txt](/llms.txt) and the full corpus at [/llms-full.txt](/llms-full.txt). ## Where to look ### k3sctl Declarative K3s cluster lifecycle over SSH. * [Overview](./docs/k3sctl/index.md) * [Installation](./docs/k3sctl/installation.md) * [Configuration](./docs/k3sctl/configuration.md): the `Cluster` file, hosts, K3s settings, and drain options. * [Commands](./docs/k3sctl/commands.md): `apply`, `reset`, `kubeconfig`, `restore`, `config diff`, `config validate`, and the flags each accepts. ### mssql-mcp-go Read-only MCP server for Microsoft SQL Server. * [Overview](./docs/mssql-mcp-go/index.md) * [Installation](./docs/mssql-mcp-go/installation.md) * [Configuration](./docs/mssql-mcp-go/configuration.md): `config.yaml`, `SQLSERVER_*` variables, and client snippets. * [Tools](./docs/mssql-mcp-go/tools.md) ### postgres-mcp-go Read-only MCP server for PostgreSQL. * [Overview](./docs/postgres-mcp-go/index.md) * [Installation](./docs/postgres-mcp-go/installation.md) * [Configuration](./docs/postgres-mcp-go/configuration.md): `config.yaml`, `POSTGRES_*` variables, and client snippets. * [Tools](./docs/postgres-mcp-go/tools.md) ### omniroute-operator Kubernetes operator for OmniRoute. * [Overview](./docs/omniroute-operator/index.md) * [Installation](./docs/omniroute-operator/installation.md) * [OmniRoute CR](./docs/omniroute-operator/omniroute-cr.md): every field in `gateway.omniroute.ai/v1alpha1`. * [Local development](./docs/omniroute-operator/local-development.md) ## Details that are easy to get wrong ### k3sctl 1. Hosts must be Linux. `k3sctl` installs K3s and systemd units over SSH. 2. The configuration is `apiVersion: k3sctl.k3sproject.io/v1beta1`, `kind: Cluster`. 3. `spec.hosts[]` entries choose a `role` of `server` or `agent`. Servers are the default. 4. Extra YAML documents in the same file are applied after installation with `kubectl apply`. Separate them with `---`, and make each one a valid Kubernetes manifest. 5. `apply` is idempotent and only changes what drifted. `--dry-run` shows the plan without changing the cluster. 6. `reset` removes K3s from the hosts. It is not the same as deleting a namespace. ### MCP servers 1. Both servers are read-only. Mutating SQL is rejected before execution, and stored procedures are analysed, never run. 2. Environment variables override `config.yaml`; never assume the file wins. 3. The default transport is `stdio`, so an MCP client launches the binary rather than connecting to a port. 4. `mssql-mcp-go` uses `SQLSERVER_*` variables and `encrypt`/`ssl` options that are SQL Server specific. `postgres-mcp-go` uses `POSTGRES_*` variables and `ssl_mode` plus `search_path`. 5. The tool names and groups are the same across both servers, but the SQL dialect differs. Do not copy a T-SQL snippet into a PostgreSQL answer. ### omniroute-operator 1. The group and version are `gateway.omniroute.ai/v1alpha1`; the kind is `OmniRoute`. 2. `spec.replicas` is effectively capped at `1` because OmniRoute stores state in SQLite with a single writer. 3. Credentials come from an existing Secret with `JWT_SECRET`, `API_KEY_SECRET`, and `INITIAL_PASSWORD`. 4. `spec.ingress.enabled` defaults to `false`. Enable it explicitly and set `className`, `host`, and TLS if the instance must be public. 5. `spec.persistence.enabled` creates a PVC. Disabling it makes the instance ephemeral. 6. `NODE_OPTIONS` is derived from the memory limit; do not hardcode it in `spec.env` unless you need to override the derived value. --- --- url: /docs/k3sctl/quick-start.md description: >- Step-by-step guides for single-node, multi-node, and high-availability K3s clusters with k3sctl. --- # Quick Start This guide walks through three cluster topologies — pick the one that fits your use case. | Topology | Hosts | Best for | |---|---|---| | [Single-node (localhost)](#single-node-localhost) | 1 | Development, testing, CI | | [Multi-node (SSH)](#multi-node-ssh) | 2+ | Small production, staging | | [High availability (HA)](#high-availability-ha) | 3+ servers | Production with etcd redundancy | ## Single-node (localhost) Run a one-node K3s cluster on the machine where `k3sctl` is installed. No SSH is needed — `k3sctl` runs commands directly on the local host. ### Prerequisites * Linux machine with `k3sctl` [installed](./installation.md) * Root access or passwordless `sudo` ### Steps **1. Generate the config** ```sh k3sctl init --localhost --name dev > k3sctl.yaml ``` This produces a minimal config with `localhost: true` and no SSH block: ```yaml apiVersion: k3sctl.k3sproject.io/v1beta1 kind: Cluster metadata: name: dev spec: hosts: - localhost: true role: server k3s: version: "" ``` When `version` is left empty, `k3sctl` automatically resolves the latest stable K3s release. **2. Apply the cluster** ```sh k3sctl apply --config k3sctl.yaml ``` `k3sctl` handles `sudo` internally — do not prefix the command with `sudo`. **3. Get the kubeconfig** ```sh k3sctl kubeconfig --config k3sctl.yaml > kubeconfig.yaml export KUBECONFIG="$PWD/kubeconfig.yaml" kubectl get nodes ``` **4. Tear down (when done)** ```sh k3sctl reset --config k3sctl.yaml ``` *** ## Multi-node (SSH) A server node plus one or more agent (worker) nodes, connected over SSH. ### Prerequisites * 2+ Linux hosts reachable over SSH * SSH key-based authentication configured * Root or passwordless `sudo` on each host ### Steps **1. Generate the config** ```sh k3sctl init \ --name staging \ --address 10.0.0.1 \ --user root \ --key-path ~/.ssh/id_ed25519 \ --agent \ --agent-address 10.0.0.2 \ > k3sctl.yaml ``` This generates a config with one server and one agent: ```yaml apiVersion: k3sctl.k3sproject.io/v1beta1 kind: Cluster metadata: name: staging spec: hosts: - role: server ssh: address: 10.0.0.1 user: root port: 22 keyPath: ~/.ssh/id_ed25519 - role: agent ssh: address: 10.0.0.2 user: root port: 22 keyPath: ~/.ssh/id_ed25519 k3s: version: "" ``` To add more agents, duplicate the agent block with different addresses: ```yaml - role: agent ssh: address: 10.0.0.3 user: root port: 22 keyPath: ~/.ssh/id_ed25519 ``` **2. (Optional) Edit the config** ```sh $EDITOR k3sctl.yaml ``` Common changes: * Pin a K3s version: `version: "v1.31.0+k3s1"` * Disable traefik: add `installFlags: ["--disable=traefik"]` to the server * Add labels or taints to nodes **3. Validate the config** ```sh k3sctl config validate --config k3sctl.yaml ``` **4. Apply the cluster** ```sh k3sctl apply --config k3sctl.yaml ``` **5. Get the kubeconfig** ```sh k3sctl kubeconfig --config k3sctl.yaml > kubeconfig.yaml export KUBECONFIG="$PWD/kubeconfig.yaml" kubectl get nodes ``` You should see both the server and agent nodes in `Ready` state. **6. Tear down (when done)** ```sh k3sctl reset --config k3sctl.yaml ``` *** ## High availability (HA) Three or more server nodes with embedded etcd for fault tolerance. Agents are optional — server nodes can also run workloads. ### Prerequisites * 3+ Linux hosts for servers (use an odd number for etcd quorum: 3, 5, …) * Optional additional hosts for agents * SSH key-based authentication to all hosts * Root or passwordless `sudo` on each host ### Steps **1. Generate a starter config** ```sh k3sctl init --name production --address 10.0.0.1 > k3sctl.yaml ``` **2. Edit the config for HA** Open `k3sctl.yaml` and add the additional server and agent hosts: ```yaml apiVersion: k3sctl.k3sproject.io/v1beta1 kind: Cluster metadata: name: production spec: hosts: - role: server ssh: address: 10.0.0.1 user: root port: 22 keyPath: ~/.ssh/id_ed25519 installFlags: - --disable=traefik - role: server ssh: address: 10.0.0.2 user: root port: 22 keyPath: ~/.ssh/id_ed25519 installFlags: - --disable=traefik - role: server ssh: address: 10.0.0.3 user: root port: 22 keyPath: ~/.ssh/id_ed25519 installFlags: - --disable=traefik - role: agent ssh: address: 10.0.0.11 user: root port: 22 keyPath: ~/.ssh/id_ed25519 - role: agent ssh: address: 10.0.0.12 user: root port: 22 keyPath: ~/.ssh/id_ed25519 k3s: version: "v1.31.0+k3s1" etcdSnapshots: scheduled: true scheduleCron: "0 */6 * * *" retention: 5 compress: true healthCheck: enabled: true timeout: 120s options: drain: enabled: true timeout: 5m ``` Key points for HA: * Use 3 or 5 server nodes (odd numbers maintain etcd quorum) * K3s automatically initializes embedded etcd when it sees multiple servers * `k3sctl` joins servers sequentially in quorum-safe batches * Enable `etcdSnapshots` for automated backups * Enable `healthCheck` to verify all nodes are ready after apply * Enable `drain` for safe rolling upgrades **3. Validate and preview** ```sh k3sctl config validate --config k3sctl.yaml k3sctl apply --config k3sctl.yaml --dry-run ``` **4. Apply the cluster** ```sh k3sctl apply --config k3sctl.yaml ``` `k3sctl` will: 1. Connect to each host over SSH 2. Install K3s on the first server and initialize etcd 3. Join additional servers to the etcd cluster 4. Join agent nodes to the cluster 5. Run health checks to verify the cluster is ready **5. Get the kubeconfig** ```sh k3sctl kubeconfig --config k3sctl.yaml > kubeconfig.yaml export KUBECONFIG="$PWD/kubeconfig.yaml" kubectl get nodes ``` All server and agent nodes should show `Ready`. **6. Day-two operations** Upgrade K3s by changing `version` and re-running apply — `k3sctl` performs a rolling upgrade with drain/cordon: ```sh # Edit k3sctl.yaml and change the version k3sctl config diff --config k3sctl.yaml # preview the changes k3sctl apply --config k3sctl.yaml # rolling upgrade ``` Restore from an etcd snapshot if something goes wrong: ```sh k3sctl restore --config k3sctl.yaml --from /var/lib/rancher/k3s/server/db/snapshots/etcd-snapshot-xxx ``` **7. Tear down (when done)** ```sh k3sctl reset --config k3sctl.yaml ``` *** ## Next steps * [Configuration](./configuration.md): full reference for every option * [Commands](./commands.md): all CLI commands and flags * [Installation](./installation.md): other ways to install `k3sctl`