Skip to content

fix(cli): silence authlib.jose deprecation warning from fastmcp#2025

Open
kermanx wants to merge 4 commits intoMoonshotAI:mainfrom
kermanx:kermanx/fix-jwt-warning
Open

fix(cli): silence authlib.jose deprecation warning from fastmcp#2025
kermanx wants to merge 4 commits intoMoonshotAI:mainfrom
kermanx:kermanx/fix-jwt-warning

Conversation

@kermanx
Copy link
Copy Markdown
Contributor

@kermanx kermanx commented Apr 23, 2026

Related Issue

N/A — trivial startup noise cleanup.

Description

authlib 1.7.0 (2026-04-18) added an import-time AuthlibDeprecationWarning on authlib.jose, which fastmcp's JWT auth provider imports unconditionally:

.../fastmcp/server/auth/providers/jwt.py:10: AuthlibDeprecationWarning: authlib.jose module is deprecated, please use joserfc instead. It will be compatible before version 2.0.0.
  from authlib.jose import JsonWebKey, JsonWebToken

Users see this on every kimi startup.

Why we can't root-cause fix this

  • The warning is emitted from a third-party library (fastmcp), not our code.
  • fastmcp — including the latest 3.x — still imports authlib.jose directly; there is no upstream migration to joserfc in flight.
  • Pinning authlib<1.7 in our pyproject.toml would constrain a transitive dependency we don't directly use, block us from future authlib 1.7+ fixes, and could collide if fastmcp later tightens its own bound.
  • authlib keeps the module functional until 2.0.0, so this is purely cosmetic noise during the transition.

What this PR does

Add a narrow, message-specific warnings.filterwarnings at the top of src/kimi_cli/__main__.py (before any import chain that pulls in fastmcp), matching only this exact deprecation text. Unlike the existing broad DeprecationWarning filter in app.py, this one won't hide unrelated warnings. When fastmcp migrates off authlib.jose, the filter becomes a no-op and can be removed.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked the related issue, if any.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have run make gen-changelog to update the changelog.
  • I have run make gen-docs to update the user documentation.

Open in Devin Review

authlib 1.7.0 added an import-time AuthlibDeprecationWarning on
authlib.jose, which fastmcp's JWT auth provider imports. Filter
that specific message before any fastmcp import so users don't
see the noise on startup.
Copilot AI review requested due to automatic review settings April 23, 2026 08:22
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

This comment was marked as resolved.

kermanx added 3 commits April 23, 2026 16:33
Signed-off-by: _Kerman <kermanx@qq.com>
Signed-off-by: _Kerman <kermanx@qq.com>
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