fastmcp 2.10.6__py3-none-any.whl → 2.11.0__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 (61) hide show
  1. fastmcp/cli/cli.py +128 -33
  2. fastmcp/cli/install/claude_code.py +42 -1
  3. fastmcp/cli/install/claude_desktop.py +42 -1
  4. fastmcp/cli/install/cursor.py +42 -1
  5. fastmcp/cli/install/mcp_json.py +41 -0
  6. fastmcp/cli/run.py +127 -1
  7. fastmcp/client/__init__.py +2 -0
  8. fastmcp/client/auth/oauth.py +68 -99
  9. fastmcp/client/oauth_callback.py +18 -0
  10. fastmcp/client/transports.py +69 -15
  11. fastmcp/contrib/component_manager/example.py +2 -2
  12. fastmcp/experimental/server/openapi/README.md +266 -0
  13. fastmcp/experimental/server/openapi/__init__.py +38 -0
  14. fastmcp/experimental/server/openapi/components.py +348 -0
  15. fastmcp/experimental/server/openapi/routing.py +132 -0
  16. fastmcp/experimental/server/openapi/server.py +466 -0
  17. fastmcp/experimental/utilities/openapi/README.md +239 -0
  18. fastmcp/experimental/utilities/openapi/__init__.py +68 -0
  19. fastmcp/experimental/utilities/openapi/director.py +208 -0
  20. fastmcp/experimental/utilities/openapi/formatters.py +355 -0
  21. fastmcp/experimental/utilities/openapi/json_schema_converter.py +340 -0
  22. fastmcp/experimental/utilities/openapi/models.py +85 -0
  23. fastmcp/experimental/utilities/openapi/parser.py +618 -0
  24. fastmcp/experimental/utilities/openapi/schemas.py +538 -0
  25. fastmcp/mcp_config.py +125 -88
  26. fastmcp/prompts/prompt.py +11 -1
  27. fastmcp/resources/resource.py +21 -1
  28. fastmcp/resources/template.py +20 -1
  29. fastmcp/server/auth/__init__.py +17 -2
  30. fastmcp/server/auth/auth.py +144 -7
  31. fastmcp/server/auth/providers/bearer.py +25 -473
  32. fastmcp/server/auth/providers/in_memory.py +4 -2
  33. fastmcp/server/auth/providers/jwt.py +538 -0
  34. fastmcp/server/auth/providers/workos.py +170 -0
  35. fastmcp/server/auth/registry.py +52 -0
  36. fastmcp/server/context.py +107 -26
  37. fastmcp/server/dependencies.py +9 -2
  38. fastmcp/server/http.py +62 -30
  39. fastmcp/server/middleware/middleware.py +3 -23
  40. fastmcp/server/openapi.py +1 -1
  41. fastmcp/server/proxy.py +50 -11
  42. fastmcp/server/server.py +168 -59
  43. fastmcp/settings.py +73 -6
  44. fastmcp/tools/tool.py +36 -3
  45. fastmcp/tools/tool_manager.py +38 -2
  46. fastmcp/tools/tool_transform.py +112 -3
  47. fastmcp/utilities/components.py +35 -2
  48. fastmcp/utilities/json_schema.py +136 -98
  49. fastmcp/utilities/json_schema_type.py +1 -3
  50. fastmcp/utilities/mcp_config.py +28 -0
  51. fastmcp/utilities/openapi.py +240 -50
  52. fastmcp/utilities/tests.py +54 -6
  53. fastmcp/utilities/types.py +89 -11
  54. {fastmcp-2.10.6.dist-info → fastmcp-2.11.0.dist-info}/METADATA +4 -3
  55. fastmcp-2.11.0.dist-info/RECORD +108 -0
  56. fastmcp/server/auth/providers/bearer_env.py +0 -63
  57. fastmcp/utilities/cache.py +0 -26
  58. fastmcp-2.10.6.dist-info/RECORD +0 -93
  59. {fastmcp-2.10.6.dist-info → fastmcp-2.11.0.dist-info}/WHEEL +0 -0
  60. {fastmcp-2.10.6.dist-info → fastmcp-2.11.0.dist-info}/entry_points.txt +0 -0
  61. {fastmcp-2.10.6.dist-info → fastmcp-2.11.0.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,85 @@
1
+ """Intermediate Representation (IR) models for OpenAPI operations."""
2
+
3
+ from typing import Any, Literal
4
+
5
+ from pydantic import Field
6
+
7
+ from fastmcp.utilities.types import FastMCPBaseModel
8
+
9
+ # Type definitions
10
+ HttpMethod = Literal[
11
+ "GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS", "HEAD", "TRACE"
12
+ ]
13
+ ParameterLocation = Literal["path", "query", "header", "cookie"]
14
+ JsonSchema = dict[str, Any]
15
+
16
+
17
+ class ParameterInfo(FastMCPBaseModel):
18
+ """Represents a single parameter for an HTTP operation in our IR."""
19
+
20
+ name: str
21
+ location: ParameterLocation # Mapped from 'in' field of openapi-pydantic Parameter
22
+ required: bool = False
23
+ schema_: JsonSchema = Field(..., alias="schema") # Target name in IR
24
+ description: str | None = None
25
+ explode: bool | None = None # OpenAPI explode property for array parameters
26
+ style: str | None = None # OpenAPI style property for parameter serialization
27
+
28
+
29
+ class RequestBodyInfo(FastMCPBaseModel):
30
+ """Represents the request body for an HTTP operation in our IR."""
31
+
32
+ required: bool = False
33
+ content_schema: dict[str, JsonSchema] = Field(
34
+ default_factory=dict
35
+ ) # Key: media type
36
+ description: str | None = None
37
+
38
+
39
+ class ResponseInfo(FastMCPBaseModel):
40
+ """Represents response information in our IR."""
41
+
42
+ description: str | None = None
43
+ # Store schema per media type, key is media type
44
+ content_schema: dict[str, JsonSchema] = Field(default_factory=dict)
45
+
46
+
47
+ class HTTPRoute(FastMCPBaseModel):
48
+ """Intermediate Representation for a single OpenAPI operation."""
49
+
50
+ path: str
51
+ method: HttpMethod
52
+ operation_id: str | None = None
53
+ summary: str | None = None
54
+ description: str | None = None
55
+ tags: list[str] = Field(default_factory=list)
56
+ parameters: list[ParameterInfo] = Field(default_factory=list)
57
+ request_body: RequestBodyInfo | None = None
58
+ responses: dict[str, ResponseInfo] = Field(
59
+ default_factory=dict
60
+ ) # Key: status code str
61
+ schema_definitions: dict[str, JsonSchema] = Field(
62
+ default_factory=dict
63
+ ) # Store component schemas
64
+ extensions: dict[str, Any] = Field(default_factory=dict)
65
+ openapi_version: str | None = None
66
+
67
+ # Pre-calculated fields for performance
68
+ flat_param_schema: JsonSchema = Field(
69
+ default_factory=dict
70
+ ) # Combined schema for MCP tools
71
+ parameter_map: dict[str, dict[str, str]] = Field(
72
+ default_factory=dict
73
+ ) # Maps flat args to locations
74
+
75
+
76
+ # Export public symbols
77
+ __all__ = [
78
+ "HTTPRoute",
79
+ "ParameterInfo",
80
+ "RequestBodyInfo",
81
+ "ResponseInfo",
82
+ "HttpMethod",
83
+ "ParameterLocation",
84
+ "JsonSchema",
85
+ ]