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.
- fastmcp/cli/cli.py +128 -33
- fastmcp/cli/install/claude_code.py +42 -1
- fastmcp/cli/install/claude_desktop.py +42 -1
- fastmcp/cli/install/cursor.py +42 -1
- fastmcp/cli/install/mcp_json.py +41 -0
- fastmcp/cli/run.py +127 -1
- fastmcp/client/__init__.py +2 -0
- fastmcp/client/auth/oauth.py +68 -99
- fastmcp/client/oauth_callback.py +18 -0
- fastmcp/client/transports.py +69 -15
- fastmcp/contrib/component_manager/example.py +2 -2
- fastmcp/experimental/server/openapi/README.md +266 -0
- fastmcp/experimental/server/openapi/__init__.py +38 -0
- fastmcp/experimental/server/openapi/components.py +348 -0
- fastmcp/experimental/server/openapi/routing.py +132 -0
- fastmcp/experimental/server/openapi/server.py +466 -0
- fastmcp/experimental/utilities/openapi/README.md +239 -0
- fastmcp/experimental/utilities/openapi/__init__.py +68 -0
- fastmcp/experimental/utilities/openapi/director.py +208 -0
- fastmcp/experimental/utilities/openapi/formatters.py +355 -0
- fastmcp/experimental/utilities/openapi/json_schema_converter.py +340 -0
- fastmcp/experimental/utilities/openapi/models.py +85 -0
- fastmcp/experimental/utilities/openapi/parser.py +618 -0
- fastmcp/experimental/utilities/openapi/schemas.py +538 -0
- fastmcp/mcp_config.py +125 -88
- fastmcp/prompts/prompt.py +11 -1
- fastmcp/resources/resource.py +21 -1
- fastmcp/resources/template.py +20 -1
- fastmcp/server/auth/__init__.py +17 -2
- fastmcp/server/auth/auth.py +144 -7
- fastmcp/server/auth/providers/bearer.py +25 -473
- fastmcp/server/auth/providers/in_memory.py +4 -2
- fastmcp/server/auth/providers/jwt.py +538 -0
- fastmcp/server/auth/providers/workos.py +170 -0
- fastmcp/server/auth/registry.py +52 -0
- fastmcp/server/context.py +107 -26
- fastmcp/server/dependencies.py +9 -2
- fastmcp/server/http.py +62 -30
- fastmcp/server/middleware/middleware.py +3 -23
- fastmcp/server/openapi.py +1 -1
- fastmcp/server/proxy.py +50 -11
- fastmcp/server/server.py +168 -59
- fastmcp/settings.py +73 -6
- fastmcp/tools/tool.py +36 -3
- fastmcp/tools/tool_manager.py +38 -2
- fastmcp/tools/tool_transform.py +112 -3
- fastmcp/utilities/components.py +35 -2
- fastmcp/utilities/json_schema.py +136 -98
- fastmcp/utilities/json_schema_type.py +1 -3
- fastmcp/utilities/mcp_config.py +28 -0
- fastmcp/utilities/openapi.py +240 -50
- fastmcp/utilities/tests.py +54 -6
- fastmcp/utilities/types.py +89 -11
- {fastmcp-2.10.6.dist-info → fastmcp-2.11.0.dist-info}/METADATA +4 -3
- fastmcp-2.11.0.dist-info/RECORD +108 -0
- fastmcp/server/auth/providers/bearer_env.py +0 -63
- fastmcp/utilities/cache.py +0 -26
- fastmcp-2.10.6.dist-info/RECORD +0 -93
- {fastmcp-2.10.6.dist-info → fastmcp-2.11.0.dist-info}/WHEEL +0 -0
- {fastmcp-2.10.6.dist-info → fastmcp-2.11.0.dist-info}/entry_points.txt +0 -0
- {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
|
+
]
|