Skip to content

Commit e3795f3

Browse files
authored
Merge pull request #7 from hummingbot/mcp-workflow
add publish mcp workflow
2 parents ad24846 + 5f4ef44 commit e3795f3

File tree

2 files changed

+145
-0
lines changed

2 files changed

+145
-0
lines changed

.github/workflows/publish-mcp.yml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
name: Publish MCP server
2+
3+
on:
4+
release:
5+
types: [published]
6+
push:
7+
tags:
8+
- "v*.*.*"
9+
10+
permissions:
11+
contents: read
12+
id-token: write # required for GitHub OIDC to the MCP Registry
13+
14+
env:
15+
IMAGE_NAME: hummingbot/hummingbot-mcp
16+
SERVER_NAME: io.github.hummingbot/mcp
17+
SERVER_JSON: server.json
18+
19+
jobs:
20+
build-and-push-image:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- name: Derive version/tag
27+
id: vars
28+
run: |
29+
TAG="${GITHUB_REF_NAME#refs/tags/}"
30+
# Sanitize: strip leading "v" for server.json version fields
31+
SANITIZED="${TAG#v}"
32+
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
33+
echo "sanitized=${SANITIZED}" >> "$GITHUB_OUTPUT"
34+
35+
- name: Set up QEMU (cross-arch emulation)
36+
uses: docker/setup-qemu-action@v3
37+
38+
- name: Set up Docker Buildx
39+
uses: docker/setup-buildx-action@v3
40+
41+
- name: Log in to Docker Hub
42+
uses: docker/login-action@v3
43+
with:
44+
registry: docker.io
45+
username: ${{ secrets.DOCKERHUB_USERNAME }}
46+
password: ${{ secrets.DOCKERHUB_TOKEN }}
47+
48+
- name: Build & push multi-arch image
49+
uses: docker/build-push-action@v6
50+
with:
51+
context: .
52+
push: true
53+
platforms: linux/amd64,linux/arm64
54+
tags: |
55+
docker.io/${{ env.IMAGE_NAME }}:${{ steps.vars.outputs.tag }}
56+
docker.io/${{ env.IMAGE_NAME }}:latest
57+
labels: |
58+
io.modelcontextprotocol.server.name=${{ env.SERVER_NAME }}
59+
60+
publish-to-mcp-registry:
61+
needs: build-and-push-image
62+
runs-on: ubuntu-latest
63+
steps:
64+
- name: Checkout
65+
uses: actions/checkout@v4
66+
67+
- name: Install deps (jq + Homebrew)
68+
run: |
69+
sudo apt-get update -y
70+
sudo apt-get install -y jq build-essential curl git
71+
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
72+
echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"' >> "$HOME/.bashrc"
73+
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
74+
brew install mcp-publisher
75+
76+
- name: Derive version/tag (again in this job)
77+
id: vars
78+
run: |
79+
TAG="${GITHUB_REF_NAME#refs/tags/}"
80+
SANITIZED="${TAG#v}"
81+
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
82+
echo "sanitized=${SANITIZED}" >> "$GITHUB_OUTPUT"
83+
84+
- name: Sync server.json version to tag
85+
run: |
86+
jq --arg v "${{ steps.vars.outputs.sanitized }}" \
87+
'.version=$v | .packages[0].version=$v' \
88+
"${{ env.SERVER_JSON }}" > server.json.tmp
89+
mv server.json.tmp "${{ env.SERVER_JSON }}"
90+
echo "Updated server.json:"
91+
cat "${{ env.SERVER_JSON }}"
92+
93+
- name: Login to MCP Registry (GitHub OIDC)
94+
run: |
95+
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
96+
mcp-publisher login github-oidc
97+
98+
- name: Publish server to MCP Registry
99+
env:
100+
MCP_REGISTRY: https://registry.modelcontextprotocol.io
101+
run: |
102+
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
103+
mcp-publisher publish --registry "$MCP_REGISTRY" --file "${{ env.SERVER_JSON }}"

server.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-09-29/server.schema.json",
3+
"name": "io.github.hummingbot/mcp",
4+
"description": "MCP server exposing Hummingbot API for automated multi-exchange trading",
5+
"repository": {
6+
"url": "https://github.com/hummingbot/mcp",
7+
"source": "github"
8+
},
9+
"version": "0.1.0",
10+
"packages": [
11+
{
12+
"registryType": "oci",
13+
"registryBaseUrl": "https://docker.io",
14+
"identifier": "hummingbot/hummingbot-mcp",
15+
"version": "0.1.0",
16+
"transport": { "type": "stdio" },
17+
"environmentVariables": [
18+
{
19+
"name": "HUMMINGBOT_API_URL",
20+
"description": "Base URL of the Hummingbot API (e.g., http://host.docker.internal:8820 or http://localhost:8000)",
21+
"isRequired": true,
22+
"format": "string",
23+
"isSecret": false
24+
},
25+
{
26+
"name": "HUMMINGBOT_USERNAME",
27+
"description": "Hummingbot API username",
28+
"isRequired": true,
29+
"format": "string",
30+
"isSecret": true
31+
},
32+
{
33+
"name": "HUMMINGBOT_PASSWORD",
34+
"description": "Hummingbot API password",
35+
"isRequired": true,
36+
"format": "string",
37+
"isSecret": true
38+
}
39+
]
40+
}
41+
]
42+
}

0 commit comments

Comments
 (0)