Skip to content

Commit 5f88878

Browse files
authored
Merge branch 'main' into fix/sbom
2 parents 56df3cd + b32f6e9 commit 5f88878

File tree

176 files changed

+13088
-5114
lines changed

Some content is hidden

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

176 files changed

+13088
-5114
lines changed

.bumpversion.cfg

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,25 @@
11
[bumpversion]
2-
current_version = 0.1.0
3-
commit = False
4-
tag = False
5-
sign-tags = True
6-
tag_name = v{new_version} # tag format (only used if you flip tag=True later)
7-
8-
# SemVer parsing/serialising
9-
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)
2+
current_version = 0.1.1
3+
commit = False
4+
tag = False
5+
sign-tags = True
6+
tag_name = v{new_version} # tag format (only used if you flip tag=True later)
7+
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)
108
serialize =
119
{major}.{minor}.{patch}
1210

1311
[bumpversion:file:mcpgateway/__init__.py]
14-
search = __version__ = "{current_version}"
12+
search = __version__ = "{current_version}"
1513
replace = __version__ = "{new_version}"
1614

1715
[bumpversion:file:Containerfile]
18-
search = version="{current_version}"
16+
search = version="{current_version}"
1917
replace = version="{new_version}"
2018

2119
[bumpversion:file:Containerfile.lite]
22-
search = version="{current_version}"
20+
search = version="{current_version}"
2321
replace = version="{new_version}"
2422

2523
[bumpversion:file:pyproject.toml]
26-
search = version = "{current_version}"
24+
search = version = "{current_version}"
2725
replace = version = "{new_version}"

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@
2525
},
2626
"remoteEnv": {
2727
"MCPGATEWAY_DEV_MODE": "true",
28-
"VENV_DIR": "/Users/mg/.venv/mcpgateway"
28+
"VENV_DIR": "$HOME/.venv/mcpgateway"
2929
}
3030
}

.devcontainer/postCreateCommand.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ fi
1111
make install-dev
1212

1313
# Run tests to verify setup
14-
make test
14+
# make test
1515

1616
echo "Devcontainer setup complete."
1717

.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
Dockerfile
2+
Dockerfile.*
3+
Containerfile.*
4+
.devcontainer
15
.github
26
docker-compose.yml
37
podman-compose-sonarqube.yaml

.env.example

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,18 @@ WEBSOCKET_PING_INTERVAL=30
140140
# SSE client retry timeout (milliseconds)
141141
SSE_RETRY_TIMEOUT=5000
142142

143+
144+
#####################################
145+
# Streamabe HTTP Transport Configuration
146+
#####################################
147+
148+
# Set False to use stateless sessions without event store and True for stateful sessions
149+
USE_STATEFUL_SESSIONS=false
150+
151+
# Set true for JSON responses, false for SSE streams
152+
JSON_RESPONSE_ENABLED=true
153+
154+
143155
#####################################
144156
# Federation
145157
#####################################

.github/CODEOWNERS

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
# All files in the repo
22
* @crivetimihai
33

4-
# Ownership for the mcpgateway-wrapper
5-
/mcpgateway-wrapper/ @crivetimihai @kevalmahajan @madhav165
6-
74
# Ownership for all tests
85
/tests/ @crivetimihai @kevalmahajan @madhav165

.github/ISSUE_TEMPLATE/bug-report-code.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Select the area of the project impacted:
1717

1818
- [ ] `mcpgateway` - API
1919
- [ ] `mcpgateway` - UI (admin panel)
20-
- [ ] `mcpgateway-wrapper` - stdio wrapper
20+
- [ ] `mcpgateway.wrapper` - stdio wrapper
2121
- [ ] Federation or Transports
2222
- [ ] CLI, Makefiles, or shell scripts
2323
- [ ] Container setup (Docker/Podman/Compose)

