Skip to content

Commit a77d5f8

Browse files
committed
feat: project bootstrap
1 parent 8765dcd commit a77d5f8

File tree

6 files changed

+96
-0
lines changed

6 files changed

+96
-0
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.idea/

Makefile

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# If you update this file, please follow
2+
# https://suva.sh/posts/well-documented-makefiles
3+
4+
## --------------------------------------
5+
## General
6+
## --------------------------------------
7+
8+
.DEFAULT_GOAL := help
9+
10+
BINARY_NAME=kubernetes-mcp-server
11+
LD_FLAGS=-s -w \
12+
-X '$(PACKAGE)/pkg/version.CommitHash=$(COMMIT_HASH)' \
13+
-X '$(PACKAGE)/pkg/version.BuildTime=$(BUILD_TIME)' \
14+
-X '$(PACKAGE)/pkg/version.BinaryName=$(BINARY_NAME)'
15+
COMMON_BUILD_ARGS=-ldflags "$(LD_FLAGS)"
16+
CLEAN_TARGETS:=
17+
18+
# The help will print out all targets with their descriptions organized bellow their categories. The categories are represented by `##@` and the target descriptions by `##`.
19+
# 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.
20+
# More info over the usage of ANSI control characters for terminal formatting: https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters
21+
# More info over awk command: http://linuxcommand.org/lc3_adv_awk.php
22+
#
23+
# Notice that we have a little modification on the awk command to support slash in the recipe name:
24+
# origin: /^[a-zA-Z_0-9-]+:.*?##/
25+
# modified /^[a-zA-Z_0-9\/\.-]+:.*?##/
26+
.PHONY: help
27+
help: ## Display this help
28+
@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)
29+
30+
.PHONY: clean
31+
clean: ## Clean up all build artifacts
32+
rm -rf $(CLEAN_TARGETS)
33+
34+
.PHONY: build
35+
build: ## Build the project
36+
go build $(COMMON_BUILD_ARGS) -o $(BINARY_NAME) ./cmd/kubernetes-mcp-server
37+
38+
CLEAN_TARGETS+='$(BINARY_NAME)'
39+
40+
.PHONY: tidy
41+
tidy: ## Tidy up the go modules
42+
go mod tidy

cmd/kubernetes-mcp-server/main.go

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package main
2+
3+
import "github.com/manusa/kubernetes-mcp-server/pkg/kubernetes-mcp-server/cmd"
4+
5+
func main() {
6+
cmd.Execute()
7+
}

go.mod

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
module github.com/manusa/kubernetes-mcp-server
2+
3+
go 1.23.5
4+
5+
require github.com/spf13/cobra v1.8.1
6+
7+
require (
8+
github.com/inconshreveable/mousetrap v1.1.0 // indirect
9+
github.com/spf13/pflag v1.0.5 // indirect
10+
)

go.sum

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
2+
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
3+
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
4+
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
5+
github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM=
6+
github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y=
7+
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
8+
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
9+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
10+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

pkg/kubernetes-mcp-server/cmd/root.go

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package cmd
2+
3+
import (
4+
"github.com/spf13/cobra"
5+
)
6+
7+
var rootCmd = &cobra.Command{
8+
Use: "kubernetes-mcp-server [command] [options]",
9+
Short: "Kubernetes Model Context Protocol (MCP) server",
10+
Long: `
11+
Kubernetes Model Context Protocol (MCP) server
12+
13+
# show this help
14+
kubernetes-mcp-server -h
15+
16+
# TODO: add more examples`,
17+
Run: func(cmd *cobra.Command, args []string) {
18+
19+
},
20+
}
21+
22+
func Execute() {
23+
if err := rootCmd.Execute(); err != nil {
24+
panic(err)
25+
}
26+
}

0 commit comments

Comments
 (0)