Skip to content

Commit f3b6edb

Browse files
committed
Initial commit
0 parents  commit f3b6edb

File tree

34 files changed

+4529
-0
lines changed

34 files changed

+4529
-0
lines changed

.github/workflows/build.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
paths-ignore:
8+
- '.gitignore'
9+
- 'LICENSE'
10+
- '*.md'
11+
pull_request:
12+
paths-ignore:
13+
- '.gitignore'
14+
- 'LICENSE'
15+
- '*.md'
16+
17+
concurrency:
18+
# Only run once for latest commit per ref and cancel other (previous) runs.
19+
group: ${{ github.workflow }}-${{ github.ref }}
20+
cancel-in-progress: true
21+
22+
env:
23+
GO_VERSION: 1.24.1
24+
25+
defaults:
26+
run:
27+
shell: bash
28+
29+
jobs:
30+
build:
31+
name: Build on ${{ matrix.os }}
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
os:
36+
- ubuntu-latest #x64
37+
- windows-latest #x64
38+
- macos-13 #x64
39+
- macos-latest #arm64
40+
runs-on: ${{ matrix.os }}
41+
steps:
42+
- name: Checkout
43+
uses: actions/checkout@v4
44+
- uses: actions/setup-go@v5
45+
with:
46+
go-version: ${{ env.GO_VERSION }}
47+
- name: Build
48+
run: make build
49+
- name: Test
50+
run: make test

.github/workflows/release.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
concurrency:
9+
# Only run once for latest commit per ref and cancel other (previous) runs.
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
env:
14+
GO_VERSION: 1.24
15+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
16+
17+
permissions:
18+
contents: write
19+
discussions: write
20+
21+
jobs:
22+
release:
23+
name: Release
24+
runs-on: macos-latest
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
- uses: actions/setup-go@v5
29+
with:
30+
go-version: ${{ env.GO_VERSION }}
31+
- name: Build
32+
run: make build-all-platforms
33+
- name: Upload artifacts
34+
uses: softprops/action-gh-release@v2
35+
with:
36+
generate_release_notes: true
37+
make_latest: true
38+
files: |
39+
LICENSE.md
40+
istio-mcp-server-*
41+
- name: Publish npm
42+
run:
43+
make npm-publish

