Skip to content

Add OIDC authentication, fix tests, and update PyPI installation docs#134

Open
jonpspri wants to merge 3 commits intomainfrom
smithery
Open

Add OIDC authentication, fix tests, and update PyPI installation docs#134
jonpspri wants to merge 3 commits intomainfrom
smithery

Conversation

@jonpspri
Copy link
Owner

Summary

This PR adds OIDC authentication support for HTTP mode deployments, fixes a skipped test in the discovery server, and updates all installation documentation to reflect PyPI as the primary installation source.

Changes

1. OIDC Authentication (HTTP Mode)

  • Added OidcSettings class with DATABEAK_OIDC_* environment variables
  • Integrated OIDCProxy from FastMCP for secure HTTP deployments
  • Authentication only applies to HTTP transport mode (not stdio/MCP clients)
  • Validates that all four OIDC variables are set; logs error if incomplete

Environment Variables:

  • DATABEAK_OIDC_CONFIG_URL - OIDC discovery configuration URL
  • DATABEAK_OIDC_CLIENT_ID - OAuth2 client ID
  • DATABEAK_OIDC_CLIENT_SECRET - OAuth2 client secret
  • DATABEAK_OIDC_BASE_URL - Application base URL for OAuth2

2. Fixed Skipped Test

  • Fixed test_no_data_loaded in test_discovery_server_coverage.py:624
  • Replaced mocking approach with real session management
  • Now properly tests NoDataLoadedError exception handling
  • Removed unused imports (Mock, patch, ToolError, databeak)

3. Documentation Updates

  • Updated README.md and docs/installation.md for PyPI installation
  • Simplified all client configurations from uvx --from git+... to uvx databeak
  • Added OIDC authentication documentation for HTTP mode deployments
  • Clarified OIDC is only for HTTP transport, not stdio mode
  • Updated Python version requirement to 3.12+
  • Fixed all example commands to use PyPI

Test Plan

  • All tests pass: uv run pytest tests/unit/servers/test_discovery_server_coverage.py
  • Fixed test now properly validates no-data error handling
  • Code quality checks pass (ruff, mypy)
  • Markdown formatting applied

Breaking Changes

None - this is additive functionality.

Notes

  • OIDC authentication is optional and only activates when all four environment variables are set
  • Stdio mode (default for MCP clients) is unaffected by OIDC configuration
  • Documentation now prioritizes PyPI installation over GitHub

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

Copilot AI review requested due to automatic review settings October 10, 2025 18:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds OIDC authentication support for HTTP mode deployments, fixes a previously skipped test, and updates all installation documentation to use PyPI instead of GitHub URLs.

  • Adds optional OIDC authentication for HTTP transport mode with proper environment variable validation
  • Fixes test_no_data_loaded test to properly validate NoDataLoadedError exception handling
  • Updates all documentation and client configurations to use PyPI installation (uvx databeak)

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/databeak/server.py Adds OIDC authentication settings and integration with validation logic
tests/unit/servers/test_discovery_server_coverage.py Fixes skipped test by replacing mocks with real session management
docs/installation.md Updates installation commands and adds OIDC authentication documentation
README.md Updates quick start examples and adds OIDC configuration section
Comments suppressed due to low confidence (1)

src/databeak/server.py:1

  • The import DatabeakSettings is removed but was previously used in the @smithery.server(config_schema=DatabeakSettings) decorator. Verify that removing the config schema doesn't break server configuration functionality.
"""Main FastMCP server for DataBeak."""

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

session.has_data.return_value = False
manager.return_value.get_session.return_value = session
# Create a real session without data
from databeak.exceptions import NoDataLoadedError
Copy link

Copilot AI Oct 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The import is placed inside the test function rather than at the module level. Consider moving this import to the top of the file with other imports for consistency and better readability.

Copilot uses AI. Check for mistakes.
@codecov
Copy link

codecov bot commented Oct 10, 2025

Codecov Report

❌ Patch coverage is 75.00000% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.68%. Comparing base (3c6ce7e) to head (38ba4ed).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/databeak/server.py 75.00% 2 Missing and 2 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #134      +/-   ##
==========================================
- Coverage   84.75%   84.68%   -0.07%     
==========================================
  Files          27       27              
  Lines        3076     3089      +13     
  Branches      458      460       +2     
==========================================
+ Hits         2607     2616       +9     
- Misses        355      357       +2     
- Partials      114      116       +2     
Flag Coverage Δ
unittests 84.68% <75.00%> (-0.07%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/databeak/server.py 92.30% <75.00%> (-4.62%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3c6ce7e...38ba4ed. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@smithery smithery bot had a problem deploying to production October 10, 2025 18:52 Failure
@smithery smithery bot had a problem deploying to production November 24, 2025 07:09 Failure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants