Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
943eb81
Add auth library initialization FFI functions (#2)
Mar 13, 2026
9ec694b
Add auth client FFI functions (#2)
Mar 13, 2026
b488f99
Add token validation FFI functions (#2)
Mar 13, 2026
313c4b2
Add JWT payload FFI functions (#2)
Mar 13, 2026
0368620
Add auth FFI unit tests (#2)
Mar 13, 2026
b17a825
Create auth example project structure (#2)
Mar 13, 2026
f50272c
Implement configuration loader for auth example (#2)
Mar 13, 2026
eebacec
Add endpoint derivation to config (#2)
Mar 13, 2026
4a38956
Add config unit tests (#2)
Mar 13, 2026
67d069f
Implement health endpoint (#2)
Mar 13, 2026
044548c
Implement OAuth discovery endpoints part 1 (#2)
Mar 13, 2026
13c1d2d
Implement OAuth discovery endpoints part 2 (#2)
Mar 13, 2026
21a1125
Implement JSON-RPC types and error handling (#2)
Mar 13, 2026
ae021ed
Implement MCP handler core methods (#2)
Mar 13, 2026
86a78cf
Implement tools/call handler (#2)
Mar 13, 2026
30ec9ae
Implement OAuth middleware token extraction (#2)
Mar 13, 2026
cf905db
Implement OAuth middleware validation (#2)
Mar 13, 2026
e09c290
Implement weather tools (#2)
Mar 13, 2026
7add83a
Implement main entry point (#2)
Mar 13, 2026
bbd0c1f
Add run script and documentation (#2)
Mar 13, 2026
3a75793
Include auth example in build script (#2)
Mar 13, 2026
2f0ee96
Always build auth example with native library support (#2)
Mar 13, 2026
e448079
Resolve OAuth discovery and CORS handling for MCP Inspector compatibi…
Mar 13, 2026
e767e7e
Add release automation scripts and CI workflow (#2)
Mar 20, 2026
8877fca
Update auth example for standalone third-party usage (#2)
Mar 20, 2026
3c5d572
Rename module to gopher-mcp-go and fix linker flags (#2)
Mar 21, 2026
91057b4
Update example to download native libs from gopher-mcp-go (#2)
Mar 21, 2026
d79d46f
Simplify release workflow to match documentation (#2)
Mar 21, 2026
103a0c3
Support extended version format (X.Y.Z.E) in release workflow (#2)
Mar 21, 2026
e1b21ca
Use go get in run_example.sh to trigger pkg.go.dev caching (#2)
Mar 21, 2026
c6e59ab
Convert extended version X.Y.Z.E to X.Y.Z-E for Go semver (#2)
Mar 21, 2026
bf42be8
Improve prerelease detection for numeric extensions (#2)
Mar 21, 2026
8bd71b7
Resolve SDK version update in run_example.sh (#2)
Mar 21, 2026
4e884f3
Trigger pkg.go.dev indexing in run_example.sh (#2)
Mar 21, 2026
4c60fe0
Update README.md with correct module path and license (#2)
Mar 21, 2026
8ad7cee
Add OAuth 2.0 auth feature and auth example to README (#2)
Mar 21, 2026
64f64d6
Update auth example to use gopher-mcp-go v0.1.2-5 (#2)
Mar 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
229 changes: 229 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,229 @@
name: Release

on:
push:
branches: [br_release]

permissions:
contents: write

jobs:
release:
name: Create Release with Native Binaries
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Get version from latest tag
id: version
run: |
# Get the latest tag on this branch
VERSION_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")

if [ -z "$VERSION_TAG" ]; then
echo "Error: No tags found. Run dump-version.sh first."
exit 1
fi

# Remove 'v' prefix for version number
VERSION="${VERSION_TAG#v}"

# Determine if this is a prerelease
# X.Y.Z-N (numeric extension) is NOT a prerelease
# X.Y.Z-alpha, X.Y.Z-rc1, etc. ARE prereleases
if echo "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+-[0-9]+$'; then
# Numeric extension like 0.1.2-4 - NOT a prerelease
IS_PRERELEASE="false"
elif echo "$VERSION" | grep -qE '-'; then
# Has hyphen but not numeric - IS a prerelease (e.g., -rc1, -alpha)
IS_PRERELEASE="true"
else
# No hyphen - NOT a prerelease
IS_PRERELEASE="false"
fi

echo "version_tag=${VERSION_TAG}" >> $GITHUB_OUTPUT
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "is_prerelease=${IS_PRERELEASE}" >> $GITHUB_OUTPUT
echo "Version Tag: ${VERSION_TAG}"
echo "Version: ${VERSION}"
echo "Is Prerelease: ${IS_PRERELEASE}"

- name: Check if release already exists
id: check_release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if gh release view ${{ steps.version.outputs.version_tag }} &>/dev/null; then
echo "Release ${{ steps.version.outputs.version_tag }} already exists"
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "Release ${{ steps.version.outputs.version_tag }} does not exist"
echo "exists=false" >> $GITHUB_OUTPUT
fi

- name: Download native binaries from gopher-orch
id: gopher_orch
if: steps.check_release.outputs.exists != 'true'
env:
GH_TOKEN: ${{ secrets.GOPHER_ORCH_TOKEN }}
run: |
VERSION="${{ steps.version.outputs.version }}"

# Extract base version (X.Y.Z) from extended version (X.Y.Z-E)
# e.g., 0.1.2-3 -> 0.1.2
if echo "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+-[0-9]+$'; then
BASE_VERSION=$(echo "$VERSION" | sed -E 's/^([0-9]+\.[0-9]+\.[0-9]+)-[0-9]+$/\1/')
else
BASE_VERSION="$VERSION"
fi

GOPHER_ORCH_TAG="v${BASE_VERSION}"
echo "gopher_orch_version=${GOPHER_ORCH_TAG}" >> $GITHUB_OUTPUT
echo "Downloading native binaries from gopher-orch ${GOPHER_ORCH_TAG}..."

mkdir -p downloads
gh release download "${GOPHER_ORCH_TAG}" \
-R GopherSecurity/gopher-orch \
-D downloads \
-p "libgopher-orch-*.tar.gz" \
-p "libgopher-orch-*.zip"

- name: Prepare release assets
if: steps.check_release.outputs.exists != 'true'
run: |
mkdir -p release-assets
cp downloads/* release-assets/

- name: Generate release notes
if: steps.check_release.outputs.exists != 'true'
run: |
VERSION="${{ steps.version.outputs.version }}"
VERSION_TAG="${{ steps.version.outputs.version_tag }}"

cat > RELEASE_NOTES.md << EOF
## gopher-mcp-go ${VERSION_TAG}

Go SDK for gopher-orch orchestration framework.

### Installation

\`\`\`bash
# Install Go module
go get github.com/GopherSecurity/gopher-mcp-go@${VERSION_TAG}

# Download native library for your platform
# macOS (Apple Silicon)
gh release download ${VERSION_TAG} -R GopherSecurity/gopher-mcp-go -p "libgopher-orch-macos-arm64.tar.gz"
tar -xzf libgopher-orch-macos-arm64.tar.gz -C /usr/local

# macOS (Intel)
gh release download ${VERSION_TAG} -R GopherSecurity/gopher-mcp-go -p "libgopher-orch-macos-x64.tar.gz"
tar -xzf libgopher-orch-macos-x64.tar.gz -C /usr/local

# Linux (x64)
gh release download ${VERSION_TAG} -R GopherSecurity/gopher-mcp-go -p "libgopher-orch-linux-x64.tar.gz"
sudo tar -xzf libgopher-orch-linux-x64.tar.gz -C /usr/local

# Linux (arm64)
gh release download ${VERSION_TAG} -R GopherSecurity/gopher-mcp-go -p "libgopher-orch-linux-arm64.tar.gz"
sudo tar -xzf libgopher-orch-linux-arm64.tar.gz -C /usr/local
\`\`\`

### Environment Setup

\`\`\`bash
export CGO_CFLAGS="-I/usr/local/include"
export CGO_LDFLAGS="-L/usr/local/lib -lgopher-orch"
export DYLD_LIBRARY_PATH="/usr/local/lib:\$DYLD_LIBRARY_PATH" # macOS
export LD_LIBRARY_PATH="/usr/local/lib:\$LD_LIBRARY_PATH" # Linux
\`\`\`

### Build Information

- **Version:** ${VERSION}
- **gopher-orch:** ${{ steps.gopher_orch.outputs.gopher_orch_version }}
- **Commit:** ${{ github.sha }}
- **Date:** $(date -u +"%Y-%m-%d %H:%M:%S UTC")

EOF

# Extract changelog content
if [ -f "CHANGELOG.md" ]; then
echo "### What's Changed" >> RELEASE_NOTES.md
echo "" >> RELEASE_NOTES.md

# Get content from the version section
sed -n "/^## \[${VERSION}\]/,/^## \[/p" CHANGELOG.md | \
grep -v "^## \[" | \
head -30 >> RELEASE_NOTES.md || true
fi

# Add comparison link
PREV_TAG=$(git tag --sort=-creatordate | grep -v "^${VERSION_TAG}$" | head -1)
if [ -n "$PREV_TAG" ]; then
echo "" >> RELEASE_NOTES.md
echo "**Full Changelog**: https://github.com/${{ github.repository }}/compare/${PREV_TAG}...${VERSION_TAG}" >> RELEASE_NOTES.md
fi

echo "=== Release Notes ==="
cat RELEASE_NOTES.md

- name: Create GitHub Release
if: steps.check_release.outputs.exists != 'true'
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.version.outputs.version_tag }}
name: gopher-mcp-go ${{ steps.version.outputs.version_tag }}
body_path: RELEASE_NOTES.md
draft: false
prerelease: ${{ steps.version.outputs.is_prerelease == 'true' }}
files: release-assets/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Summary
run: |
echo "## Release Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "- **Version:** ${{ steps.version.outputs.version_tag }}" >> $GITHUB_STEP_SUMMARY
echo "- **Release URL:** https://github.com/${{ github.repository }}/releases/tag/${{ steps.version.outputs.version_tag }}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Native Libraries" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [ -d "release-assets" ]; then
ls release-assets/ | while read file; do
echo "- \`${file}\`" >> $GITHUB_STEP_SUMMARY
done
fi

test:
name: Run Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.21'

- name: Run tests (without native library)
run: |
# Run tests that don't require native library
go test ./... -v -short || echo "Some tests may require native library"

notify:
name: Notify on Failure
needs: [release, test]
runs-on: ubuntu-latest
if: failure()
steps:
- name: Report failure
run: |
echo "Release workflow failed!"
echo "Check the logs for details."
1 change: 1 addition & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[submodule "third_party/gopher-orch"]
path = third_party/gopher-orch
url = https://github.com/GopherSecurity/gopher-orch.git
branch = br_release
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added
- Initial release of gopher-mcp-go SDK
- Go bindings for gopher-orch native library
- OAuth 2.0 authentication support (AuthContext, WwwAuthenticate)
- MCP (Model Context Protocol) client implementation

### Changed
- Updated module path to github.com/GopherSecurity/gopher-mcp-go

---

[Unreleased]: https://github.com/GopherSecurity/gopher-mcp-go/compare/HEAD
62 changes: 51 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# gopher-orch - Go SDK
# gopher-mcp-go

Go SDK for Gopher Orch - AI Agent orchestration framework with native C++ performance.
Go SDK for Gopher MCP - AI Agent orchestration framework with native C++ performance.

## Table of Contents

Expand Down Expand Up @@ -45,6 +45,7 @@ Go SDK for Gopher Orch - AI Agent orchestration framework with native C++ perfor
- **Native Performance** - Powered by C++ core with Go bindings via CGO
- **AI Agent Framework** - Build intelligent agents with LLM integration
- **MCP Protocol** - Model Context Protocol client and server support
- **OAuth 2.0 Authentication** - JWT token validation with JWKS support
- **Tool Orchestration** - Manage and execute tools across multiple MCP servers
- **State Management** - Built-in state graph for complex workflows
- **Type Safety** - Full Go type safety with idiomatic patterns
Expand Down Expand Up @@ -95,10 +96,10 @@ This SDK is ideal for:

## Installation

### Option 1: Go Modules (when published)
### Option 1: Go Modules

```bash
go get github.com/GopherSecurity/gopher-orch-go
go get github.com/GopherSecurity/gopher-mcp-go
```

### Option 2: Build from Source
Expand All @@ -114,7 +115,7 @@ import (
"fmt"
"log"

"github.com/GopherSecurity/gopher-orch-go/src"
"github.com/GopherSecurity/gopher-mcp-go/src"
)

func main() {
Expand Down Expand Up @@ -289,7 +290,7 @@ export LD_LIBRARY_PATH=/path/to/lib:$LD_LIBRARY_PATH
The main type for creating and running AI agents:

```go
import "github.com/GopherSecurity/gopher-orch-go/src"
import "github.com/GopherSecurity/gopher-mcp-go/src"

// Initialize the library (called automatically on first Create)
src.Init()
Expand Down Expand Up @@ -359,8 +360,8 @@ The SDK provides typed errors for different failure scenarios:

```go
import (
"github.com/GopherSecurity/gopher-orch-go/src"
"github.com/GopherSecurity/gopher-orch-go/src/errors"
"github.com/GopherSecurity/gopher-mcp-go/src"
"github.com/GopherSecurity/gopher-mcp-go/src/errors"
)

agent, err := src.Create(config)
Expand Down Expand Up @@ -392,7 +393,7 @@ import (
"log"
"os"

"github.com/GopherSecurity/gopher-orch-go/src"
"github.com/GopherSecurity/gopher-mcp-go/src"
)

func main() {
Expand Down Expand Up @@ -423,7 +424,7 @@ import (
"fmt"
"log"

"github.com/GopherSecurity/gopher-orch-go/src"
"github.com/GopherSecurity/gopher-mcp-go/src"
)

const serverConfig = `{
Expand Down Expand Up @@ -487,6 +488,45 @@ DYLD_LIBRARY_PATH=native/lib \
go run examples/client_example_json.go
```

### Auth Example (OAuth 2.0 MCP Server)

The auth example demonstrates building an MCP server with OAuth 2.0 authentication:

```bash
cd examples/auth
./run_example.sh
```

**Features:**
- JWT token validation using JWKS
- OAuth 2.0 protected resource metadata
- Scope-based tool authorization
- Configurable auth server integration

**What it does:**
1. Downloads the latest SDK from GitHub releases
2. Downloads native libraries for your platform
3. Builds and runs an authenticated MCP server

**Server Endpoints:**
- `/health` - Health check
- `/mcp` - MCP endpoint (requires authentication)
- `/.well-known/oauth-protected-resource` - OAuth discovery

**Configuration:**
Edit `server.config` to configure:
- Auth server URL (JWKS URI, issuer)
- Server host/port
- Tool scope requirements

```bash
# Run without authentication (for testing)
./run_example.sh --no-auth

# Run on custom port
./run_example.sh --port 8080
```

---

## Development
Expand Down Expand Up @@ -653,7 +693,7 @@ Contributions are welcome! Please read our contributing guidelines.

## License

MIT License - see [LICENSE](LICENSE) file for details.
Apache License 2.0 - see [LICENSE](LICENSE) file for details.

## Links

Expand Down
Loading