Skip to content

Commit 3c5c954

Browse files
authored
mcp-server impl (#1)
1 parent 11b8580 commit 3c5c954

File tree

896 files changed

+570431
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

896 files changed

+570431
-0
lines changed

.github/workflows/go.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Unit Tests
2+
on: [push, pull_request]
3+
4+
permissions:
5+
contents: read
6+
7+
jobs:
8+
build:
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
os: [ubuntu-latest, windows-latest, macos-latest]
13+
14+
runs-on: ${{ matrix.os }}
15+
16+
steps:
17+
- name: Check out code
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Go
21+
uses: actions/setup-go@v5
22+
with:
23+
go-version-file: "go.mod"
24+
25+
- name: Download dependencies
26+
run: go mod download
27+
28+
- name: Run unit tests
29+
run: go test -race ./...
30+
31+
- name: Build
32+
run: make build

.github/workflows/goreleaser.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: GoReleaser Release
2+
on:
3+
push:
4+
tags:
5+
- "v*"
6+
permissions:
7+
contents: write
8+
id-token: write
9+
attestations: write
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Check out code
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Go
20+
uses: actions/setup-go@v5
21+
with:
22+
go-version-file: "go.mod"
23+
24+
- name: Download dependencies
25+
run: go mod download
26+
27+
- name: Run GoReleaser
28+
uses: goreleaser/goreleaser-action@9c156ee8a17a598857849441385a2041ef570552
29+
with:
30+
distribution: goreleaser
31+
# GoReleaser version
32+
version: "~> v2"
33+
# Arguments to pass to GoReleaser
34+
args: release --clean
35+
workdir: .
36+
env:
37+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
39+
- name: Generate signed build provenance attestations for workflow artifacts
40+
uses: actions/attest-build-provenance@v2
41+
with:
42+
subject-path: |
43+
dist/*.tar.gz
44+
dist/*.zip
45+
dist/*.txt

.github/workflows/lint.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Lint
2+
on:
3+
push:
4+
pull_request:
5+
6+
permissions:
7+
contents: read
8+
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Check out code
15+
uses: actions/checkout@v4
16+
17+
- name: Set up Go
18+
uses: actions/setup-go@v5
19+
with:
20+
go-version-file: 'go.mod'
21+
22+
- name: Verify dependencies
23+
run: |
24+
go mod verify
25+
go mod download
26+
27+
LINT_VERSION=1.64.8
28+
curl -fsSL https://github.com/golangci/golangci-lint/releases/download/v${LINT_VERSION}/golangci-lint-${LINT_VERSION}-linux-amd64.tar.gz | \
29+
tar xz --strip-components 1 --wildcards \*/golangci-lint
30+
mkdir -p bin && mv golangci-lint bin/
31+
32+
- name: Run checks
33+
run: |
34+
STATUS=0
35+
assert-nothing-changed() {
36+
local diff
37+
"$@" >/dev/null || return 1
38+
if ! diff="$(git diff -U1 --color --exit-code)"; then
39+
printf '\e[31mError: running `\e[1m%s\e[22m` results in modifications that you must check into version control:\e[0m\n%s\n\n' "$*" "$diff" >&2
40+
git checkout -- .
41+
STATUS=1
42+
fi
43+
}
44+
45+
assert-nothing-changed go fmt ./...
46+
assert-nothing-changed go mod tidy
47+
48+
bin/golangci-lint run --out-format=colored-line-number --timeout=3m || STATUS=$?
49+
50+
exit $STATUS

.github/workflows/project.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Build
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
- release/*
7+
paths:
8+
- '**'
9+
- '!docs/**'
10+
- '!README.md'
11+
- '!CONTRIBUTING.md'
12+
13+
env:
14+
GOPRIVATE: github.com/streamnative
15+
ACCESS_TOKEN: ${{ secrets.SNBOT_GITHUB_TOKEN }}
16+
17+
jobs:
18+
build:
19+
name: Build
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Set up Git token
23+
run: |
24+
git config --global user.email "[email protected]"
25+
git config --global user.name "StreamNative Bot"
26+
git config --global url."https://streamnativebot:${ACCESS_TOKEN}@github.com/".insteadOf "https://github.com/"
27+
28+
- name: Check out code into the Go module directory
29+
uses: actions/checkout@v3
30+
31+
- name: Set up Go
32+
uses: actions/setup-go@v3
33+
with:
34+
go-version-file: 'go.mod'
35+
36+
- name: Docker login
37+
run: docker login -u="${{ secrets.DOCKER_USER }}" -p="${{ secrets.DOCKER_PASSWORD }}"
38+
39+
- name: Run GoReleaser (snapshot)
40+
uses: goreleaser/goreleaser-action@v3
41+
with:
42+
version: latest
43+
args: release --snapshot --clean
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.SNBOT_GITHUB_TOKEN }}
46+
47+
- name: Upload artifacts
48+
uses: actions/upload-artifact@v4
49+
with:
50+
name: dist
51+
path: dist/

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.idea/
2+
bin/
3+
dist/
4+
5+
.DS_Store
6+
tmp/
7+
*.log
8+
9+
# Go
10+
vendor

.golangci.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
run:
2+
timeout: 5m
3+
tests: true
4+
concurrency: 4
5+
6+
linters:
7+
enable:
8+
- govet
9+
- errcheck
10+
- staticcheck
11+
- gofmt
12+
- goimports
13+
- revive
14+
- ineffassign
15+
- typecheck
16+
- unused
17+
- gosimple
18+
- misspell
19+
- nakedret
20+
- bodyclose
21+
- gocritic
22+
- makezero
23+
- gosec
24+
25+
output:
26+
formats: colored-line-number
27+
print-issued-lines: true
28+
print-linter-name: true

.goreleaser.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
version: 2
2+
project_name: streamnative-mcp-server
3+
before:
4+
hooks:
5+
- go mod tidy
6+
- go generate ./...
7+
8+
builds:
9+
- env:
10+
- CGO_ENABLED=0
11+
ldflags:
12+
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}
13+
goos:
14+
- linux
15+
- windows
16+
- darwin
17+
goarch:
18+
- amd64
19+
- arm64
20+
main: ./cmd/streamnative-mcp-server
21+
22+
archives:
23+
- formats: tar.gz
24+
# this name template makes the OS and Arch compatible with the results of `uname`.
25+
name_template: >-
26+
{{ .ProjectName }}_
27+
{{- title .Os }}_
28+
{{- if eq .Arch "amd64" }}x86_64
29+
{{- else if eq .Arch "386" }}i386
30+
{{- else }}{{ .Arch }}{{ end }}
31+
{{- if .Arm }}v{{ .Arm }}{{ end }}
32+
# use zip for windows archives
33+
format_overrides:
34+
- goos: windows
35+
formats: zip
36+
37+
changelog:
38+
sort: asc
39+
filters:
40+
exclude:
41+
- "^docs:"
42+
- "^test:"
43+
44+
release:
45+
draft: true
46+
prerelease: auto
47+
name_template: "StreamNative MCP Server {{.Version}}"

0 commit comments

Comments
 (0)