Skip to content
This repository was archived by the owner on Oct 9, 2025. It is now read-only.

Commit fa52098

Browse files
authored
Merge pull request #2 from liatrio/fix-workflow-issues
fix: fixed invalid routes, removed docker compose, and some README up…
2 parents e121300 + a431ac2 commit fa52098

File tree

5 files changed

+39
-87
lines changed

5 files changed

+39
-87
lines changed

.env.example

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,4 @@ PORT=8000
99
HOST=0.0.0.0
1010

1111
# Optional: FastMCP Configuration
12-
FASTMCP_SERVER_AUTH=GITHUB
13-
FASTMCP_DEBUG=false
12+
FASTMCP_DEBUG=false

.github/workflows/release.yml

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,34 +16,33 @@ jobs:
1616
runs-on: ubuntu-latest
1717
steps:
1818
- uses: actions/checkout@v4
19-
19+
2020
- name: Install uv
2121
uses: astral-sh/setup-uv@v2
22-
22+
2323
- name: Set up Python
2424
run: uv python install 3.11
25-
25+
2626
- name: Install dependencies
2727
run: uv sync
28-
28+
2929
- name: Run tests
3030
run: |
3131
uv run ruff check src/
3232
uv run black --check src/
3333
# uv run pytest # Add when tests are implemented
34-
34+
3535
- name: Build package
3636
run: uv build
37-
37+
3838
- name: Test server import
3939
run: uv run python -c "from fastmcp_github_oauth_example import create_server; print('✅ Server import successful')"
4040

4141
- name: Test GoReleaser build
4242
if: github.event_name == 'pull_request'
43-
uses: goreleaser/goreleaser-action@v5
43+
uses: goreleaser/goreleaser-action@v6
4444
with:
4545
distribution: goreleaser
46-
version: latest
4746
args: build --snapshot --clean
4847
env:
4948
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -55,34 +54,33 @@ jobs:
5554
permissions:
5655
contents: write
5756
packages: write
58-
57+
5958
steps:
6059
- uses: actions/checkout@v4
6160
with:
6261
fetch-depth: 0
63-
62+
6463
- name: Install uv
6564
uses: astral-sh/setup-uv@v2
66-
67-
- name: Set up Python
65+
66+
- name: Set up Python
6867
run: uv python install 3.11
69-
68+
7069
- name: Set up Docker Buildx
7170
uses: docker/setup-buildx-action@v3
72-
71+
7372
- name: Login to Container Registry
7473
uses: docker/login-action@v3
7574
with:
7675
registry: ${{ env.REGISTRY }}
7776
username: ${{ github.actor }}
7877
password: ${{ secrets.GITHUB_TOKEN }}
79-
78+
8079
- name: Run GoReleaser
81-
uses: goreleaser/goreleaser-action@v5
80+
uses: goreleaser/goreleaser-action@v6
8281
with:
8382
distribution: goreleaser
84-
version: latest
8583
args: release --clean
8684
env:
8785
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
88-
GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }}
86+
GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }}

README.md

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -72,22 +72,12 @@ uv sync
7272
cp .env.example .env
7373
# Edit .env with your GitHub OAuth credentials
7474

75-
# Run the server
76-
uv run github-oauth-server
75+
# Run the server (loads environment from .env)
76+
uv run --env-file .env github-oauth-server
7777
```
7878

7979
### 3. Docker Deployment
8080

81-
#### Using Docker Compose (Recommended)
82-
83-
```bash
84-
# Build and run with Docker Compose
85-
docker-compose up -d
86-
87-
# View logs
88-
docker-compose logs -f
89-
```
90-
9181
#### Using Published Image
9282

9383
```bash
@@ -98,7 +88,7 @@ docker run -d \
9888
-e GITHUB_CLIENT_SECRET=your_client_secret \
9989
-e BASE_URL=http://localhost:8000 \
10090
--name fastmcp-server \
101-
ghcr.io/YOUR_ORG/fastmcp-github-oauth-example:latest
91+
ghcr.io/YOUR_ORG/fastmcp-github-oauth-example:<architecture-tag>
10292
```
10393

10494
### 4. Verify Installation
@@ -141,13 +131,14 @@ The easiest way to test the server is using the MCP Inspector:
141131

142132
```bash
143133
# Start the MCP server (in one terminal)
144-
uv run github-oauth-server
134+
uv run --env-file .env github-oauth-server
145135

