mcp-authkit 0.2.1__tar.gz → 0.2.2__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.
Files changed (34) hide show
  1. {mcp_authkit-0.2.1 → mcp_authkit-0.2.2}/PKG-INFO +1 -1
  2. {mcp_authkit-0.2.1 → mcp_authkit-0.2.2}/mcp_authkit.egg-info/PKG-INFO +1 -1
  3. {mcp_authkit-0.2.1 → mcp_authkit-0.2.2}/mcpauthkit/providers/oauth_provider.py +34 -13
  4. {mcp_authkit-0.2.1 → mcp_authkit-0.2.2}/pyproject.toml +1 -1
  5. {mcp_authkit-0.2.1 → mcp_authkit-0.2.2}/LICENSE +0 -0
  6. {mcp_authkit-0.2.1 → mcp_authkit-0.2.2}/README.md +0 -0
  7. {mcp_authkit-0.2.1 → mcp_authkit-0.2.2}/mcp_authkit.egg-info/SOURCES.txt +0 -0
  8. {mcp_authkit-0.2.1 → mcp_authkit-0.2.2}/mcp_authkit.egg-info/dependency_links.txt +0 -0
  9. {mcp_authkit-0.2.1 → mcp_authkit-0.2.2}/mcp_authkit.egg-info/requires.txt +0 -0
  10. {mcp_authkit-0.2.1 → mcp_authkit-0.2.2}/mcp_authkit.egg-info/top_level.txt +0 -0
  11. {mcp_authkit-0.2.1 → mcp_authkit-0.2.2}/mcpauthkit/__init__.py +0 -0
  12. {mcp_authkit-0.2.1 → mcp_authkit-0.2.2}/mcpauthkit/auth_middleware.py +0 -0
  13. {mcp_authkit-0.2.1 → mcp_authkit-0.2.2}/mcpauthkit/auth_routes.py +0 -0
  14. {mcp_authkit-0.2.1 → mcp_authkit-0.2.2}/mcpauthkit/jwt_validator.py +0 -0
  15. {mcp_authkit-0.2.1 → mcp_authkit-0.2.2}/mcpauthkit/providers/__init__.py +0 -0
  16. {mcp_authkit-0.2.1 → mcp_authkit-0.2.2}/mcpauthkit/providers/credentials_provider.py +0 -0
  17. {mcp_authkit-0.2.1 → mcp_authkit-0.2.2}/mcpauthkit/providers/templates/base.html +0 -0
  18. {mcp_authkit-0.2.1 → mcp_authkit-0.2.2}/mcpauthkit/providers/templates/credentials_entry.html +0 -0
  19. {mcp_authkit-0.2.1 → mcp_authkit-0.2.2}/mcpauthkit/providers/templates/credentials_error.html +0 -0
  20. {mcp_authkit-0.2.1 → mcp_authkit-0.2.2}/mcpauthkit/providers/templates/credentials_success.html +0 -0
  21. {mcp_authkit-0.2.1 → mcp_authkit-0.2.2}/mcpauthkit/providers/templates/oauth_error.html +0 -0
  22. {mcp_authkit-0.2.1 → mcp_authkit-0.2.2}/mcpauthkit/providers/templates/oauth_success.html +0 -0
  23. {mcp_authkit-0.2.1 → mcp_authkit-0.2.2}/mcpauthkit/py.typed +0 -0
  24. {mcp_authkit-0.2.1 → mcp_authkit-0.2.2}/mcpauthkit/store/__init__.py +0 -0
  25. {mcp_authkit-0.2.1 → mcp_authkit-0.2.2}/mcpauthkit/store/base.py +0 -0
  26. {mcp_authkit-0.2.1 → mcp_authkit-0.2.2}/mcpauthkit/store/encryption.py +0 -0
  27. {mcp_authkit-0.2.1 → mcp_authkit-0.2.2}/mcpauthkit/store/factory.py +0 -0
  28. {mcp_authkit-0.2.1 → mcp_authkit-0.2.2}/mcpauthkit/store/file_store.py +0 -0
  29. {mcp_authkit-0.2.1 → mcp_authkit-0.2.2}/mcpauthkit/store/memory.py +0 -0
  30. {mcp_authkit-0.2.1 → mcp_authkit-0.2.2}/mcpauthkit/store/redis_store.py +0 -0
  31. {mcp_authkit-0.2.1 → mcp_authkit-0.2.2}/setup.cfg +0 -0
  32. {mcp_authkit-0.2.1 → mcp_authkit-0.2.2}/tests/test_auth_middleware.py +0 -0
  33. {mcp_authkit-0.2.1 → mcp_authkit-0.2.2}/tests/test_auth_routes.py +0 -0
  34. {mcp_authkit-0.2.1 → mcp_authkit-0.2.2}/tests/test_jwt_validator.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mcp-authkit
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: Pluggable OAuth 2.0 + credentials elicitation library for FastMCP servers
5
5
  License: MIT
