authsome-mcp-proxy 0.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- authsome_mcp_proxy-0.4.0/.dockerignore +41 -0
- authsome_mcp_proxy-0.4.0/.env.example +6 -0
- authsome_mcp_proxy-0.4.0/.github/workflows/docker-publish.yml +85 -0
- authsome_mcp_proxy-0.4.0/.github/workflows/publish-test.yml +40 -0
- authsome_mcp_proxy-0.4.0/.github/workflows/publish.yml +42 -0
- authsome_mcp_proxy-0.4.0/.github/workflows/run-static.yml +53 -0
- authsome_mcp_proxy-0.4.0/.github/workflows/run-tests.yml +51 -0
- authsome_mcp_proxy-0.4.0/.gitignore +33 -0
- authsome_mcp_proxy-0.4.0/.markdownlint.json +5 -0
- authsome_mcp_proxy-0.4.0/.pre-commit-config.yaml +48 -0
- authsome_mcp_proxy-0.4.0/.vscode/launch.json +17 -0
- authsome_mcp_proxy-0.4.0/CONTRIBUTING.md +430 -0
- authsome_mcp_proxy-0.4.0/Dockerfile +105 -0
- authsome_mcp_proxy-0.4.0/LICENSE +201 -0
- authsome_mcp_proxy-0.4.0/PKG-INFO +750 -0
- authsome_mcp_proxy-0.4.0/README.md +739 -0
- authsome_mcp_proxy-0.4.0/authsome_mcp_proxy/__init__.py +9 -0
- authsome_mcp_proxy-0.4.0/authsome_mcp_proxy/__main__.py +554 -0
- authsome_mcp_proxy-0.4.0/authsome_mcp_proxy/config.py +252 -0
- authsome_mcp_proxy-0.4.0/authsome_mcp_proxy/external_oidc.py +548 -0
- authsome_mcp_proxy-0.4.0/authsome_mcp_proxy/inbound_auth.py +139 -0
- authsome_mcp_proxy-0.4.0/authsome_mcp_proxy/mcp_proxy.py +168 -0
- authsome_mcp_proxy-0.4.0/authsome_mcp_proxy/outbound_auth.py +220 -0
- authsome_mcp_proxy-0.4.0/docs/oauth-flow.md +344 -0
- authsome_mcp_proxy-0.4.0/examples/token_validating_upstream_mcp/.env.example +12 -0
- authsome_mcp_proxy-0.4.0/examples/token_validating_upstream_mcp/requirements.txt +1 -0
- authsome_mcp_proxy-0.4.0/examples/token_validating_upstream_mcp/upstream_mcp.py +76 -0
- authsome_mcp_proxy-0.4.0/pyproject.toml +107 -0
- authsome_mcp_proxy-0.4.0/tests/__init__.py +1 -0
- authsome_mcp_proxy-0.4.0/tests/test_config.py +184 -0
- authsome_mcp_proxy-0.4.0/tests/test_external_oidc.py +735 -0
- authsome_mcp_proxy-0.4.0/tests/test_external_oidc_integration.py +282 -0
- authsome_mcp_proxy-0.4.0/tests/test_inbound_auth.py +147 -0
- authsome_mcp_proxy-0.4.0/tests/test_main.py +696 -0
- authsome_mcp_proxy-0.4.0/tests/test_mcp_proxy.py +329 -0
- authsome_mcp_proxy-0.4.0/tests/test_outbound_auth.py +316 -0
- authsome_mcp_proxy-0.4.0/uv.lock +2044 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Docker build context exclusions.
|
|
2
|
+
#
|
|
3
|
+
# Note: `.git/` is intentionally NOT excluded — `uv-dynamic-versioning`
|
|
4
|
+
# needs it during the builder stage to derive the project version from the
|
|
5
|
+
# latest git tag. The final image does not include `.git/` (only the
|
|
6
|
+
# builder stage copies it; the production stage takes the resolved venv).
|
|
7
|
+
|
|
8
|
+
# Python build artifacts and caches
|
|
9
|
+
__pycache__/
|
|
10
|
+
*.py[oc]
|
|
11
|
+
*.egg-info/
|
|
12
|
+
build/
|
|
13
|
+
dist/
|
|
14
|
+
|
|
15
|
+
# Test / coverage artifacts
|
|
16
|
+
.pytest_cache/
|
|
17
|
+
.coverage
|
|
18
|
+
htmlcov/
|
|
19
|
+
|
|
20
|
+
# Linter / type-checker caches
|
|
21
|
+
.ruff_cache/
|
|
22
|
+
.mypy_cache/
|
|
23
|
+
.ty_cache/
|
|
24
|
+
|
|
25
|
+
# Local virtualenvs
|
|
26
|
+
.venv/
|
|
27
|
+
|
|
28
|
+
# Local env files — runtime config comes from container env vars / k8s secrets
|
|
29
|
+
.env
|
|
30
|
+
.env.local
|
|
31
|
+
|
|
32
|
+
# IDE / agent local state
|
|
33
|
+
.vscode/
|
|
34
|
+
.idea/
|
|
35
|
+
.claude/
|
|
36
|
+
|
|
37
|
+
# Local helper / debug scripts
|
|
38
|
+
inspect-*.bat
|
|
39
|
+
run-*.bat
|
|
40
|
+
*.log
|
|
41
|
+
*.mcpb
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
OIDC_ISSUER_URL="https://auth.company.com"
|
|
2
|
+
OIDC_CLIENT_ID="your-client-id"
|
|
3
|
+
OIDC_CLIENT_SECRET="your-client-secret" # optional for public OIDC clients that don't require any such
|
|
4
|
+
OIDC_SCOPES="openid profile"
|
|
5
|
+
OIDC_REDIRECT_URL="http://localhost:8080/auth/callback"
|
|
6
|
+
UPSTREAM_MCP_URL="https://mcp-upstream.company.com/mcp"
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
name: Build and Publish Docker Image
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
- feat/web-connector-proxy-support
|
|
8
|
+
tags:
|
|
9
|
+
- "v*"
|
|
10
|
+
pull_request:
|
|
11
|
+
branches:
|
|
12
|
+
- main
|
|
13
|
+
workflow_dispatch:
|
|
14
|
+
|
|
15
|
+
env:
|
|
16
|
+
REGISTRY: ghcr.io
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
build-and-push:
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
if: github.repository == 'stephaneberle9/authsome-mcp-proxy'
|
|
22
|
+
permissions:
|
|
23
|
+
contents: read
|
|
24
|
+
packages: write
|
|
25
|
+
id-token: write
|
|
26
|
+
attestations: write
|
|
27
|
+
|
|
28
|
+
steps:
|
|
29
|
+
- name: Checkout repository
|
|
30
|
+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
|
|
31
|
+
with:
|
|
32
|
+
# Full history + tags so uv-dynamic-versioning can derive the
|
|
33
|
+
# project version inside the Docker builder stage.
|
|
34
|
+
fetch-depth: 0
|
|
35
|
+
fetch-tags: true
|
|
36
|
+
|
|
37
|
+
- name: Set image name to lowercase
|
|
38
|
+
run: |
|
|
39
|
+
# Docker image names must be lowercase
|
|
40
|
+
echo "IMAGE_NAME=${GITHUB_REPOSITORY,,}" >> "$GITHUB_ENV"
|
|
41
|
+
|
|
42
|
+
- name: Setup Docker Buildx
|
|
43
|
+
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
|
|
44
|
+
|
|
45
|
+
- name: Log in to GitHub Container Registry
|
|
46
|
+
if: github.event_name != 'pull_request'
|
|
47
|
+
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0
|
|
48
|
+
with:
|
|
49
|
+
registry: ${{ env.REGISTRY }}
|
|
50
|
+
username: ${{ github.actor }}
|
|
51
|
+
password: ${{ secrets.GITHUB_TOKEN }}
|
|
52
|
+
|
|
53
|
+
- name: Extract metadata
|
|
54
|
+
id: meta
|
|
55
|
+
uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6.0.0
|
|
56
|
+
with:
|
|
57
|
+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
58
|
+
tags: |
|
|
59
|
+
type=ref,event=branch
|
|
60
|
+
type=ref,event=pr
|
|
61
|
+
type=semver,pattern={{version}}
|
|
62
|
+
type=semver,pattern={{major}}.{{minor}}
|
|
63
|
+
type=semver,pattern={{major}}
|
|
64
|
+
type=raw,value=latest,enable={{is_default_branch}}
|
|
65
|
+
|
|
66
|
+
- name: Build and push Docker image
|
|
67
|
+
id: push
|
|
68
|
+
uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0
|
|
69
|
+
with:
|
|
70
|
+
context: .
|
|
71
|
+
target: production
|
|
72
|
+
platforms: linux/amd64,linux/arm64
|
|
73
|
+
push: ${{ github.event_name != 'pull_request' }}
|
|
74
|
+
tags: ${{ steps.meta.outputs.tags }}
|
|
75
|
+
labels: ${{ steps.meta.outputs.labels }}
|
|
76
|
+
cache-from: type=gha
|
|
77
|
+
cache-to: type=gha,mode=max
|
|
78
|
+
|
|
79
|
+
- name: Generate artifact attestation
|
|
80
|
+
uses: actions/attest-build-provenance@a2bbfa25375fe432b6a289bc6b6cd05ecd0c4c32 # v4
|
|
81
|
+
if: github.event_name != 'pull_request'
|
|
82
|
+
with:
|
|
83
|
+
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
84
|
+
subject-digest: ${{ steps.push.outputs.digest }}
|
|
85
|
+
push-to-registry: true
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
name: Publish to TestPyPI
|
|
2
|
+
on:
|
|
3
|
+
workflow_dispatch:
|
|
4
|
+
|
|
5
|
+
jobs:
|
|
6
|
+
test-pypi-publish:
|
|
7
|
+
name: Upload to TestPyPI
|
|
8
|
+
runs-on: ubuntu-latest
|
|
9
|
+
permissions:
|
|
10
|
+
id-token: write # For PyPI's trusted publishing
|
|
11
|
+
steps:
|
|
12
|
+
- name: Checkout
|
|
13
|
+
uses: actions/checkout@v5
|
|
14
|
+
with:
|
|
15
|
+
fetch-depth: 0
|
|
16
|
+
fetch-tags: true
|
|
17
|
+
|
|
18
|
+
- name: "Install uv"
|
|
19
|
+
uses: astral-sh/setup-uv@v6
|
|
20
|
+
|
|
21
|
+
- name: Build
|
|
22
|
+
run: uv build
|
|
23
|
+
|
|
24
|
+
- name: Check version format
|
|
25
|
+
run: |
|
|
26
|
+
# Extract version from the built package
|
|
27
|
+
VERSION=$(ls dist/*.whl | head -n1 | sed -E 's/.*-([0-9].*)-.*/\1/')
|
|
28
|
+
echo "Package version: $VERSION"
|
|
29
|
+
|
|
30
|
+
# Check if version contains dev/post markers (development version)
|
|
31
|
+
if [[ "$VERSION" =~ (dev|post.*dev) ]]; then
|
|
32
|
+
echo "❌ ERROR: Cannot publish development version: $VERSION"
|
|
33
|
+
echo "Please create a proper Git tag first (e.g., 'git tag v0.1.0')"
|
|
34
|
+
exit 1
|
|
35
|
+
fi
|
|
36
|
+
|
|
37
|
+
echo "✅ Version $VERSION is valid for publishing"
|
|
38
|
+
|
|
39
|
+
- name: Publish to TestPyPI
|
|
40
|
+
run: uv publish --publish-url https://test.pypi.org/legacy/ -v dist/*
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
on:
|
|
3
|
+
release:
|
|
4
|
+
types: [published]
|
|
5
|
+
workflow_dispatch:
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
pypi-publish:
|
|
9
|
+
name: Upload to PyPI
|
|
10
|
+
runs-on: ubuntu-latest
|
|
11
|
+
permissions:
|
|
12
|
+
id-token: write # For PyPI's trusted publishing
|
|
13
|
+
steps:
|
|
14
|
+
- name: Checkout
|
|
15
|
+
uses: actions/checkout@v5
|
|
16
|
+
with:
|
|
17
|
+
fetch-depth: 0
|
|
18
|
+
fetch-tags: true
|
|
19
|
+
|
|
20
|
+
- name: "Install uv"
|
|
21
|
+
uses: astral-sh/setup-uv@v6
|
|
22
|
+
|
|
23
|
+
- name: Build
|
|
24
|
+
run: uv build
|
|
25
|
+
|
|
26
|
+
- name: Check version format
|
|
27
|
+
run: |
|
|
28
|
+
# Extract version from the built package
|
|
29
|
+
VERSION=$(ls dist/*.whl | head -n1 | sed -E 's/.*-([0-9].*)-.*/\1/')
|
|
30
|
+
echo "Package version: $VERSION"
|
|
31
|
+
|
|
32
|
+
# Check if version contains dev/post markers (development version)
|
|
33
|
+
if [[ "$VERSION" =~ (dev|post.*dev) ]]; then
|
|
34
|
+
echo "❌ ERROR: Cannot publish development version: $VERSION"
|
|
35
|
+
echo "Please create a proper Git tag first (e.g., 'git tag v0.1.0')"
|
|
36
|
+
exit 1
|
|
37
|
+
fi
|
|
38
|
+
|
|
39
|
+
echo "✅ Version $VERSION is valid for publishing"
|
|
40
|
+
|
|
41
|
+
- name: Publish to PyPI
|
|
42
|
+
run: uv publish -v dist/*
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
name: Run static analysis
|
|
2
|
+
|
|
3
|
+
env:
|
|
4
|
+
# Enable colored output
|
|
5
|
+
PY_COLORS: 1
|
|
6
|
+
|
|
7
|
+
on:
|
|
8
|
+
push:
|
|
9
|
+
branches: ["main"]
|
|
10
|
+
paths:
|
|
11
|
+
- "src/**"
|
|
12
|
+
- "tests/**"
|
|
13
|
+
- "uv.lock"
|
|
14
|
+
- "pyproject.toml"
|
|
15
|
+
- ".github/workflows/**"
|
|
16
|
+
|
|
17
|
+
# Run on all pull requests because these checks are required and will block merges otherwise
|
|
18
|
+
pull_request:
|
|
19
|
+
|
|
20
|
+
workflow_dispatch:
|
|
21
|
+
|
|
22
|
+
permissions:
|
|
23
|
+
contents: read
|
|
24
|
+
|
|
25
|
+
jobs:
|
|
26
|
+
static_analysis:
|
|
27
|
+
timeout-minutes: 2
|
|
28
|
+
|
|
29
|
+
runs-on: ubuntu-latest
|
|
30
|
+
|
|
31
|
+
steps:
|
|
32
|
+
- uses: actions/checkout@v5
|
|
33
|
+
- name: Install uv
|
|
34
|
+
uses: astral-sh/setup-uv@v6
|
|
35
|
+
with:
|
|
36
|
+
enable-cache: true
|
|
37
|
+
cache-dependency-glob: "uv.lock"
|
|
38
|
+
|
|
39
|
+
- name: Install dependencies
|
|
40
|
+
run: uv sync
|
|
41
|
+
|
|
42
|
+
- name: Check lockfile is up to date
|
|
43
|
+
run: |
|
|
44
|
+
if ! uv lock --check; then
|
|
45
|
+
echo "❌ Lockfile is out of date!"
|
|
46
|
+
echo "To update the lockfile, run 'uv lock'."
|
|
47
|
+
exit 1
|
|
48
|
+
fi
|
|
49
|
+
echo "✅ Lockfile is up to date"
|
|
50
|
+
- name: Run pre-commit
|
|
51
|
+
run: uv run pre-commit run --all-files
|
|
52
|
+
env:
|
|
53
|
+
SKIP: no-commit-to-branch
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
name: Run tests
|
|
2
|
+
|
|
3
|
+
env:
|
|
4
|
+
# Enable colored output
|
|
5
|
+
PY_COLORS: 1
|
|
6
|
+
|
|
7
|
+
on:
|
|
8
|
+
push:
|
|
9
|
+
branches: ["main"]
|
|
10
|
+
paths:
|
|
11
|
+
- "src/**"
|
|
12
|
+
- "tests/**"
|
|
13
|
+
- "uv.lock"
|
|
14
|
+
- "pyproject.toml"
|
|
15
|
+
- ".github/workflows/**"
|
|
16
|
+
|
|
17
|
+
# Run on all pull requests because these checks are required and will block merges otherwise
|
|
18
|
+
pull_request:
|
|
19
|
+
|
|
20
|
+
workflow_dispatch:
|
|
21
|
+
|
|
22
|
+
permissions:
|
|
23
|
+
contents: read
|
|
24
|
+
|
|
25
|
+
jobs:
|
|
26
|
+
run_tests:
|
|
27
|
+
name: "Run tests: Python ${{ matrix.python-version }} on ${{ matrix.os }}"
|
|
28
|
+
runs-on: ${{ matrix.os }}
|
|
29
|
+
strategy:
|
|
30
|
+
matrix:
|
|
31
|
+
os: [ubuntu-latest, windows-latest]
|
|
32
|
+
python-version: ["3.10"]
|
|
33
|
+
fail-fast: false
|
|
34
|
+
timeout-minutes: 5
|
|
35
|
+
|
|
36
|
+
steps:
|
|
37
|
+
- uses: actions/checkout@v5
|
|
38
|
+
|
|
39
|
+
- name: Install uv
|
|
40
|
+
uses: astral-sh/setup-uv@v6
|
|
41
|
+
with:
|
|
42
|
+
enable-cache: true
|
|
43
|
+
cache-dependency-glob: "uv.lock"
|
|
44
|
+
python-version: ${{ matrix.python-version }}
|
|
45
|
+
|
|
46
|
+
- name: Install dependencies
|
|
47
|
+
# Run with frozen to use the current lockfile; static checks will determine if it needs updating
|
|
48
|
+
run: uv sync --frozen
|
|
49
|
+
|
|
50
|
+
- name: Run tests
|
|
51
|
+
run: uv run pytest
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
.env*
|
|
2
|
+
!.env.example
|
|
3
|
+
mcp.json
|
|
4
|
+
claude_desktop_config.json*
|
|
5
|
+
*.bat
|
|
6
|
+
|
|
7
|
+
# Python-generated files
|
|
8
|
+
__pycache__/
|
|
9
|
+
*.py[oc]
|
|
10
|
+
build/
|
|
11
|
+
dist/
|
|
12
|
+
wheels/
|
|
13
|
+
*.egg-info
|
|
14
|
+
|
|
15
|
+
# Virtual environments
|
|
16
|
+
.venv/
|
|
17
|
+
|
|
18
|
+
# Log files
|
|
19
|
+
*.log
|
|
20
|
+
|
|
21
|
+
# Coverage reports
|
|
22
|
+
.coverage
|
|
23
|
+
htmlcov/
|
|
24
|
+
.pytest_cache/
|
|
25
|
+
|
|
26
|
+
# MCPB files
|
|
27
|
+
*.mcpb
|
|
28
|
+
|
|
29
|
+
# VSCode settings
|
|
30
|
+
.vscode/PythonImportHelper-v2-Completion.json
|
|
31
|
+
|
|
32
|
+
# Claude Code local settings (tool permissions, personal overrides — not shared)
|
|
33
|
+
.claude/settings.local.json
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
fail_fast: false
|
|
2
|
+
|
|
3
|
+
repos:
|
|
4
|
+
- repo: https://github.com/abravalheri/validate-pyproject
|
|
5
|
+
rev: v0.25
|
|
6
|
+
hooks:
|
|
7
|
+
- id: validate-pyproject
|
|
8
|
+
|
|
9
|
+
- repo: https://github.com/pre-commit/mirrors-prettier
|
|
10
|
+
rev: v3.1.0
|
|
11
|
+
hooks:
|
|
12
|
+
- id: prettier
|
|
13
|
+
types_or: [yaml, json]
|
|
14
|
+
|
|
15
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
16
|
+
# Ruff version.
|
|
17
|
+
rev: v0.15.14
|
|
18
|
+
hooks:
|
|
19
|
+
# Run the linter.
|
|
20
|
+
- id: ruff-check
|
|
21
|
+
args: [--fix, --exit-non-zero-on-fix]
|
|
22
|
+
# Run the formatter.
|
|
23
|
+
- id: ruff-format
|
|
24
|
+
|
|
25
|
+
- repo: local
|
|
26
|
+
hooks:
|
|
27
|
+
- id: ty
|
|
28
|
+
name: ty check
|
|
29
|
+
entry: uv run ty check
|
|
30
|
+
language: system
|
|
31
|
+
types: [python]
|
|
32
|
+
files: ^src/|^tests/
|
|
33
|
+
pass_filenames: false
|
|
34
|
+
require_serial: true
|
|
35
|
+
|
|
36
|
+
# - repo: https://github.com/pre-commit/pre-commit-hooks
|
|
37
|
+
# rev: v6.0.0
|
|
38
|
+
# hooks:
|
|
39
|
+
# - id: no-commit-to-branch
|
|
40
|
+
# name: prevent commits to main
|
|
41
|
+
# args: [--branch, main]
|
|
42
|
+
|
|
43
|
+
- repo: https://github.com/codespell-project/codespell
|
|
44
|
+
rev: v2.4.2
|
|
45
|
+
hooks:
|
|
46
|
+
- id: codespell # See pyproject.toml for args
|
|
47
|
+
additional_dependencies:
|
|
48
|
+
- tomli
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
// Use IntelliSense to learn about possible attributes.
|
|
3
|
+
// Hover to view descriptions of existing attributes.
|
|
4
|
+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
5
|
+
"version": "0.2.0",
|
|
6
|
+
"configurations": [
|
|
7
|
+
{
|
|
8
|
+
"name": "MCP Backend",
|
|
9
|
+
"type": "debugpy",
|
|
10
|
+
"request": "launch",
|
|
11
|
+
"python": "${workspaceFolder}/examples/token_validating_upstream_mcp/.venv/Scripts/python.exe",
|
|
12
|
+
"program": "${workspaceFolder}/examples/token_validating_upstream_mcp/upstream_mcp.py",
|
|
13
|
+
"justMyCode": false,
|
|
14
|
+
"console": "integratedTerminal"
|
|
15
|
+
}
|
|
16
|
+
]
|
|
17
|
+
}
|