-
-
Notifications
You must be signed in to change notification settings - Fork 33
Feat/add registry support #95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
4f45128
6a83e66
c4f59c1
eb55af2
4038ecf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,7 +1,7 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .PHONY: build build-dxt pack-dxt test clean run-dev release-snapshot run-docker run docker-compose-up docker-compose-down lint docker-test | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| .PHONY: build build-platform-binaries build-mcpb pack-mcpb-from-dist test clean run-dev release-snapshot run-docker run docker-compose-up docker-compose-down lint docker-test | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Variables | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| BINARY_NAME=mcp-trino | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| BINARY_NAME ?= $(shell basename $(shell git remote get-url origin) .git | sed 's/.*\///') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| BUILD_DIR=bin | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -10,22 +10,71 @@ build: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| mkdir -p $(BUILD_DIR) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| go build -ldflags "-X main.Version=$(VERSION)" -o $(BUILD_DIR)/$(BINARY_NAME) ./cmd | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Build all platform-specific binaries for DXT packaging | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| build-dxt: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Build all platform-specific binaries for MCPB packaging | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| build-platform-binaries: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| mkdir -p server | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @echo "Building platform-specific binaries for DXT..." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @echo "Building platform-specific binaries for MCPB..." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| GOOS=darwin GOARCH=arm64 go build -ldflags "-X main.Version=$(VERSION)" -o server/$(BINARY_NAME)-darwin-arm64 ./cmd | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| GOOS=darwin GOARCH=amd64 go build -ldflags "-X main.Version=$(VERSION)" -o server/$(BINARY_NAME)-darwin-amd64 ./cmd | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| GOOS=linux GOARCH=amd64 go build -ldflags "-X main.Version=$(VERSION)" -o server/$(BINARY_NAME)-linux-amd64 ./cmd | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| GOOS=windows GOARCH=amd64 go build -ldflags "-X main.Version=$(VERSION)" -o server/$(BINARY_NAME)-windows-amd64.exe ./cmd | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| chmod +x server/$(BINARY_NAME)-* | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @echo "All platform binaries built in server/ directory" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Package DXT extension | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pack-dxt: build-dxt | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @echo "Packaging DXT extension..." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| dxt pack | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @echo "DXT package created: $(BINARY_NAME).dxt" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Build MCPB bundle | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| build-mcpb: build-platform-binaries | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @echo "Creating MCPB bundle..." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @if [ ! -f "manifest.json" ]; then \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "Error: manifest.json not found"; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| exit 1; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| mkdir -p mcpb-bundle/server | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cp server/* mcpb-bundle/server/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Update version and name in manifest.json to match build version and binary name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| sed -e 's/"version": ".*"/"version": "$(VERSION)"/' -e 's/"name": "$(BINARY_NAME)"/"name": "$(BINARY_NAME)"/' manifest.json > mcpb-bundle/manifest.json | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cd mcpb-bundle && zip -r ../$(BINARY_NAME).mcpb . && cd .. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| rm -rf mcpb-bundle | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @echo "MCPB bundle created: $(BINARY_NAME).mcpb" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Pack MCPB from GoReleaser dist/ folder | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pack-mcpb-from-dist: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @echo "Creating MCPB bundle from GoReleaser binaries..." | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| mkdir -p mcpb-bundle/server | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @# Copy specific platform binaries with explicit names | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @found_count=0; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for platform in "linux_amd64" "darwin_amd64" "darwin_arm64" "windows_amd64"; do \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| found=$$(find dist -path "*_$${platform}_*" -name "$(BINARY_NAME)*" -type f | head -1); \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if [ -n "$$found" ]; then \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| case "$$platform" in \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "linux_amd64") cp "$$found" "mcpb-bundle/server/$(BINARY_NAME)-linux-amd64" ;; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "darwin_amd64") cp "$$found" "mcpb-bundle/server/$(BINARY_NAME)-darwin-amd64" ;; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "darwin_arm64") cp "$$found" "mcpb-bundle/server/$(BINARY_NAME)-darwin-arm64" ;; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "windows_amd64") cp "$$found" "mcpb-bundle/server/$(BINARY_NAME)-windows-amd64.exe" ;; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| esac; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "Copied $$found -> $(BINARY_NAME)-$$platform"; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| found_count=$$((found_count + 1)); \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "Warning: No binary found for $$platform"; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fi; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+45
to
+58
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Robust artifact selection; avoid copying archives. Current - found=$$(find dist -path "*_$${platform}_*" -name "$(BINARY_NAME)*" -type f | head -1); \
+ found=$$(find dist -path "*_$${platform}_*" -type f \
+ \( -name "$(BINARY_NAME)" -o -name "$(BINARY_NAME).exe" -o -name "$(BINARY_NAME)-*" \) \
+ ! -name "*.tar.gz" ! -name "*.tgz" ! -name "*.zip" | head -1); \
@@
- "linux_amd64") cp "$$found" "mcpb-bundle/server/$(BINARY_NAME)-linux-amd64" ;; \
+ "linux_amd64") cp "$$found" "mcpb-bundle/server/$(BINARY_NAME)-linux-amd64" ;; \
@@
esac; \
+ chmod +x mcpb-bundle/server/$(BINARY_NAME)-* 2>/dev/null || true; \📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| done; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if [ $$found_count -eq 0 ]; then \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "Error: No binaries found in dist/ directory"; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| exit 1; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @if [ ! -f "manifest.json" ]; then \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "Error: manifest.json not found"; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| rm -rf mcpb-bundle; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| exit 1; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Update version and name in manifest.json to match GoReleaser version and binary name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @if [ -n "$(GORELEASER_VERSION)" ]; then \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| sed -e 's/"version": ".*"/"version": "$(GORELEASER_VERSION)"/' -e 's/"name": "$(BINARY_NAME)"/"name": "$(BINARY_NAME)"/' manifest.json > mcpb-bundle/manifest.json; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| sed -e 's/"version": ".*"/"version": "$(VERSION)"/' -e 's/"name": "$(BINARY_NAME)"/"name": "$(BINARY_NAME)"/' manifest.json > mcpb-bundle/manifest.json; \ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cd mcpb-bundle && zip -r ../$(BINARY_NAME).mcpb . && cd .. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| rm -rf mcpb-bundle | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @echo "MCPB bundle created: $(BINARY_NAME).mcpb" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Run tests | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| test: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -35,7 +84,9 @@ test: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| clean: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| rm -rf $(BUILD_DIR) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| rm -rf server | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| rm -f $(BINARY_NAME).dxt $(BINARY_NAME)-*.dxt | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| rm -rf mcpb-bundle | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| rm -rf dist | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| rm -f $(BINARY_NAME).mcpb | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Run the application in development mode | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run-dev: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -44,9 +95,10 @@ run-dev: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Create a release snapshot using GoReleaser | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| release-snapshot: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| goreleaser release --snapshot --clean | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| make pack-mcpb-from-dist | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Run the application using the built binary | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: build | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ./$(BUILD_DIR)/$(BINARY_NAME) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Build and run Docker image | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| { | ||
| "$schema": "https://static.modelcontextprotocol.io/schemas/2025-07-09/server.schema.json", | ||
| "name": "io.github.tuannvm/mcp-trino", | ||
| "description": "MCP server for Trino distributed SQL query engine access", | ||
| "status": "active", | ||
| "repository": { | ||
| "url": "https://github.com/tuannvm/mcp-trino", | ||
| "source": "github" | ||
| }, | ||
| "version": "2.2.1", | ||
| "packages": [ | ||
| { | ||
| "registry_type": "mcpb", | ||
| "identifier": "https://github.com/tuannvm/mcp-trino/releases/download/v2.2.1/mcp-trino.mcpb", | ||
| "version": "2.2.1", | ||
| "file_sha256": "PLACEHOLDER_SHA256", | ||
| "transport": { | ||
| "type": "stdio" | ||
| }, | ||
| "environment_variables": [ | ||
| { | ||
| "description": "Trino server hostname", | ||
| "is_required": true, | ||
| "format": "string", | ||
| "is_secret": false, | ||
| "name": "TRINO_HOST" | ||
| }, | ||
| { | ||
| "description": "Trino server port", | ||
| "is_required": false, | ||
| "format": "string", | ||
| "is_secret": false, | ||
| "name": "TRINO_PORT" | ||
| }, | ||
| { | ||
| "description": "Trino username", | ||
| "is_required": true, | ||
| "format": "string", | ||
| "is_secret": false, | ||
| "name": "TRINO_USER" | ||
| }, | ||
| { | ||
| "description": "Trino password", | ||
| "is_required": false, | ||
| "format": "string", | ||
| "is_secret": true, | ||
| "name": "TRINO_PASSWORD" | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Sed-based JSON patching is brittle; name replacement is a no-op.
The sed for "name" won’t match (it looks for literal "$(BINARY_NAME)"), and generic s/".*"/ risks touching unintended fields. Use jq and strip leading v from tags.
📝 Committable suggestion
🤖 Prompt for AI Agents