File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change
1
+ # pyright: reportGeneralTypeIssues=false
1
2
"""
2
3
MCP OAuth server authorization components.
3
4
"""
5
+
6
+ # Convenience re-exports so users can simply::
7
+ #
8
+ # from mcp.server.auth import build_proxy_server
9
+ #
10
+ # instead of digging into the sub-package path.
11
+
12
+ from typing import TYPE_CHECKING
13
+
14
+ from mcp .server .auth .proxy import (
15
+ create_proxy_routes ,
16
+ fetch_upstream_metadata ,
17
+ )
18
+ from mcp .server .fastmcp .utilities .logging import configure_logging
19
+
20
+ # For *build_proxy_server* we need a lazy import to avoid a circular reference
21
+ # during the initial package import sequence (FastMCP -> auth -> proxy ->
22
+ # FastMCP ...). PEP 562 allows us to implement module-level `__getattr__` for
23
+ # this purpose.
24
+
25
+
26
+ def __getattr__ (name : str ): # noqa: D401
27
+ if name == "build_proxy_server" :
28
+ from mcp .server .auth .proxy .server import build_proxy_server as _bps # noqa: WPS433
29
+
30
+ globals ()["build_proxy_server" ] = _bps
31
+ return _bps
32
+ raise AttributeError (name )
33
+
34
+
35
+ # ---------------------------------------------------------------------------
36
+ # Public API specification
37
+ # ---------------------------------------------------------------------------
38
+
39
+ __all__ : list [str ] = [
40
+ "configure_logging" ,
41
+ "create_proxy_routes" ,
42
+ "fetch_upstream_metadata" ,
43
+ "build_proxy_server" ,
44
+ ]
45
+
46
+ if TYPE_CHECKING : # pragma: no cover – make *build_proxy_server* visible to type checkers
47
+ from mcp .server .auth .proxy .server import build_proxy_server # noqa: F401
You can’t perform that action at this time.
0 commit comments