.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
.idea/
2+
.docusaurus/
3+
node_modules/
4+
5+
# Build artifacts
6+
istio-mcp-server
7+
!cmd/istio-mcp-server
8+
!pkg/istio-mcp-server
9+
10+
# OS specific files
11+
.DS_Store
12+
Thumbs.db
13+
14+
# Editor files
15+
*.swp
16+
*.swo
17+
*~
18+
19+
# Log files
20+
*.log
21+
22+
# Temporary files
23+
*.tmp
24+
*.temp

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Sergey Krutsko
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# If you update this file, please follow
2+
# https://www.thapaliya.com/en/writings/well-documented-makefiles/
3+
4+
.DEFAULT_GOAL := help
5+
6+
PACKAGE = $(shell go list -m)
7+
GIT_COMMIT_HASH = $(shell git rev-parse HEAD)
8+
GIT_VERSION = $(shell git describe --tags --always --dirty)
9+
BUILD_TIME = $(shell date -u '+%Y-%m-%dT%H:%M:%SZ')
10+
BINARY_NAME = istio-mcp-server
11+
LD_FLAGS = -s -w \
12+
-X '$(PACKAGE)/pkg/version.CommitHash=$(GIT_COMMIT_HASH)' \
13+
-X '$(PACKAGE)/pkg/version.Version=$(GIT_VERSION)' \
14+
-X '$(PACKAGE)/pkg/version.BuildTime=$(BUILD_TIME)' \
15+
-X '$(PACKAGE)/pkg/version.BinaryName=$(BINARY_NAME)'
16+
COMMON_BUILD_ARGS = -ldflags "$(LD_FLAGS)"
17+
18+
GOLANGCI_LINT = $(shell pwd)/_output/tools/bin/golangci-lint
19+
GOLANGCI_LINT_VERSION ?= v2.2.2
20+
21+
# NPM version should not append the -dirty flag
22+
NPM_VERSION ?= $(shell echo $(shell git describe --tags --always) | sed 's/^v//')
23+
OSES = darwin linux windows
24+
ARCHS = amd64 arm64
25+
26+
CLEAN_TARGETS :=
27+
CLEAN_TARGETS += '$(BINARY_NAME)'
28+
CLEAN_TARGETS += bin/
29+
CLEAN_TARGETS += $(foreach os,$(OSES),$(foreach arch,$(ARCHS),$(BINARY_NAME)-$(os)-$(arch)$(if $(findstring windows,$(os)),.exe,)))
30+
CLEAN_TARGETS += $(foreach os,$(OSES),$(foreach arch,$(ARCHS),./npm/$(BINARY_NAME)-$(os)-$(arch)/bin/))
31+
CLEAN_TARGETS += ./npm/$(BINARY_NAME)/.npmrc ./npm/$(BINARY_NAME)/LICENSE.md ./npm/$(BINARY_NAME)/README.md ./npm/$(BINARY_NAME)/bin/
32+
CLEAN_TARGETS += $(foreach os,$(OSES),$(foreach arch,$(ARCHS),./npm/$(BINARY_NAME)-$(os)-$(arch)/.npmrc))
33+
34+
# The help will print out all targets with their descriptions organized bellow their categories. The categories are represented by `##@` and the target descriptions by `##`.
35+
# The awk commands is responsible to read the entire set of makefiles included in this invocation, looking for lines of the file as xyz: ## something, and then pretty-format the target and help. Then, if there's a line with ##@ something, that gets pretty-printed as a category.
36+
# More info over the usage of ANSI control characters for terminal formatting: https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters
37+
# More info over awk command: http://linuxcommand.org/lc3_adv_awk.php
38+
#
39+
# Notice that we have a little modification on the awk command to support slash in the recipe name:
40+
# origin: /^[a-zA-Z_0-9-]+:.*?##/
41+
# modified /^[a-zA-Z_0-9\/\.-]+:.*?##/
42+
.PHONY: help
43+
help: ## Display this help
44+
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9\/\.-]+:.*?##/ { printf " \033[36m%-21s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
45+
46+
.PHONY: clean
47+
clean: ## Clean up all build artifacts
48+
rm -rf $(CLEAN_TARGETS)
49+
50+
.PHONY: build
51+
build: clean tidy format ## Build the project
52+
mkdir -p bin
53+
go build $(COMMON_BUILD_ARGS) -o bin/$(BINARY_NAME) ./cmd/istio-mcp-server
54+
55+
.PHONY: build-all-platforms
56+
build-all-platforms: clean tidy format ## Build the project for all platforms
57+
$(foreach os,$(OSES),$(foreach arch,$(ARCHS), \
58+
GOOS=$(os) GOARCH=$(arch) go build $(COMMON_BUILD_ARGS) -o $(BINARY_NAME)-$(os)-$(arch)$(if $(findstring windows,$(os)),.exe,) ./cmd/istio-mcp-server; \
59+
))
60+
61+
.PHONY: npm-copy-binaries
62+
npm-copy-binaries: build-all-platforms ## Copy the binaries to each npm package
63+
$(foreach os,$(OSES),$(foreach arch,$(ARCHS), \
64+
EXECUTABLE=./$(BINARY_NAME)-$(os)-$(arch)$(if $(findstring windows,$(os)),.exe,); \
65+
DIRNAME=$(BINARY_NAME)-$(os)-$(arch); \
66+
mkdir -p ./npm/$$DIRNAME/bin; \
67+
cp $$EXECUTABLE ./npm/$$DIRNAME/bin/; \
68+
))
69+
70+
.PHONY: npm-publish
71+
npm-publish: npm-copy-binaries ## Publish the npm packages
72+
$(foreach os,$(OSES),$(foreach arch,$(ARCHS), \
73+
DIRNAME="$(BINARY_NAME)-$(os)-$(arch)"; \
74+
cd npm/$$DIRNAME; \
75+
echo '//registry.npmjs.org/:_authToken=$(NPM_TOKEN)' >> .npmrc; \
76+
jq '.version = "$(NPM_VERSION)"' package.json > tmp.json && mv tmp.json package.json; \
77+
npm publish; \
78+
cd ../..; \
79+
))
80+
cp README.md LICENSE.md ./npm/$(BINARY_NAME)/
81+
echo '//registry.npmjs.org/:_authToken=$(NPM_TOKEN)' >> ./npm/$(BINARY_NAME)/.npmrc
82+
jq '.version = "$(NPM_VERSION)"' ./npm/$(BINARY_NAME)/package.json > tmp.json && mv tmp.json ./npm/$(BINARY_NAME)/package.json; \
83+
jq '.optionalDependencies |= with_entries(.value = "$(NPM_VERSION)")' ./npm/$(BINARY_NAME)/package.json > tmp.json && mv tmp.json ./npm/$(BINARY_NAME)/package.json; \
84+
cd npm/$(BINARY_NAME) && npm publish
85+
86+
.PHONY: test
87+
test: ## Run the tests
88+
go test -count=1 -v ./...
89+
90+
.PHONY: format
91+
format: ## Format the code
92+
go fmt ./...
93+
94+
.PHONY: tidy
95+
tidy: ## Tidy up the go modules
96+
go mod tidy
97+
98+
.PHONY: golangci-lint
99+
golangci-lint: ## Download and install golangci-lint if not already installed
100+
@[ -f $(GOLANGCI_LINT) ] || { \
101+
set -e ;\
102+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(shell dirname $(GOLANGCI_LINT)) $(GOLANGCI_LINT_VERSION) ;\
103+
}
104+
105+
.PHONY: lint
106+
lint: golangci-lint ## Lint the code
107+
$(GOLANGCI_LINT) run --verbose --print-resources-usage

