Skip to content

Commit d646ee6

Browse files
committed
fix: add github workflow, version based on git tag
1 parent 080e437 commit d646ee6

5 files changed

Lines changed: 90 additions & 4 deletions

File tree

.github/workflows/image.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Docker Image
2+
3+
on:
4+
push:
5+
tags: [ 'v*.*.*' ]
6+
7+
permissions:
8+
contents: read
9+
packages: write
10+
11+
jobs:
12+
docker:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Set up Docker Buildx
17+
uses: docker/setup-buildx-action@v3
18+
- name: Login to GitHub Container Registry
19+
uses: docker/login-action@v3
20+
with:
21+
registry: ghcr.io
22+
username: ${{ github.actor }}
23+
password: ${{ secrets.GITHUB_TOKEN }}
24+
- name: Build and push Docker image
25+
uses: docker/build-push-action@v5
26+
with:
27+
context: .
28+
push: true
29+
tags: |
30+
ghcr.io/${{ github.repository }}:${{ github.ref_name }}
31+
ghcr.io/${{ github.repository }}:latest
32+
build-args: |
33+
VERSION=${{ github.ref_name }}

.github/workflows/lint.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
lint:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: Set up Go
15+
uses: actions/setup-go@v5
16+
with:
17+
go-version: '1.22'
18+
- name: Run go fmt
19+
run: go fmt ./...
20+
- name: Run go vet
21+
run: go vet ./...

.github/workflows/release.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags: [ 'v*.*.*' ]
6+
7+
permissions:
8+
contents: write
9+
10+
jobs:
11+
release:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Set up Go
16+
uses: actions/setup-go@v5
17+
with:
18+
go-version: '1.23'
19+
- name: Build
20+
run: go build -ldflags "-X main.version=${GITHUB_REF_NAME}" -o mcp-parseable-server ./cmd/mcp_parseable_server
21+
- name: Create GitHub Release
22+
uses: softprops/action-gh-release@v2
23+
with:
24+
files: |
25+
./mcp-parseable-server

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,9 @@ Ensure you have Go 1.20+ installed.
2222

2323
```sh
2424
git clone https://github.com/thenodon/mcp-parseable-server
25-
cd your-repo
25+
cd mcp-parseable-server
2626
# Build the MCP server binary
27-
cd cmd/mcp_parseable_server
28-
go build -o ../../mcp-parseable-server
27+
go build -o mcp-parseable-server ./cmd/mcp_parseable_server
2928
```
3029

3130
# Running

cmd/mcp_parseable_server/main.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,22 @@ import (
1010
"mcp-pb/tools"
1111
)
1212

13+
var version = "undefined"
14+
1315
func main() {
1416
mode := flag.String("mode", "http", "server mode: http or stdio")
1517
parseableURL := flag.String("parseable-url", "", "base URL for Parseable instance (or set PARSEABLE_URL env var)")
1618
parseableUserFlag := flag.String("parseable-username", "", "Parseable basic auth username (or set PARSEABLE_USER env var)")
1719
parseablePassFlag := flag.String("parseable-password", "", "Parseable basic auth password (or set PARSEABLE_PASS env var)")
1820
listenAddr := flag.String("listen", ":9034", "address to listen on")
21+
versionFlag := flag.Bool("version", false, "print version and exit")
1922
flag.Parse()
2023

24+
if *versionFlag {
25+
println("mcp-parseable-server " + version)
26+
os.Exit(0)
27+
}
28+
2129
// Prefer environment variables if set, otherwise use flags or defaults
2230
tools.ParseableBaseURL = os.Getenv("PARSEABLE_URL")
2331
if tools.ParseableBaseURL == "" {
@@ -49,7 +57,7 @@ func main() {
4957
*listenAddr = listenAddrEnv
5058
}
5159

52-
mcpServer := server.NewMCPServer("parseable-mcp", "0.1.0",
60+
mcpServer := server.NewMCPServer("parseable-mcp", version,
5361
server.WithRecovery(),
5462
server.WithLogging(),
5563
server.WithInstructions(`

0 commit comments

Comments
 (0)