.github/tools/cleanup.sh

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
#!/usr/bin/env bash
2+
#───────────────────────────────────────────────────────────────────────────────
3+
# Script : cleanup.sh
4+
# Author : Mihai Criveti
5+
# Purpose: Prune old or unused GHCR container versions for IBM's MCP Context Forge
6+
# Copyright 2025
7+
# SPDX-License-Identifier: Apache-2.0
8+
#
9+
# Description:
10+
# This script safely manages container versions in GitHub Container Registry
11+
# (ghcr.io) under the IBM organization, specifically targeting the
12+
# `mcp-context-forge` package. It supports interactive and non-interactive
13+
# deletion modes to help you keep the container registry clean.
14+
#
15+
# Features:
16+
# • Dry-run by default to avoid accidental deletion
17+
# • Tag whitelisting with regular expression matching
18+
# • GitHub CLI integration with scope validation
19+
# • CI/CD-compatible via environment overrides
20+
#
21+
# Requirements:
22+
# • GitHub CLI (gh) v2.x with appropriate scopes
23+
# • jq (command-line JSON processor)
24+
#
25+
# Required Token Scopes:
26+
# delete:packages
27+
#
28+
# Authentication Notes:
29+
# Authenticate with:
30+
# gh auth refresh -h github.com -s read:packages,delete:packages
31+
# Or:
32+
# gh auth logout
33+
# gh auth login --scopes "read:packages,delete:packages,write:packages,repo,read:org,gist"
34+
#
35+
# Verify authentication with:
36+
# gh auth status -t
37+
#
38+
# Environment Variables:
39+
# GITHUB_TOKEN / GH_TOKEN : GitHub token with required scopes
40+
# DRY_RUN : Set to "false" to enable actual deletions (default: true)
41+
#
42+
# Usage:
43+
# ./cleanup.sh # Dry-run with confirmation prompt
44+
# DRY_RUN=false ./cleanup.sh --yes # Actual deletion without prompt (for CI)
45+
#
46+
#───────────────────────────────────────────────────────────────────────────────
47+
48+
set -euo pipefail
49+
50+
##############################################################################
51+
# 1. PICK A TOKEN
52+
##############################################################################
53+
NEEDED_SCOPES="delete:packages"
54+
55+
if [[ -n "${GITHUB_TOKEN:-}" ]]; then
56+
TOKEN="$GITHUB_TOKEN"
57+
elif [[ -n "${GH_TOKEN:-}" ]]; then
58+
TOKEN="$GH_TOKEN"
59+
else
60+
# fall back to whatever gh already has
61+
if ! TOKEN=$(gh auth token 2>/dev/null); then
62+
echo "❌ No token exported and gh not logged in. Fix with:"
63+
echo " gh auth login (or export GITHUB_TOKEN)"
64+
exit 1
65+
fi
66+
fi
67+
export GH_TOKEN="$TOKEN" # gh api uses this
68+
69+
# Fixed scope checking - check for both required scopes individually
70+
if scopes=$(gh auth status --show-token 2>/dev/null | grep -oP 'Token scopes: \K.*' || echo ""); then
71+
missing_scopes=()
72+
73+
# if ! echo "$scopes" | grep -q "read:packages"; then
74+
# missing_scopes+=("read:packages")
75+
# fi
76+
77+
if ! echo "$scopes" | grep -q "delete:packages"; then
78+
missing_scopes+=("delete:packages")
79+
fi
80+
81+
if [[ ${#missing_scopes[@]} -gt 0 ]]; then
82+
echo "⚠️ Your token scopes are [$scopes] – but you're missing: [$(IFS=','; echo "${missing_scopes[*]}")]"
83+
echo " Run: gh auth refresh -h github.com -s $NEEDED_SCOPES"
84+
exit 1
85+
fi
86+
else
87+
echo "⚠️ Could not verify token scopes. Proceeding anyway..."
88+
fi
89+
90+
##############################################################################
91+
# 2. CONFIG
92+
##############################################################################
93+
ORG="ibm"
94+
PKG="mcp-context-forge"
95+
KEEP_TAGS=( "0.1.0" "v0.1.0" "0.1.1" "v0.1.1" "latest" )
96+
PER_PAGE=100
97+
98+
DRY_RUN=${DRY_RUN:-true} # default safe
99+
ASK_CONFIRM=true
100+
[[ ${1:-} == "--yes" ]] && ASK_CONFIRM=false
101+
KEEP_REGEX="^($(IFS='|'; echo "${KEEP_TAGS[*]}"))$"
102+
103+
##############################################################################
104+
# 3. MAIN
105+
##############################################################################
106+
delete_ids=()
107+
108+
echo "📦 Scanning ghcr.io/${ORG}/${PKG}"
109+
110+
# Process versions and collect IDs to delete
111+
while IFS= read -r row; do
112+
id=$(jq -r '.id' <<<"$row")
113+
digest=$(jq -r '.digest' <<<"$row")
114+
tags_csv=$(jq -r '.tags | join(",")' <<<"$row")
115+
keep=$(jq -e --arg re "$KEEP_REGEX" 'any(.tags[]?; test($re))' <<<"$row" 2>/dev/null) || keep=false
116+
117+
if [[ $keep == true ]]; then
118+
printf "✅ KEEP %s [%s]\n" "$digest" "$tags_csv"
119+
else
120+
printf "🗑️ DELETE %s [%s]\n" "$digest" "$tags_csv"
121+
delete_ids+=("$id")
122+
fi
123+
done < <(gh api -H "Accept: application/vnd.github+json" \
124+
"/orgs/${ORG}/packages/container/${PKG}/versions?per_page=${PER_PAGE}" \
125+
--paginate | \
126+
jq -cr --arg re "$KEEP_REGEX" '
127+
.[] |
128+
{
129+
id,
130+
digest: .metadata.container.digest,
131+
tags: (.metadata.container.tags // [])
132+
}
133+
')
134+
135+
##############################################################################
136+
# 4. CONFIRMATION & DELETION
137+
##############################################################################
138+
if [[ ${#delete_ids[@]} -eq 0 ]]; then
139+
echo "✨ Nothing to delete!"
140+
exit 0
141+
fi
142+
143+
if [[ $DRY_RUN == true ]]; then
144+
if [[ $ASK_CONFIRM == true ]]; then
145+
echo
146+
read -rp "Proceed to delete the ${#delete_ids[@]} versions listed above? (y/N) " reply
147+
[[ $reply =~ ^[Yy]$ ]] || { echo "Aborted – nothing deleted."; exit 0; }
148+
fi
149+
echo "🚀 Re-running in destructive mode …"
150+
DRY_RUN=false exec "$0" --yes
151+
else
152+
echo "🗑️ Deleting ${#delete_ids[@]} versions..."
153+
for id in "${delete_ids[@]}"; do
154+
if gh api -X DELETE -H "Accept: application/vnd.github+json" \
155+
"/orgs/${ORG}/packages/container/${PKG}/versions/${id}" >/dev/null 2>&1; then
156+
echo "✅ Deleted version ID: $id"
157+
else
158+
echo "❌ Failed to delete version ID: $id"
159+
fi
160+
done
161+
echo "Done."
162+
fi

.github/workflows/docker-release.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
#
55
# This workflow re-tags a Docker image (built by a previous workflow)
66
# when a GitHub Release is published, giving it a semantic version tag
7-
# like `v0.1.0`. It assumes the CI build has already pushed an image
7+
# like `v0.1.1`. It assumes the CI build has already pushed an image
88
# tagged with the commit SHA, and that all checks on that commit passed.
99
#
1010
# ➤ Trigger: Release published (e.g. from GitHub UI or `gh release` CLI)
1111
# ➤ Assumes: Existing image tagged with the commit SHA is available
12-
# ➤ Result: Image re-tagged as `ghcr.io/OWNER/REPO:v0.1.0`
12+
# ➤ Result: Image re-tagged as `ghcr.io/OWNER/REPO:v0.1.1`
1313
#
1414
# ======================================================================
1515

@@ -25,7 +25,7 @@ on:
2525
workflow_dispatch:
2626
inputs:
2727
tag:
28-
description: 'Release tag (e.g., v0.1.0)'
28+
description: 'Release tag (e.g., v0.1.1)'
2929
required: true
3030
type: string
3131

@@ -76,8 +76,8 @@ jobs:
7676
# ----------------------------------------------------------------
7777
- name: ✅ Verify commit checks passed
7878
env:
79-
SHA: ${{ steps.meta.outputs.sha }}
80-
REPO: ${{ github.repository }}
79+
SHA: ${{ steps.meta.outputs.sha }}
80+
REPO: ${{ github.repository }}
8181
run: |
8282
set -euo pipefail
8383
STATUS=$(curl -sSL \

.github/workflows/ibm-cloud-code-engine.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@
3535
# not the secret value.
3636
# Triggers:
3737
# • Every push to `main`
38+
# • Expects a secret called `mcpgateway-dev` in Code Engine. Ex:
39+
# ibmcloud ce secret create \
40+
# --name mcpgateway-dev \
41+
# --from-env-file .env
3842
# ---------------------------------------------------------------
3943

4044
name: Deploy to IBM Code Engine
@@ -156,6 +160,7 @@ jobs:
156160
--name "$CODE_ENGINE_APP_NAME" \
157161
--image "$REGISTRY_HOSTNAME/$ICR_NAMESPACE/$IMAGE_NAME:$IMAGE_TAG" \
158162
--registry-secret "$CODE_ENGINE_REGISTRY_SECRET" \
163+
--env-from-secret mcpgateway-dev \
159164
--cpu 1 --memory 2G
160165
else
161166
echo "🆕 Creating new application…"
@@ -164,6 +169,7 @@ jobs:
164169
--image "$REGISTRY_HOSTNAME/$ICR_NAMESPACE/$IMAGE_NAME:$IMAGE_TAG" \
165170
--registry-secret "$CODE_ENGINE_REGISTRY_SECRET" \
166171
--port "$PORT" \
172+
--env-from-secret mcpgateway-dev \
167173
--cpu 1 --memory 2G
168174
fi
169175

0 commit comments

Comments
 (0)