fastmcp 2.11.2__py3-none-any.whl → 2.12.0rc1__py3-none-any.whl

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 (77) hide show
  1. fastmcp/__init__.py +5 -4
  2. fastmcp/cli/claude.py +22 -18
  3. fastmcp/cli/cli.py +472 -136
  4. fastmcp/cli/install/claude_code.py +37 -40
  5. fastmcp/cli/install/claude_desktop.py +37 -42
  6. fastmcp/cli/install/cursor.py +148 -38
  7. fastmcp/cli/install/mcp_json.py +38 -43
  8. fastmcp/cli/install/shared.py +64 -7
  9. fastmcp/cli/run.py +122 -215
  10. fastmcp/client/auth/oauth.py +69 -13
  11. fastmcp/client/client.py +46 -9
  12. fastmcp/client/logging.py +25 -1
  13. fastmcp/client/oauth_callback.py +91 -91
  14. fastmcp/client/sampling.py +12 -4
  15. fastmcp/client/transports.py +143 -67
  16. fastmcp/experimental/sampling/__init__.py +0 -0
  17. fastmcp/experimental/sampling/handlers/__init__.py +3 -0
  18. fastmcp/experimental/sampling/handlers/base.py +21 -0
  19. fastmcp/experimental/sampling/handlers/openai.py +163 -0
  20. fastmcp/experimental/server/openapi/routing.py +1 -3
  21. fastmcp/experimental/server/openapi/server.py +10 -25
  22. fastmcp/experimental/utilities/openapi/__init__.py +2 -2
  23. fastmcp/experimental/utilities/openapi/formatters.py +34 -0
  24. fastmcp/experimental/utilities/openapi/models.py +5 -2
  25. fastmcp/experimental/utilities/openapi/parser.py +252 -70
  26. fastmcp/experimental/utilities/openapi/schemas.py +135 -106
  27. fastmcp/mcp_config.py +40 -20
  28. fastmcp/prompts/prompt_manager.py +4 -2
  29. fastmcp/resources/resource_manager.py +16 -6
  30. fastmcp/server/auth/__init__.py +11 -1
  31. fastmcp/server/auth/auth.py +19 -2
  32. fastmcp/server/auth/oauth_proxy.py +1047 -0
  33. fastmcp/server/auth/providers/azure.py +270 -0
  34. fastmcp/server/auth/providers/github.py +287 -0
  35. fastmcp/server/auth/providers/google.py +305 -0
  36. fastmcp/server/auth/providers/jwt.py +27 -16
  37. fastmcp/server/auth/providers/workos.py +256 -2
  38. fastmcp/server/auth/redirect_validation.py +65 -0
  39. fastmcp/server/auth/registry.py +1 -1
  40. fastmcp/server/context.py +91 -41
  41. fastmcp/server/dependencies.py +32 -2
  42. fastmcp/server/elicitation.py +60 -1
  43. fastmcp/server/http.py +44 -37
  44. fastmcp/server/middleware/logging.py +66 -28
  45. fastmcp/server/proxy.py +2 -0
  46. fastmcp/server/sampling/handler.py +19 -0
  47. fastmcp/server/server.py +85 -20
  48. fastmcp/settings.py +18 -3
  49. fastmcp/tools/tool.py +23 -10
  50. fastmcp/tools/tool_manager.py +5 -1
  51. fastmcp/tools/tool_transform.py +75 -32
  52. fastmcp/utilities/auth.py +34 -0
  53. fastmcp/utilities/cli.py +148 -15
  54. fastmcp/utilities/components.py +21 -5
  55. fastmcp/utilities/inspect.py +166 -37
  56. fastmcp/utilities/json_schema_type.py +4 -2
  57. fastmcp/utilities/logging.py +4 -1
  58. fastmcp/utilities/mcp_config.py +47 -18
  59. fastmcp/utilities/mcp_server_config/__init__.py +25 -0
  60. fastmcp/utilities/mcp_server_config/v1/__init__.py +0 -0
  61. fastmcp/utilities/mcp_server_config/v1/environments/__init__.py +6 -0
  62. fastmcp/utilities/mcp_server_config/v1/environments/base.py +30 -0
  63. fastmcp/utilities/mcp_server_config/v1/environments/uv.py +306 -0
  64. fastmcp/utilities/mcp_server_config/v1/mcp_server_config.py +446 -0
  65. fastmcp/utilities/mcp_server_config/v1/schema.json +361 -0
  66. fastmcp/utilities/mcp_server_config/v1/sources/__init__.py +0 -0
  67. fastmcp/utilities/mcp_server_config/v1/sources/base.py +30 -0
  68. fastmcp/utilities/mcp_server_config/v1/sources/filesystem.py +216 -0
  69. fastmcp/utilities/openapi.py +4 -4
  70. fastmcp/utilities/tests.py +7 -2
  71. fastmcp/utilities/types.py +15 -2
  72. {fastmcp-2.11.2.dist-info → fastmcp-2.12.0rc1.dist-info}/METADATA +3 -2
  73. fastmcp-2.12.0rc1.dist-info/RECORD +129 -0
  74. fastmcp-2.11.2.dist-info/RECORD +0 -108
  75. {fastmcp-2.11.2.dist-info → fastmcp-2.12.0rc1.dist-info}/WHEEL +0 -0
  76. {fastmcp-2.11.2.dist-info → fastmcp-2.12.0rc1.dist-info}/entry_points.txt +0 -0
  77. {fastmcp-2.11.2.dist-info → fastmcp-2.12.0rc1.dist-info}/licenses/LICENSE +0 -0