6
6
  Project-URL: Homepage, https://github.com/masterela/mcp-authkit
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mcp-authkit
3
- Version: 0.2.1
3
+ Version: 0.2.2
4
4
  Summary: Pluggable OAuth 2.0 + credentials elicitation library for FastMCP servers
5
5
  License: MIT
6
6
  Project-URL: Homepage, https://github.com/masterela/mcp-authkit
@@ -208,10 +208,11 @@ class OAuthProvider:
208
208
  refresh_token_fn: Callable[..., Coroutine[Any, Any, ExchangeResult]] | None = None,
209
209
  token_timeout: float = 120.0,
210
210
  http_verify: bool | ssl.SSLContext | str = True,
211
+ extra_authorize_params: dict[str, str] | None = None,
211
212
  ) -> OAuthProvider:
212
213
  """
213
214
  Convenience factory for any standard OAuth2 Authorization Code provider
214
- (GitHub, Google, Jira, Entra, etc.).
215
+ (GitHub, Google, Jira, Entra, Okta, etc.).
215
216
 
216
217
  Builds ``build_auth_url`` and ``exchange_code`` internally from standard
217
218
  OAuth2 endpoints so the caller only needs to supply configuration::
@@ -242,6 +243,25 @@ class OAuthProvider:
242
243
  Space-separated scope string.
243
244
  http_verify
244
245
  Passed as ``verify=`` to httpx for the token exchange request.
246
+ extra_authorize_params
247
+ Optional extra query parameters appended to every authorization URL.
248
+ Use this for provider-specific routing hints that are not part of the
249
+ standard OAuth2 spec. For example, Okta supports an ``idp`` parameter
250
+ to bypass its login page and route users directly to a configured
251
+ external Identity Provider::
252
+
253
+ okta = OAuthProvider.from_standard_oauth2(
254
+ name="okta",
255
+ authorization_url="https://your-org.okta.com/oauth2/default/v1/authorize",
256
+ token_url="https://your-org.okta.com/oauth2/default/v1/token",
257
+ ...
258
+ extra_authorize_params={"idp": "0oaz2r21a8RBmZyOL0h7"},
259
+ )
260
+
261
+ These parameters are merged into the standard ones
262
+ (``client_id``, ``redirect_uri``, ``scope``, ``state``,
263
+ ``response_type``). Standard parameters always take precedence so
264
+ they cannot be overridden here. Default: ``None`` (no extra params).
245
265
  token_store
246
266
  Optional persistent store override.
247
267
  pending_store
@@ -251,19 +271,20 @@ class OAuthProvider:
251
271
  """
252
272
 
253
273
  def _build_auth_url(state: str, redir: str) -> str:
254
- return (
255
- authorization_url
256
- + "?"
257
- + urlencode(
258
- {
259
- "client_id": client_id,
260
- "redirect_uri": redir,
261
- "scope": scope,
262
- "state": state,
263
- "response_type": "code",
264
- }
265
- )
274
+ params: dict[str, str] = {}
275
+ if extra_authorize_params:
276
+ params.update(extra_authorize_params)
277
+ # Standard params always win over any extra ones
278
+ params.update(
279
+ {
280
+ "client_id": client_id,
281
+ "redirect_uri": redir,
282
+ "scope": scope,
283
+ "state": state,
284
+ "response_type": "code",
285
+ }
266
286
  )
287
+ return authorization_url + "?" + urlencode(params)
267
288
 
268
289
  async def _exchange_code(code: str, state: str, redir: str) -> ExchangeResult:
269
290
  async with httpx.AsyncClient(
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "mcp-authkit"
7
- version = "0.2.1"
7
+ version = "0.2.2"
8
8
  description = "Pluggable OAuth 2.0 + credentials elicitation library for FastMCP servers"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
File without changes
File without changes
File without changes