Skip to content

Commit 831159b

Browse files
committed
chore: initialize project with changelog, versioning, and CI workflows
- Added CHANGELOG.md to document project changes following Semantic Versioning. - Updated pyproject.toml with project metadata, dependencies, and versioning configuration. - Included GitHub Actions workflows for pre-release and release processes. - Set initial version to 0.1.0 in src/__init__.py and pyproject.toml. - Enhanced development dependencies in requirements-dev.txt for semantic release.
1 parent e3a3de4 commit 831159b

File tree

6 files changed

+258
-1
lines changed

6 files changed

+258
-1
lines changed

.github/workflows/pr-release.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: PR Pre-release
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
7+
permissions:
8+
contents: write
9+
pull-requests: write
10+
issues: write
11+
12+
jobs:
13+
pre-release:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
ref: ${{ github.event.pull_request.head.ref }}
21+
token: ${{ secrets.GITHUB_TOKEN }}
22+
23+
- name: Set up Python
24+
uses: actions/setup-python@v4
25+
with:
26+
python-version: "3.11"
27+
cache: 'pip'
28+
29+
- name: Install dependencies
30+
run: |
31+
python -m pip install --upgrade pip
32+
pip install python-semantic-release
33+
34+
- name: Configure git
35+
run: |
36+
git config --global user.name "github-actions[bot]"
37+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
38+
39+
- name: Generate RC version
40+
id: version
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
run: |
44+
# Get the current version
45+
CURRENT_VERSION=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])")
46+
47+
# Generate RC version based on PR number
48+
RC_VERSION="${CURRENT_VERSION}-rc.${{ github.event.pull_request.number }}"
49+
echo "RC_VERSION=${RC_VERSION}" >> $GITHUB_OUTPUT
50+
51+
# Update version in files
52+
sed -i "s/version = \"${CURRENT_VERSION}\"/version = \"${RC_VERSION}\"/" pyproject.toml
53+
sed -i "s/__version__ = \"${CURRENT_VERSION}\"/__version__ = \"${RC_VERSION}\"/" src/__init__.py
54+
55+
# Create pre-release tag
56+
git add pyproject.toml src/__init__.py
57+
git commit -m "chore: bump version to ${RC_VERSION} [skip ci]" || echo "No changes to commit"
58+
git tag -a "v${RC_VERSION}" -m "Pre-release version ${RC_VERSION}"
59+
60+
- name: Create GitHub pre-release
61+
env:
62+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63+
run: |
64+
gh release create "v${{ steps.version.outputs.RC_VERSION }}" \
65+
--title "Pre-release v${{ steps.version.outputs.RC_VERSION }}" \
66+
--notes "Pre-release version for PR #${{ github.event.pull_request.number }}" \
67+
--prerelease \
68+
--target ${{ github.event.pull_request.head.sha }}
69+
70+
- name: Comment on PR
71+
uses: actions/github-script@v7
72+
with:
73+
script: |
74+
const rcVersion = '${{ steps.version.outputs.RC_VERSION }}';
75+
const comment = `🚀 **Pre-release version created: \`v${rcVersion}\`**
76+
77+
This pre-release version can be used for testing this PR.
78+
79+
**Docker image**: \`ghcr.io/${{ github.repository }}:v${rcVersion}\``;
80+
81+
github.rest.issues.createComment({
82+
issue_number: context.issue.number,
83+
owner: context.repo.owner,
84+
repo: context.repo.repo,
85+
body: comment
86+
});

.github/workflows/release.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: write
10+
packages: write
11+
pull-requests: write
12+
issues: write
13+
14+
jobs:
15+
release:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
token: ${{ secrets.GITHUB_TOKEN }}
23+
24+
- name: Set up Python
25+
uses: actions/setup-python@v4
26+
with:
27+
python-version: "3.11"
28+
cache: 'pip'
29+
30+
- name: Install dependencies
31+
run: |
32+
python -m pip install --upgrade pip
33+
pip install python-semantic-release
34+
35+
- name: Configure git
36+
run: |
37+
git config --global user.name "github-actions[bot]"
38+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
39+
40+
- name: Run semantic release
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
run: |
44+
semantic-release version
45+
semantic-release publish

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
<!--next-version-placeholder-->
9+
10+
## [0.1.0] - 2025-01-20
11+
12+
### Added
13+
- Initial release of MCP OAuth Gateway
14+
- OAuth 2.1 authorization server implementation
15+
- Dynamic Client Registration (RFC 7591)
16+
- MCP service proxy with user context injection
17+
- Support for Google, GitHub, Okta, and custom OAuth providers
18+
- Configurable storage backends (Memory, Redis, Vault)
19+
- Docker multi-platform support
20+
- Comprehensive test suite
21+
- GitHub Actions CI/CD pipeline

pyproject.toml