146136
# Test with MCP Inspector (in another terminal)
147137
npx @modelcontextprotocol/inspector@latest http://localhost:8000/mcp/
148138
```
149139

150140
The MCP Inspector will:
141+
151142
1. Open a web interface for testing MCP servers
152143
2. Handle the GitHub OAuth flow automatically
153144
3. Allow you to test all available tools interactively
@@ -193,19 +184,19 @@ fastmcp-github-oauth-example/
193184
uv sync --group dev
194185

195186
# Run with auto-reload (development)
196-
uv run python -m fastmcp_github_oauth_example.server
187+
uv run --env-file .env python -m fastmcp_github_oauth_example.server
197188

198189
# Format code
199190
uv run black src/
200191

201-
# Lint code
192+
# Lint code
202193
uv run ruff check src/
203194

204195
# Build package
205196
uv build
206197

207198
# Test GoReleaser build (no Docker push)
208-
goreleaser build --snapshot --clean
199+
GITHUB_REPOSITORY_OWNER=YOUR_ORG goreleaser build --snapshot --clean
209200
```
210201

211202
### Testing
@@ -218,15 +209,8 @@ uv run black --check src/
218209
# Test server import
219210
uv run python -c "from fastmcp_github_oauth_example import create_server"
220211

221-
# Test Docker build locally
222-
docker build -t test-image .
223-
docker run --rm -p 8000:8000 \
224-
-e GITHUB_CLIENT_ID=test \
225-
-e GITHUB_CLIENT_SECRET=test \
226-
test-image
227-
228212
# Test GoReleaser snapshot build
229-
goreleaser release --snapshot --clean
213+
GITHUB_REPOSITORY_OWNER=YOUR_ORG goreleaser release --snapshot --clean
230214
```
231215

232216
## Deployment
@@ -306,7 +290,7 @@ Enable detailed logging:
306290

307291
```bash
308292
# Local development
309-
FASTMCP_DEBUG=true uv run github-oauth-server
293+
FASTMCP_DEBUG=true uv run --env-file .env github-oauth-server
310294

311295
# Docker
312296
docker run -e FASTMCP_DEBUG=true -p 8000:8000 fastmcp-github-oauth-example
@@ -362,4 +346,4 @@ This example is provided under the MIT License.
362346
- [uv Python Package Manager](https://github.com/astral-sh/uv)
363347
- [GoReleaser Documentation](https://goreleaser.com)
364348
- [GoReleaser uv Builder](https://goreleaser.com/customization/builds/uv/)
365-
- [Docker Best Practices](https://docs.docker.com/develop/dev-best-practices/)
349+
- [Docker Best Practices](https://docs.docker.com/develop/dev-best-practices/)

docker-compose.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

src/fastmcp_github_oauth_example/server.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,9 @@
44
from fastmcp.server.auth.providers.github import GitHubProvider
55
from fastmcp.server.dependencies import get_access_token
66
from starlette.responses import JSONResponse
7-
from starlette.routing import Route
87
from starlette.requests import Request
98

109

11-
def create_health_endpoint():
12-
"""Create health check endpoint for container monitoring."""
13-
14-
async def health(request: Request):
15-
return JSONResponse(
16-
{"status": "healthy", "service": "fastmcp-github-oauth", "version": "0.1.0"}
17-
)
18-
19-
return Route("/health", health, methods=["GET"])
20-
21-
2210
def create_server():
2311
"""Create and configure the FastMCP server."""
2412

@@ -44,9 +32,16 @@ def create_server():
4432
mcp = FastMCP(
4533
name="GitHub OAuth Example Server",
4634
auth=auth_provider,
47-
routes=[create_health_endpoint()], # Add health check
4835
)
4936

37+
# Add health check endpoint using custom route decorator
38+
@mcp.custom_route("/health", methods=["GET"])
39+
async def health_check(request: Request):
40+
"""Health check endpoint for container monitoring."""
41+
return JSONResponse(
42+
{"status": "healthy", "service": "fastmcp-github-oauth", "version": "0.1.0"}
43+
)
44+
5045
@mcp.tool
5146
async def get_user_info() -> Dict[str, Any]:
5247
"""Returns information about the authenticated GitHub user."""
@@ -128,6 +123,9 @@ def main():
128123
)
129124

130125
mcp.run(transport="http", port=port, host=host)
126+
except KeyboardInterrupt:
127+
print("\n🛑 Shutting down server gracefully...")
128+
exit(0)
131129
except ValueError as e:
132130
print(f"❌ Configuration Error: {e}")
133131
print("💡 Make sure to set GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET")

0 commit comments

Comments
 (0)