mirror of
https://github.com/openshift/openshift-mcp-server.git
synced 2025-10-17 14:27:48 +03:00
feat(npm): npm packages
This commit is contained in:
4
.github/workflows/release.yaml
vendored
4
.github/workflows/release.yaml
vendored
@@ -12,6 +12,7 @@ concurrency:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
GO_VERSION: 1.23
|
GO_VERSION: 1.23
|
||||||
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
@@ -39,3 +40,6 @@ jobs:
|
|||||||
files: |
|
files: |
|
||||||
LICENSE
|
LICENSE
|
||||||
kubernetes-mcp-server-*
|
kubernetes-mcp-server-*
|
||||||
|
- name: Publish npm
|
||||||
|
run:
|
||||||
|
make npm-publish
|
||||||
|
|||||||
19
.gitignore
vendored
19
.gitignore
vendored
@@ -1,9 +1,14 @@
|
|||||||
.idea/
|
.idea/
|
||||||
|
|
||||||
/kubernetes-mcp-server
|
.npmrc
|
||||||
/kubernetes-mcp-server-darwin-amd64
|
kubernetes-mcp-server
|
||||||
/kubernetes-mcp-server-darwin-arm64
|
kubernetes-mcp-server-darwin-amd64
|
||||||
/kubernetes-mcp-server-linux-amd64
|
!npm/kubernetes-mcp-server-darwin-amd64/
|
||||||
/kubernetes-mcp-server-linux-arm64
|
kubernetes-mcp-server-darwin-arm64
|
||||||
/kubernetes-mcp-server-windows-amd64.exe
|
!npm/kubernetes-mcp-server-darwin-arm64
|
||||||
/kubernetes-mcp-server-windows-arm64.exe
|
kubernetes-mcp-server-linux-amd64
|
||||||
|
!npm/kubernetes-mcp-server-linux-amd64
|
||||||
|
kubernetes-mcp-server-linux-arm64
|
||||||
|
!npm/kubernetes-mcp-server-linux-arm64
|
||||||
|
kubernetes-mcp-server-windows-amd64.exe
|
||||||
|
kubernetes-mcp-server-windows-arm64.exe
|
||||||
|
|||||||
30
Makefile
30
Makefile
@@ -19,12 +19,16 @@ LD_FLAGS = -s -w \
|
|||||||
-X '$(PACKAGE)/pkg/version.BinaryName=$(BINARY_NAME)'
|
-X '$(PACKAGE)/pkg/version.BinaryName=$(BINARY_NAME)'
|
||||||
COMMON_BUILD_ARGS = -ldflags "$(LD_FLAGS)"
|
COMMON_BUILD_ARGS = -ldflags "$(LD_FLAGS)"
|
||||||
|
|
||||||
|
NPM_VERSION ?= $(shell echo $(GIT_VERSION) | sed 's/^v//')
|
||||||
OSES = darwin linux windows
|
OSES = darwin linux windows
|
||||||
ARCHS = amd64 arm64
|
ARCHS = amd64 arm64
|
||||||
|
|
||||||
CLEAN_TARGETS :=
|
CLEAN_TARGETS :=
|
||||||
CLEAN_TARGETS += '$(BINARY_NAME)'
|
CLEAN_TARGETS += '$(BINARY_NAME)'
|
||||||
CLEAN_TARGETS += $(foreach os,$(OSES),$(foreach arch,$(ARCHS),$(BINARY_NAME)-$(os)-$(arch)))
|
CLEAN_TARGETS += $(foreach os,$(OSES),$(foreach arch,$(ARCHS),$(BINARY_NAME)-$(os)-$(arch)$(if $(findstring windows,$(os)),.exe,)))
|
||||||
|
CLEAN_TARGETS += $(foreach os,$(OSES),$(foreach arch,$(ARCHS),./npm/$(BINARY_NAME)-$(os)-$(arch)/bin/))
|
||||||
|
CLEAN_TARGETS += ./npm/.npmrc
|
||||||
|
CLEAN_TARGETS += $(foreach os,$(OSES),$(foreach arch,$(ARCHS),./npm/$(BINARY_NAME)-$(os)-$(arch)/.npmrc))
|
||||||
|
|
||||||
# The help will print out all targets with their descriptions organized bellow their categories. The categories are represented by `##@` and the target descriptions by `##`.
|
# The help will print out all targets with their descriptions organized bellow their categories. The categories are represented by `##@` and the target descriptions by `##`.
|
||||||
# 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.
|
# 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.
|
||||||
@@ -53,6 +57,30 @@ build-all-platforms: clean tidy format ## Build the project for all platforms
|
|||||||
GOOS=$(os) GOARCH=$(arch) go build $(COMMON_BUILD_ARGS) -o $(BINARY_NAME)-$(os)-$(arch)$(if $(findstring windows,$(os)),.exe,) ./cmd/kubernetes-mcp-server; \
|
GOOS=$(os) GOARCH=$(arch) go build $(COMMON_BUILD_ARGS) -o $(BINARY_NAME)-$(os)-$(arch)$(if $(findstring windows,$(os)),.exe,) ./cmd/kubernetes-mcp-server; \
|
||||||
))
|
))
|
||||||
|
|
||||||
|
.PHONY: npm
|
||||||
|
npm: build-all-platforms ## Create the npm packages
|
||||||
|
$(foreach os,$(OSES),$(foreach arch,$(ARCHS), \
|
||||||
|
EXECUTABLE=./$(BINARY_NAME)-$(os)-$(arch)$(if $(findstring windows,$(os)),.exe,); \
|
||||||
|
DIRNAME=$(BINARY_NAME)-$(os)-$(arch); \
|
||||||
|
mkdir -p ./npm/$$DIRNAME/bin; \
|
||||||
|
cp $$EXECUTABLE ./npm/$$DIRNAME/bin/; \
|
||||||
|
))
|
||||||
|
|
||||||
|
.PHONY: npm-publish
|
||||||
|
npm-publish: npm ## Publish the npm packages
|
||||||
|
$(foreach os,$(OSES),$(foreach arch,$(ARCHS), \
|
||||||
|
DIRNAME="$(BINARY_NAME)-$(os)-$(arch)"; \
|
||||||
|
cd npm/$$DIRNAME; \
|
||||||
|
echo '//registry.npmjs.org/:_authToken=\$(NPM_TOKEN)' >> .npmrc; \
|
||||||
|
jq '.version = "$(NPM_VERSION)"' package.json > tmp.json && mv tmp.json package.json; \
|
||||||
|
echo npm publish; \
|
||||||
|
cd ../..; \
|
||||||
|
))
|
||||||
|
echo '//registry.npmjs.org/:_authToken=\$(NPM_TOKEN)' >> ./npm/.npmrc
|
||||||
|
jq '.version = "$(NPM_VERSION)"' ./npm/package.json > tmp.json && mv tmp.json ./npm/package.json; \
|
||||||
|
jq '.optionalDependencies |= with_entries(.value = "$(NPM_VERSION)")' ./npm/package.json > tmp.json && mv tmp.json ./npm/package.json; \
|
||||||
|
cd npm && echo npm publish
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test: ## Run the tests
|
test: ## Run the tests
|
||||||
go test -count=1 -v ./...
|
go test -count=1 -v ./...
|
||||||
|
|||||||
2
go.mod
2
go.mod
@@ -7,6 +7,7 @@ require (
|
|||||||
github.com/spf13/afero v1.12.0
|
github.com/spf13/afero v1.12.0
|
||||||
github.com/spf13/cobra v1.8.1
|
github.com/spf13/cobra v1.8.1
|
||||||
github.com/spf13/viper v1.19.0
|
github.com/spf13/viper v1.19.0
|
||||||
|
golang.org/x/net v0.33.0
|
||||||
k8s.io/api v0.32.1
|
k8s.io/api v0.32.1
|
||||||
k8s.io/apimachinery v0.32.1
|
k8s.io/apimachinery v0.32.1
|
||||||
k8s.io/cli-runtime v0.32.1
|
k8s.io/cli-runtime v0.32.1
|
||||||
@@ -77,7 +78,6 @@ require (
|
|||||||
github.com/xlab/treeprint v1.2.0 // indirect
|
github.com/xlab/treeprint v1.2.0 // indirect
|
||||||
go.uber.org/multierr v1.11.0 // indirect
|
go.uber.org/multierr v1.11.0 // indirect
|
||||||
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
|
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
|
||||||
golang.org/x/net v0.33.0 // indirect
|
|
||||||
golang.org/x/oauth2 v0.25.0 // indirect
|
golang.org/x/oauth2 v0.25.0 // indirect
|
||||||
golang.org/x/sync v0.10.0 // indirect
|
golang.org/x/sync v0.10.0 // indirect
|
||||||
golang.org/x/sys v0.29.0 // indirect
|
golang.org/x/sys v0.29.0 // indirect
|
||||||
|
|||||||
19
npm/bin/kubernetes-mcp-server.js
Executable file
19
npm/bin/kubernetes-mcp-server.js
Executable file
@@ -0,0 +1,19 @@
|
|||||||
|
const childProcess = require("child_process");
|
||||||
|
|
||||||
|
const BINARY_MAP = {
|
||||||
|
darwin_x86: {name: "kubernetes-mcp-server-darwin-amd64", suffix: ''},
|
||||||
|
darwin_arm64: {name: "kubernetes-mcp-server-darwin-arm64", suffix: ''},
|
||||||
|
linux_x86: {name: "kubernetes-mcp-server-linux-amd64", suffix: ''},
|
||||||
|
linux_arm64: {name: "kubernetes-mcp-server-linux-arm64", suffix: ''},
|
||||||
|
win32_x86: {name: "kubernetes-mcp-server-windows-amd64", suffix: '.exe'},
|
||||||
|
win32_arm64: {name: "kubernetes-mcp-server-windows-arm64", suffix: '.exe'},
|
||||||
|
};
|
||||||
|
|
||||||
|
const binary = BINARY_MAP[`${process.platform}_${process.arch}`];
|
||||||
|
|
||||||
|
module.exports.runBinary = function (...args) {
|
||||||
|
// Resolving will fail if the optionalDependency was not installed
|
||||||
|
childProcess.execFileSync(require.resolve(`${binary.name}/bin/${binary.name}+${binary.suffix}`), args, {
|
||||||
|
stdio: "inherit",
|
||||||
|
});
|
||||||
|
};
|
||||||
11
npm/kubernetes-mcp-server-darwin-amd64/package.json
Normal file
11
npm/kubernetes-mcp-server-darwin-amd64/package.json
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"name": "kubernetes-mcp-server-darwin-amd64",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"description": "Model Context Protocol (MCP) server for Kubernetes and OpenShift",
|
||||||
|
"os": [
|
||||||
|
"darwin"
|
||||||
|
],
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
]
|
||||||
|
}
|
||||||
11
npm/kubernetes-mcp-server-darwin-arm64/package.json
Normal file
11
npm/kubernetes-mcp-server-darwin-arm64/package.json
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"name": "kubernetes-mcp-server-darwin-arm64",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"description": "Model Context Protocol (MCP) server for Kubernetes and OpenShift",
|
||||||
|
"os": [
|
||||||
|
"darwin"
|
||||||
|
],
|
||||||
|
"cpu": [
|
||||||
|
"arm64"
|
||||||
|
]
|
||||||
|
}
|
||||||
11
npm/kubernetes-mcp-server-linux-amd64/package.json
Normal file
11
npm/kubernetes-mcp-server-linux-amd64/package.json
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"name": "kubernetes-mcp-server-linux-amd64",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"description": "Model Context Protocol (MCP) server for Kubernetes and OpenShift",
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
]
|
||||||
|
}
|
||||||
11
npm/kubernetes-mcp-server-linux-arm64/package.json
Normal file
11
npm/kubernetes-mcp-server-linux-arm64/package.json
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"name": "kubernetes-mcp-server-linux-arm64",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"description": "Model Context Protocol (MCP) server for Kubernetes and OpenShift",
|
||||||
|
"os": [
|
||||||
|
"linux"
|
||||||
|
],
|
||||||
|
"cpu": [
|
||||||
|
"arm64"
|
||||||
|
]
|
||||||
|
}
|
||||||
11
npm/kubernetes-mcp-server-windows-amd64/package.json
Normal file
11
npm/kubernetes-mcp-server-windows-amd64/package.json
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"name": "kubernetes-mcp-server-windows-amd64",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"description": "Model Context Protocol (MCP) server for Kubernetes and OpenShift",
|
||||||
|
"os": [
|
||||||
|
"win32"
|
||||||
|
],
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
]
|
||||||
|
}
|
||||||
11
npm/kubernetes-mcp-server-windows-arm64/package.json
Normal file
11
npm/kubernetes-mcp-server-windows-arm64/package.json
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"name": "kubernetes-mcp-server-windows-arm64",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"description": "Model Context Protocol (MCP) server for Kubernetes and OpenShift",
|
||||||
|
"os": [
|
||||||
|
"arm64"
|
||||||
|
],
|
||||||
|
"cpu": [
|
||||||
|
"x64"
|
||||||
|
]
|
||||||
|
}
|
||||||
24
npm/package-lock.json
generated
Normal file
24
npm/package-lock.json
generated
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"name": "kubernetes-mcp-server",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"lockfileVersion": 3,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {
|
||||||
|
"": {
|
||||||
|
"name": "kubernetes-mcp-server",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"bin": {
|
||||||
|
"kubernetes-mcp-server": "bin/kubernetes-mcp-server.js"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"kubernetes-mcp-server-darwin-amd64": "0.0.0",
|
||||||
|
"kubernetes-mcp-server-darwin-arm64": "0.0.0",
|
||||||
|
"kubernetes-mcp-server-linux-amd64": "0.0.0",
|
||||||
|
"kubernetes-mcp-server-linux-arm64": "0.0.0",
|
||||||
|
"kubernetes-mcp-server-win32-amd64": "0.0.0",
|
||||||
|
"kubernetes-mcp-server-win32-arm64": "0.0.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
38
npm/package.json
Normal file
38
npm/package.json
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
{
|
||||||
|
"name": "kubernetes-mcp-server",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"description": "Model Context Protocol (MCP) server for Kubernetes and OpenShift",
|
||||||
|
"main": "bin/kubernetes-mcp-server.js",
|
||||||
|
"bin": {
|
||||||
|
"kubernetes-mcp-server": "bin/kubernetes-mcp-server.js"
|
||||||
|
},
|
||||||
|
"optionalDependencies": {
|
||||||
|
"kubernetes-mcp-server-darwin-amd64": "0.0.0",
|
||||||
|
"kubernetes-mcp-server-darwin-arm64": "0.0.0",
|
||||||
|
"kubernetes-mcp-server-linux-amd64": "0.0.0",
|
||||||
|
"kubernetes-mcp-server-linux-arm64": "0.0.0",
|
||||||
|
"kubernetes-mcp-server-win32-amd64": "0.0.0",
|
||||||
|
"kubernetes-mcp-server-win32-arm64": "0.0.0"
|
||||||
|
},
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "git+https://github.com/manusa/kubernetes-mcp-server.git"
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"mcp",
|
||||||
|
"kubernetes",
|
||||||
|
"openshift",
|
||||||
|
"model",
|
||||||
|
"context",
|
||||||
|
"protocol"
|
||||||
|
],
|
||||||
|
"author": {
|
||||||
|
"name": "Marc Nuri",
|
||||||
|
"url": "https://www.marcnuri.com"
|
||||||
|
},
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/manusa/kubernetes-mcp-server/issues"
|
||||||
|
},
|
||||||
|
"homepage": "https://github.com/manusa/kubernetes-mcp-server#readme"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user