Lines changed: 101 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,104 @@ ignore = [
4343
"__init__.py" = ["F401"]
4444

4545
[tool.ruff.lint.isort]
46-
known-first-party = ["src"]
46+
known-first-party = ["src"]
47+
48+
[build-system]
49+
requires = ["setuptools>=61.0", "wheel"]
50+
build-backend = "setuptools.build_meta"
51+
52+
[project]
53+
name = "mcp-oauth-gateway"
54+
version = "0.1.0"
55+
description = "OAuth 2.1 authorization server for Model Context Protocol (MCP) services"
56+
readme = "README.md"
57+
license = { text = "MIT" }
58+
authors = [
59+
{ name = "MCP OAuth Gateway Contributors" },
60+
]
61+
classifiers = [
62+
"Development Status :: 4 - Beta",
63+
"Environment :: Web Environment",
64+
"Framework :: FastAPI",
65+
"Intended Audience :: Developers",
66+
"License :: OSI Approved :: MIT License",
67+
"Operating System :: OS Independent",
68+
"Programming Language :: Python :: 3",
69+
"Programming Language :: Python :: 3.10",
70+
"Programming Language :: Python :: 3.11",
71+
"Programming Language :: Python :: 3.12",
72+
"Topic :: Internet :: WWW/HTTP :: HTTP Servers",
73+
"Topic :: Security",
74+
"Topic :: Software Development :: Libraries :: Python Modules",
75+
]
76+
requires-python = ">=3.10"
77+
dependencies = [
78+
"fastapi>=0.104.1",
79+
"uvicorn[standard]>=0.24.0",
80+
"python-multipart>=0.0.6",
81+
"python-jose[cryptography]>=3.3.0",
82+
"cryptography>=45.0.0",
83+
"pyyaml>=6.0.1",
84+
"pydantic>=2.5.0",
85+
"pydantic-settings>=2.1.0",
86+
"python-dotenv>=1.0.0",
87+
"httpx>=0.25.2",
88+
]
89+
90+
[project.optional-dependencies]
91+
dev = [
92+
"pytest>=7.0.0",
93+
"pytest-asyncio>=0.23.0",
94+
"pytest-httpx>=0.21.0",
95+
"pytest-cov>=4.0.0",
96+
"black>=23.0.0",
97+
"ruff>=0.1.0",
98+
"mypy>=1.0.0",
99+
"bandit[toml]>=1.7.0",
100+
"types-PyYAML>=6.0.0",
101+
"types-requests>=2.28.0",
102+
"python-semantic-release>=9.0.0",
103+
]
104+
redis = [
105+
"redis[hiredis]>=4.5.0",
106+
"aioredis>=2.0.0",
107+
]
108+
vault = [
109+
"hvac>=1.2.0",
110+
"aiohttp>=3.8.0",
111+
]
112+
all = [
113+
"mcp-oauth-gateway[dev,redis,vault]",
114+
]
115+
116+
[project.urls]
117+
"Homepage" = "https://github.com/akshay5995/mcp-oauth-gateway"
118+
"Bug Reports" = "https://github.com/akshay5995/mcp-oauth-gateway/issues"
119+
"Source" = "https://github.com/akshay5995/mcp-oauth-gateway"
120+
"Documentation" = "https://github.com/akshay5995/mcp-oauth-gateway#readme"
121+
122+
[project.scripts]
123+
mcp-oauth-gateway = "src.gateway:main"
124+
125+
[tool.semantic_release]
126+
version_toml = ["pyproject.toml:project.version"]
127+
version_variables = ["src/__init__.py:__version__"]
128+
build_command = "pip install build && python -m build"
129+
dist_path = "dist/"
130+
upload_to_pypi = false
131+
upload_to_release = true
132+
remove_dist = false
133+
changelog_file = "CHANGELOG.md"
134+
changelog_placeholder = "<!--next-version-placeholder-->"
135+
136+
[tool.semantic_release.commit_parser_options]
137+
allowed_tags = ["build", "chore", "ci", "docs", "feat", "fix", "perf", "style", "refactor", "test"]
138+
minor_tags = ["feat"]
139+
patch_tags = ["fix", "perf"]
140+
141+
[tool.semantic_release.remote.token]
142+
env = "GITHUB_TOKEN"
143+
144+
[tool.semantic_release.publish]
145+
dist_glob_patterns = ["dist/*"]
146+
upload_to_vcs_release = true

requirements-dev.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ aioredis>=2.0.0 # Legacy Redis library (Python 3.9-3.10)
2828
hvac>=1.2.0 # HashiCorp Vault client
2929
aiohttp>=3.8.0 # Vault async HTTP dependency
3030

31+
# Semantic versioning and releases
32+
python-semantic-release>=9.0.0
33+
3134
# Documentation (optional)
3235
# sphinx>=6.0.0
3336
# sphinx-rtd-theme>=1.0.0

src/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
# MCP OAuth Gateway
2+
3+
__version__ = "0.1.0"

0 commit comments

Comments
 (0)