PROXY_CONFIG.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Istio Proxy Configuration Support
2+
3+
This document describes the proxy configuration features available in the Istio MCP Server.
4+
5+
## Overview
6+
7+
The Istio MCP Server provides comprehensive tools for accessing Envoy proxy configurations within Istio service mesh. These tools allow you to inspect the runtime configuration of Envoy proxies running in your Istio-managed pods.
8+
9+
## Available Tools
10+
11+
The Istio MCP Server supports these proxy configuration tools:
12+
13+
- **get-proxy-clusters**: Get Envoy cluster configuration from a pod
14+
- **get-proxy-listeners**: Get Envoy listener configuration from a pod
15+
- **get-proxy-routes**: Get Envoy route configuration from a pod
16+
- **get-proxy-endpoints**: Get Envoy endpoint configuration from a pod
17+
- **get-proxy-bootstrap**: Get Envoy bootstrap configuration from a pod
18+
- **get-proxy-config-dump**: Get full Envoy configuration dump from a pod
19+
- **get-proxy-status**: Get proxy status information for all pods or a specific pod
20+
21+
## Implementation Details
22+
23+
- Uses `istioctl proxy-config` commands under the hood
24+
- Requires `istioctl` to be installed on the system
25+
- Returns JSON formatted output for easy parsing
26+
- Includes proper error handling and timeouts
27+
- Supports both namespace-wide and pod-specific queries
28+
29+
## Usage
30+
31+
Each tool requires:
32+
- `namespace` (optional, defaults to 'default')
33+
- `pod` (required for most tools, except `get-proxy-status`)
34+
35+
### Examples
36+
37+
```bash
38+
# Get cluster configuration for a specific pod
39+
get-proxy-clusters --namespace default --pod my-app-pod
40+
41+
# Get listener configuration
42+
get-proxy-listeners --namespace istio-system --pod istio-ingressgateway-xyz
43+
44+
# Get route configuration
45+
get-proxy-routes --namespace default --pod frontend-service
46+
47+
# Get proxy status for all pods in a namespace
48+
get-proxy-status --namespace default
49+
50+
# Get proxy status for a specific pod
51+
get-proxy-status --namespace default --pod my-app-pod
52+
```
53+
54+
## Prerequisites
55+
56+
- Istio installed in your Kubernetes cluster
57+
- `istioctl` CLI tool installed and configured
58+
- Proper RBAC permissions to access pod information
59+
- Network access to the Kubernetes API server
60+
61+
## Error Handling
62+
63+
The tools include comprehensive error handling for common scenarios:
64+
- Pod not found
65+
- Istio proxy not running in pod
66+
- Network connectivity issues
67+
- Permission denied errors
68+
- Invalid namespace or pod names

0 commit comments

Comments
 (0)