fastmcp/__init__.py CHANGED
@@ -6,10 +6,11 @@ from fastmcp.settings import Settings
6
6
  from fastmcp.utilities.logging import configure_logging as _configure_logging
7
7
 
8
8
  settings = Settings()
9
- _configure_logging(
10
- level=settings.log_level,
11
- enable_rich_tracebacks=settings.enable_rich_tracebacks,
12
- )
9
+ if settings.log_enabled:
10
+ _configure_logging(
11
+ level=settings.log_level,
12
+ enable_rich_tracebacks=settings.enable_rich_tracebacks,
13
+ )
13
14
 
14
15
  from fastmcp.server.server import FastMCP
15
16
  from fastmcp.server.context import Context
fastmcp/cli/claude.py CHANGED
@@ -7,6 +7,7 @@ from pathlib import Path
7
7
  from typing import Any
8
8
 
9
9
  from fastmcp.utilities.logging import get_logger
10
+ from fastmcp.utilities.mcp_server_config.v1.environments.uv import UVEnvironment
10
11
 
11
12
  logger = get_logger(__name__)
12
13
 
@@ -33,7 +34,7 @@ def update_claude_config(
33
34
  file_spec: str,
34
35
  server_name: str,
35
36
  *,
36
- with_editable: Path | None = None,
37
+ with_editable: list[Path] | None = None,
37
38
  with_packages: list[str] | None = None,
38
39
  env_vars: dict[str, str] | None = None,
39
40
  ) -> bool:
@@ -42,7 +43,7 @@ def update_claude_config(
42
43
  Args:
43
44
  file_spec: Path to the server file, optionally with :object suffix
44
45
  server_name: Name for the server in Claude's config
45
- with_editable: Optional directory to install in editable mode
46
+ with_editable: Optional list of directories to install in editable mode
46
47
  with_packages: Optional list of additional packages to install
47
48
  env_vars: Optional dictionary of environment variables. These are merged with
48
49
  any existing variables, with new values taking precedence.
@@ -89,20 +90,19 @@ def update_claude_config(
89
90
  else:
90
91
  env_vars = existing_env
91
92
 
92
- # Build uv run command
93
- args = ["run"]
94
-
95
- # Collect all packages in a set to deduplicate
96
- packages = {"fastmcp"}
93
+ # Deduplicate packages and exclude 'fastmcp' since Environment adds it automatically
94
+ deduplicated_packages = None
97
95
  if with_packages:
98
- packages.update(pkg for pkg in with_packages if pkg)
99
-
100
- # Add all packages with --with
101
- for pkg in sorted(packages):
102
- args.extend(["--with", pkg])
103
-
104
- if with_editable:
105
- args.extend(["--with-editable", str(with_editable)])
96
+ deduplicated = list(dict.fromkeys(with_packages))
97
+ deduplicated_packages = [pkg for pkg in deduplicated if pkg != "fastmcp"]
98
+ if not deduplicated_packages:
99
+ deduplicated_packages = None
100
+
101
+ # Build uv run command using Environment.build_uv_run_command()
102
+ env_config = UVEnvironment(
103
+ dependencies=deduplicated_packages,
104
+ editable=[str(p) for p in with_editable] if with_editable else None,
105
+ )
106
106
 
107
107
  # Convert file path to absolute before adding to command
108
108
  # Split off any :object suffix first
@@ -112,10 +112,14 @@ def update_claude_config(
112
112
  else:
113
113
  file_spec = str(Path(file_spec).resolve())
114
114
 
115
- # Add fastmcp run command
116
- args.extend(["fastmcp", "run", file_spec])
115
+ # Build the full command
116
+ full_command = env_config.build_command(["fastmcp", "run", file_spec])
117
117
 
118
- server_config: dict[str, Any] = {"command": "uv", "args": args}
118
+ # Extract command and args for the config
119
+ server_config: dict[str, Any] = {
120
+ "command": full_command[0],
121
+ "args": full_command[1:],
122
+ }
119
123
 
120
124
  # Add environment variables if specified
121
125
  if env_vars: