fastmcp 0.3.4__py3-none-any.whl → 0.4.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 +56 -9
- fastmcp/exceptions.py +4 -0
- fastmcp/prompts/base.py +29 -13
- fastmcp/resources/base.py +5 -13
- fastmcp/resources/templates.py +1 -1
- fastmcp/resources/types.py +10 -1
- fastmcp/server.py +7 -6
- fastmcp/tools/base.py +19 -15
- fastmcp/utilities/func_metadata.py +205 -0
- fastmcp/utilities/logging.py +4 -1
- fastmcp/utilities/types.py +3 -1
- {fastmcp-0.3.4.dist-info → fastmcp-0.4.0.dist-info}/METADATA +37 -9
- fastmcp-0.4.0.dist-info/RECORD +27 -0
- fastmcp-0.4.0.dist-info/licenses/LICENSE +21 -0
- fastmcp-0.3.4.dist-info/RECORD +0 -26
- fastmcp-0.3.4.dist-info/licenses/LICENSE +0 -201
- {fastmcp-0.3.4.dist-info → fastmcp-0.4.0.dist-info}/WHEEL +0 -0
- {fastmcp-0.3.4.dist-info → fastmcp-0.4.0.dist-info}/entry_points.txt +0 -0
fastmcp/cli/cli.py
CHANGED
|
@@ -2,17 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
import importlib.metadata
|
|
4
4
|
import importlib.util
|
|
5
|
+
import os
|
|
5
6
|
import subprocess
|
|
6
7
|
import sys
|
|
7
8
|
from pathlib import Path
|
|
8
|
-
from typing import Optional, Tuple
|
|
9
|
+
from typing import Dict, Optional, Tuple
|
|
9
10
|
|
|
11
|
+
import dotenv
|
|
10
12
|
import typer
|
|
11
13
|
from typing_extensions import Annotated
|
|
12
|
-
import dotenv
|
|
13
14
|
|
|
14
|
-
from
|
|
15
|
-
from . import
|
|
15
|
+
from fastmcp.cli import claude
|
|
16
|
+
from fastmcp.utilities.logging import get_logger
|
|
16
17
|
|
|
17
18
|
logger = get_logger("cli")
|
|
18
19
|
|
|
@@ -24,6 +25,22 @@ app = typer.Typer(
|
|
|
24
25
|
)
|
|
25
26
|
|
|
26
27
|
|
|
28
|
+
def _get_npx_command():
|
|
29
|
+
"""Get the correct npx command for the current platform."""
|
|
30
|
+
if sys.platform == "win32":
|
|
31
|
+
# Try both npx.cmd and npx.exe on Windows
|
|
32
|
+
for cmd in ["npx.cmd", "npx.exe", "npx"]:
|
|
33
|
+
try:
|
|
34
|
+
subprocess.run(
|
|
35
|
+
[cmd, "--version"], check=True, capture_output=True, shell=True
|
|
36
|
+
)
|
|
37
|
+
return cmd
|
|
38
|
+
except subprocess.CalledProcessError:
|
|
39
|
+
continue
|
|
40
|
+
return None
|
|
41
|
+
return "npx" # On Unix-like systems, just use npx
|
|
42
|
+
|
|
43
|
+
|
|
27
44
|
def _parse_env_var(env_var: str) -> Tuple[str, str]:
|
|
28
45
|
"""Parse environment variable string in format KEY=VALUE."""
|
|
29
46
|
if "=" not in env_var:
|
|
@@ -67,11 +84,17 @@ def _parse_file_path(file_spec: str) -> Tuple[Path, Optional[str]]:
|
|
|
67
84
|
Returns:
|
|
68
85
|
Tuple of (file_path, server_object)
|
|
69
86
|
"""
|
|
70
|
-
if
|
|
87
|
+
# First check if we have a Windows path (e.g., C:\...)
|
|
88
|
+
has_windows_drive = len(file_spec) > 1 and file_spec[1] == ":"
|
|
89
|
+
|
|
90
|
+
# Split on the last colon, but only if it's not part of the Windows drive letter
|
|
91
|
+
# and there's actually another colon in the string after the drive letter
|
|
92
|
+
if ":" in (file_spec[2:] if has_windows_drive else file_spec):
|
|
71
93
|
file_str, server_object = file_spec.rsplit(":", 1)
|
|
72
94
|
else:
|
|
73
95
|
file_str, server_object = file_spec, None
|
|
74
96
|
|
|
97
|
+
# Resolve the file path
|
|
75
98
|
file_path = Path(file_str).expanduser().resolve()
|
|
76
99
|
if not file_path.exists():
|
|
77
100
|
logger.error(f"File not found: {file_path}")
|
|
@@ -93,6 +116,11 @@ def _import_server(file: Path, server_object: Optional[str] = None):
|
|
|
93
116
|
Returns:
|
|
94
117
|
The server object
|
|
95
118
|
"""
|
|
119
|
+
# Add parent directory to Python path so imports can be resolved
|
|
120
|
+
file_dir = str(file.parent)
|
|
121
|
+
if file_dir not in sys.path:
|
|
122
|
+
sys.path.insert(0, file_dir)
|
|
123
|
+
|
|
96
124
|
# Import the module
|
|
97
125
|
spec = importlib.util.spec_from_file_location("server_module", file)
|
|
98
126
|
if not spec or not spec.loader:
|
|
@@ -199,10 +227,23 @@ def dev(
|
|
|
199
227
|
with_packages = list(set(with_packages + server.dependencies))
|
|
200
228
|
|
|
201
229
|
uv_cmd = _build_uv_command(file_spec, with_editable, with_packages)
|
|
202
|
-
|
|
230
|
+
|
|
231
|
+
# Get the correct npx command
|
|
232
|
+
npx_cmd = _get_npx_command()
|
|
233
|
+
if not npx_cmd:
|
|
234
|
+
logger.error(
|
|
235
|
+
"npx not found. Please ensure Node.js and npm are properly installed "
|
|
236
|
+
"and added to your system PATH."
|
|
237
|
+
)
|
|
238
|
+
sys.exit(1)
|
|
239
|
+
|
|
240
|
+
# Run the MCP Inspector command with shell=True on Windows
|
|
241
|
+
shell = sys.platform == "win32"
|
|
203
242
|
process = subprocess.run(
|
|
204
|
-
[
|
|
243
|
+
[npx_cmd, "@modelcontextprotocol/inspector"] + uv_cmd,
|
|
205
244
|
check=True,
|
|
245
|
+
shell=shell,
|
|
246
|
+
env=dict(os.environ.items()), # Convert to list of tuples for env update
|
|
206
247
|
)
|
|
207
248
|
sys.exit(process.returncode)
|
|
208
249
|
except subprocess.CalledProcessError as e:
|
|
@@ -217,7 +258,9 @@ def dev(
|
|
|
217
258
|
sys.exit(e.returncode)
|
|
218
259
|
except FileNotFoundError:
|
|
219
260
|
logger.error(
|
|
220
|
-
"npx not found. Please
|
|
261
|
+
"npx not found. Please ensure Node.js and npm are properly installed "
|
|
262
|
+
"and added to your system PATH. You may need to restart your terminal "
|
|
263
|
+
"after installation.",
|
|
221
264
|
extra={"file": str(file)},
|
|
222
265
|
)
|
|
223
266
|
sys.exit(1)
|
|
@@ -382,7 +425,11 @@ def install(
|
|
|
382
425
|
# Load from .env file if specified
|
|
383
426
|
if env_file:
|
|
384
427
|
try:
|
|
385
|
-
env_dict
|
|
428
|
+
env_dict |= {
|
|
429
|
+
k: v
|
|
430
|
+
for k, v in dotenv.dotenv_values(env_file).items()
|
|
431
|
+
if v is not None
|
|
432
|
+
}
|
|
386
433
|
except Exception as e:
|
|
387
434
|
logger.error(f"Failed to load .env file: {e}")
|
|
388
435
|
sys.exit(1)
|
fastmcp/exceptions.py
CHANGED
fastmcp/prompts/base.py
CHANGED
|
@@ -1,43 +1,52 @@
|
|
|
1
1
|
"""Base classes for FastMCP prompts."""
|
|
2
2
|
|
|
3
3
|
import json
|
|
4
|
-
from typing import Any, Callable, Dict, Literal, Optional, Sequence,
|
|
4
|
+
from typing import Any, Callable, Dict, Literal, Optional, Sequence, Awaitable
|
|
5
5
|
import inspect
|
|
6
6
|
|
|
7
|
-
from pydantic import BaseModel, Field, TypeAdapter,
|
|
7
|
+
from pydantic import BaseModel, Field, TypeAdapter, validate_call
|
|
8
8
|
from mcp.types import TextContent, ImageContent, EmbeddedResource
|
|
9
9
|
import pydantic_core
|
|
10
10
|
|
|
11
|
+
CONTENT_TYPES = TextContent | ImageContent | EmbeddedResource
|
|
12
|
+
|
|
11
13
|
|
|
12
14
|
class Message(BaseModel):
|
|
13
15
|
"""Base class for all prompt messages."""
|
|
14
16
|
|
|
15
17
|
role: Literal["user", "assistant"]
|
|
16
|
-
content:
|
|
18
|
+
content: CONTENT_TYPES
|
|
17
19
|
|
|
18
|
-
def __init__(self, content, **kwargs):
|
|
20
|
+
def __init__(self, content: str | CONTENT_TYPES, **kwargs):
|
|
21
|
+
if isinstance(content, str):
|
|
22
|
+
content = TextContent(type="text", text=content)
|
|
19
23
|
super().__init__(content=content, **kwargs)
|
|
20
24
|
|
|
21
|
-
@field_validator("content", mode="before")
|
|
22
|
-
def validate_content(cls, v):
|
|
23
|
-
if isinstance(v, str):
|
|
24
|
-
return TextContent(type="text", text=v)
|
|
25
|
-
return v
|
|
26
|
-
|
|
27
25
|
|
|
28
26
|
class UserMessage(Message):
|
|
29
27
|
"""A message from the user."""
|
|
30
28
|
|
|
31
29
|
role: Literal["user"] = "user"
|
|
32
30
|
|
|
31
|
+
def __init__(self, content: str | CONTENT_TYPES, **kwargs):
|
|
32
|
+
super().__init__(content=content, **kwargs)
|
|
33
|
+
|
|
33
34
|
|
|
34
35
|
class AssistantMessage(Message):
|
|
35
36
|
"""A message from the assistant."""
|
|
36
37
|
|
|
37
38
|
role: Literal["assistant"] = "assistant"
|
|
38
39
|
|
|
40
|
+
def __init__(self, content: str | CONTENT_TYPES, **kwargs):
|
|
41
|
+
super().__init__(content=content, **kwargs)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
message_validator = TypeAdapter(UserMessage | AssistantMessage)
|
|
39
45
|
|
|
40
|
-
|
|
46
|
+
SyncPromptResult = (
|
|
47
|
+
str | Message | dict[str, Any] | Sequence[str | Message | dict[str, Any]]
|
|
48
|
+
)
|
|
49
|
+
PromptResult = SyncPromptResult | Awaitable[SyncPromptResult]
|
|
41
50
|
|
|
42
51
|
|
|
43
52
|
class PromptArgument(BaseModel):
|
|
@@ -67,11 +76,18 @@ class Prompt(BaseModel):
|
|
|
67
76
|
@classmethod
|
|
68
77
|
def from_function(
|
|
69
78
|
cls,
|
|
70
|
-
fn: Callable[...,
|
|
79
|
+
fn: Callable[..., PromptResult],
|
|
71
80
|
name: Optional[str] = None,
|
|
72
81
|
description: Optional[str] = None,
|
|
73
82
|
) -> "Prompt":
|
|
74
|
-
"""Create a Prompt from a function.
|
|
83
|
+
"""Create a Prompt from a function.
|
|
84
|
+
|
|
85
|
+
The function can return:
|
|
86
|
+
- A string (converted to a message)
|
|
87
|
+
- A Message object
|
|
88
|
+
- A dict (converted to a message)
|
|
89
|
+
- A sequence of any of the above
|
|
90
|
+
"""
|
|
75
91
|
func_name = name or fn.__name__
|
|
76
92
|
|
|
77
93
|
if func_name == "<lambda>":
|
fastmcp/resources/base.py
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"""Base classes and interfaces for FastMCP resources."""
|
|
2
2
|
|
|
3
3
|
import abc
|
|
4
|
-
from typing import Union
|
|
4
|
+
from typing import Union, Annotated
|
|
5
5
|
|
|
6
6
|
from pydantic import (
|
|
7
7
|
AnyUrl,
|
|
8
8
|
BaseModel,
|
|
9
9
|
ConfigDict,
|
|
10
10
|
Field,
|
|
11
|
-
|
|
11
|
+
UrlConstraints,
|
|
12
12
|
ValidationInfo,
|
|
13
13
|
field_validator,
|
|
14
14
|
)
|
|
@@ -19,8 +19,9 @@ class Resource(BaseModel, abc.ABC):
|
|
|
19
19
|
|
|
20
20
|
model_config = ConfigDict(validate_default=True)
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
uri: Annotated[AnyUrl, UrlConstraints(host_required=False)] = Field(
|
|
23
|
+
default=..., description="URI of the resource"
|
|
24
|
+
)
|
|
24
25
|
name: str | None = Field(description="Name of the resource", default=None)
|
|
25
26
|
description: str | None = Field(
|
|
26
27
|
description="Description of the resource", default=None
|
|
@@ -31,15 +32,6 @@ class Resource(BaseModel, abc.ABC):
|
|
|
31
32
|
pattern=r"^[a-zA-Z0-9]+/[a-zA-Z0-9\-+.]+$",
|
|
32
33
|
)
|
|
33
34
|
|
|
34
|
-
@field_validator("uri", mode="before")
|
|
35
|
-
def validate_uri(cls, uri: AnyUrl | str) -> AnyUrl:
|
|
36
|
-
if isinstance(uri, str):
|
|
37
|
-
# AnyUrl doesn't support triple-slashes, but files do ("file:///absolute/path")
|
|
38
|
-
if uri.startswith("file://"):
|
|
39
|
-
return FileUrl(uri)
|
|
40
|
-
return AnyUrl(uri)
|
|
41
|
-
return uri
|
|
42
|
-
|
|
43
35
|
@field_validator("name", mode="before")
|
|
44
36
|
@classmethod
|
|
45
37
|
def set_default_name(cls, name: str | None, info: ValidationInfo) -> str:
|
fastmcp/resources/templates.py
CHANGED
fastmcp/resources/types.py
CHANGED
|
@@ -8,7 +8,7 @@ from typing import Any, Callable, Union
|
|
|
8
8
|
import httpx
|
|
9
9
|
import pydantic.json
|
|
10
10
|
import pydantic_core
|
|
11
|
-
from pydantic import Field
|
|
11
|
+
from pydantic import Field, ValidationInfo
|
|
12
12
|
|
|
13
13
|
from fastmcp.resources.base import Resource
|
|
14
14
|
|
|
@@ -91,6 +91,15 @@ class FileResource(Resource):
|
|
|
91
91
|
raise ValueError("Path must be absolute")
|
|
92
92
|
return path
|
|
93
93
|
|
|
94
|
+
@pydantic.field_validator("is_binary")
|
|
95
|
+
@classmethod
|
|
96
|
+
def set_binary_from_mime_type(cls, is_binary: bool, info: ValidationInfo) -> bool:
|
|
97
|
+
"""Set is_binary based on mime_type if not explicitly set."""
|
|
98
|
+
if is_binary:
|
|
99
|
+
return True
|
|
100
|
+
mime_type = info.data.get("mime_type", "text/plain")
|
|
101
|
+
return not mime_type.startswith("text/")
|
|
102
|
+
|
|
94
103
|
async def read(self) -> Union[str, bytes]:
|
|
95
104
|
"""Read the file content."""
|
|
96
105
|
try:
|
fastmcp/server.py
CHANGED
|
@@ -23,6 +23,7 @@ from mcp.types import (
|
|
|
23
23
|
)
|
|
24
24
|
from mcp.types import (
|
|
25
25
|
Prompt as MCPPrompt,
|
|
26
|
+
PromptArgument as MCPPromptArgument,
|
|
26
27
|
)
|
|
27
28
|
from mcp.types import (
|
|
28
29
|
Resource as MCPResource,
|
|
@@ -159,7 +160,7 @@ class FastMCP:
|
|
|
159
160
|
|
|
160
161
|
async def call_tool(
|
|
161
162
|
self, name: str, arguments: dict
|
|
162
|
-
) -> Sequence[TextContent | ImageContent]:
|
|
163
|
+
) -> Sequence[TextContent | ImageContent | EmbeddedResource]:
|
|
163
164
|
"""Call a tool by name with arguments."""
|
|
164
165
|
context = self.get_context()
|
|
165
166
|
result = await self._tool_manager.call_tool(name, arguments, context=context)
|
|
@@ -462,11 +463,11 @@ class FastMCP:
|
|
|
462
463
|
name=prompt.name,
|
|
463
464
|
description=prompt.description,
|
|
464
465
|
arguments=[
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
466
|
+
MCPPromptArgument(
|
|
467
|
+
name=arg.name,
|
|
468
|
+
description=arg.description,
|
|
469
|
+
required=arg.required,
|
|
470
|
+
)
|
|
470
471
|
for arg in (prompt.arguments or [])
|
|
471
472
|
],
|
|
472
473
|
)
|
fastmcp/tools/base.py
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import fastmcp
|
|
2
2
|
from fastmcp.exceptions import ToolError
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
from pydantic import BaseModel, Field
|
|
4
|
+
from fastmcp.utilities.func_metadata import func_metadata, FuncMetadata
|
|
5
|
+
from pydantic import BaseModel, Field
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
import inspect
|
|
@@ -19,6 +19,9 @@ class Tool(BaseModel):
|
|
|
19
19
|
name: str = Field(description="Name of the tool")
|
|
20
20
|
description: str = Field(description="Description of what the tool does")
|
|
21
21
|
parameters: dict = Field(description="JSON schema for tool parameters")
|
|
22
|
+
fn_metadata: FuncMetadata = Field(
|
|
23
|
+
description="Metadata about the function including a pydantic model for tool arguments"
|
|
24
|
+
)
|
|
22
25
|
is_async: bool = Field(description="Whether the tool is async")
|
|
23
26
|
context_kwarg: Optional[str] = Field(
|
|
24
27
|
None, description="Name of the kwarg that should receive context"
|
|
@@ -41,9 +44,6 @@ class Tool(BaseModel):
|
|
|
41
44
|
func_doc = description or fn.__doc__ or ""
|
|
42
45
|
is_async = inspect.iscoroutinefunction(fn)
|
|
43
46
|
|
|
44
|
-
# Get schema from TypeAdapter - will fail if function isn't properly typed
|
|
45
|
-
parameters = TypeAdapter(fn).json_schema()
|
|
46
|
-
|
|
47
47
|
# Find context parameter if it exists
|
|
48
48
|
if context_kwarg is None:
|
|
49
49
|
sig = inspect.signature(fn)
|
|
@@ -52,14 +52,18 @@ class Tool(BaseModel):
|
|
|
52
52
|
context_kwarg = param_name
|
|
53
53
|
break
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
func_arg_metadata = func_metadata(
|
|
56
|
+
fn,
|
|
57
|
+
skip_names=[context_kwarg] if context_kwarg is not None else [],
|
|
58
|
+
)
|
|
59
|
+
parameters = func_arg_metadata.arg_model.model_json_schema()
|
|
57
60
|
|
|
58
61
|
return cls(
|
|
59
62
|
fn=fn,
|
|
60
63
|
name=func_name,
|
|
61
64
|
description=func_doc,
|
|
62
65
|
parameters=parameters,
|
|
66
|
+
fn_metadata=func_arg_metadata,
|
|
63
67
|
is_async=is_async,
|
|
64
68
|
context_kwarg=context_kwarg,
|
|
65
69
|
)
|
|
@@ -67,13 +71,13 @@ class Tool(BaseModel):
|
|
|
67
71
|
async def run(self, arguments: dict, context: Optional["Context"] = None) -> Any:
|
|
68
72
|
"""Run the tool with arguments."""
|
|
69
73
|
try:
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
74
|
+
return await self.fn_metadata.call_fn_with_arg_validation(
|
|
75
|
+
self.fn,
|
|
76
|
+
self.is_async,
|
|
77
|
+
arguments,
|
|
78
|
+
{self.context_kwarg: context}
|
|
79
|
+
if self.context_kwarg is not None
|
|
80
|
+
else None,
|
|
81
|
+
)
|
|
78
82
|
except Exception as e:
|
|
79
83
|
raise ToolError(f"Error executing tool {self.name}: {e}") from e
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import inspect
|
|
2
|
+
from collections.abc import Callable, Sequence, Awaitable
|
|
3
|
+
from typing import (
|
|
4
|
+
Annotated,
|
|
5
|
+
Any,
|
|
6
|
+
Dict,
|
|
7
|
+
ForwardRef,
|
|
8
|
+
)
|
|
9
|
+
from pydantic import Field
|
|
10
|
+
from fastmcp.exceptions import InvalidSignature
|
|
11
|
+
from pydantic._internal._typing_extra import try_eval_type
|
|
12
|
+
import json
|
|
13
|
+
from pydantic import BaseModel
|
|
14
|
+
from pydantic.fields import FieldInfo
|
|
15
|
+
from pydantic import ConfigDict, create_model
|
|
16
|
+
from pydantic import WithJsonSchema
|
|
17
|
+
from pydantic_core import PydanticUndefined
|
|
18
|
+
from fastmcp.utilities.logging import get_logger
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
logger = get_logger(__name__)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class ArgModelBase(BaseModel):
|
|
25
|
+
"""A model representing the arguments to a function."""
|
|
26
|
+
|
|
27
|
+
def model_dump_one_level(self) -> dict[str, Any]:
|
|
28
|
+
"""Return a dict of the model's fields, one level deep.
|
|
29
|
+
|
|
30
|
+
That is, sub-models etc are not dumped - they are kept as pydantic models.
|
|
31
|
+
"""
|
|
32
|
+
kwargs: dict[str, Any] = {}
|
|
33
|
+
for field_name in self.model_fields.keys():
|
|
34
|
+
kwargs[field_name] = getattr(self, field_name)
|
|
35
|
+
return kwargs
|
|
36
|
+
|
|
37
|
+
model_config = ConfigDict(
|
|
38
|
+
arbitrary_types_allowed=True,
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class FuncMetadata(BaseModel):
|
|
43
|
+
arg_model: Annotated[type[ArgModelBase], WithJsonSchema(None)]
|
|
44
|
+
# We can add things in the future like
|
|
45
|
+
# - Maybe some args are excluded from attempting to parse from JSON
|
|
46
|
+
# - Maybe some args are special (like context) for dependency injection
|
|
47
|
+
|
|
48
|
+
async def call_fn_with_arg_validation(
|
|
49
|
+
self,
|
|
50
|
+
fn: Callable[..., Any] | Awaitable[Any],
|
|
51
|
+
fn_is_async: bool,
|
|
52
|
+
arguments_to_validate: dict[str, Any],
|
|
53
|
+
arguments_to_pass_directly: dict[str, Any] | None,
|
|
54
|
+
) -> Any:
|
|
55
|
+
"""Call the given function with arguments validated and injected.
|
|
56
|
+
|
|
57
|
+
Arguments are first attempted to be parsed from JSON, then validated against
|
|
58
|
+
the argument model, before being passed to the function.
|
|
59
|
+
"""
|
|
60
|
+
arguments_pre_parsed = self.pre_parse_json(arguments_to_validate)
|
|
61
|
+
arguments_parsed_model = self.arg_model.model_validate(arguments_pre_parsed)
|
|
62
|
+
arguments_parsed_dict = arguments_parsed_model.model_dump_one_level()
|
|
63
|
+
|
|
64
|
+
arguments_parsed_dict |= arguments_to_pass_directly or {}
|
|
65
|
+
|
|
66
|
+
if fn_is_async:
|
|
67
|
+
if isinstance(fn, Awaitable):
|
|
68
|
+
return await fn
|
|
69
|
+
return await fn(**arguments_parsed_dict)
|
|
70
|
+
if isinstance(fn, Callable):
|
|
71
|
+
return fn(**arguments_parsed_dict)
|
|
72
|
+
raise TypeError("fn must be either Callable or Awaitable")
|
|
73
|
+
|
|
74
|
+
def pre_parse_json(self, data: dict[str, Any]) -> dict[str, Any]:
|
|
75
|
+
"""Pre-parse data from JSON.
|
|
76
|
+
|
|
77
|
+
Return a dict with same keys as input but with values parsed from JSON
|
|
78
|
+
if appropriate.
|
|
79
|
+
|
|
80
|
+
This is to handle cases like `["a", "b", "c"]` being passed in as JSON inside
|
|
81
|
+
a string rather than an actual list. Claude desktop is prone to this - in fact
|
|
82
|
+
it seems incapable of NOT doing this. For sub-models, it tends to pass
|
|
83
|
+
dicts (JSON objects) as JSON strings, which can be pre-parsed here.
|
|
84
|
+
"""
|
|
85
|
+
new_data = data.copy() # Shallow copy
|
|
86
|
+
for field_name, field_info in self.arg_model.model_fields.items():
|
|
87
|
+
if field_name not in data.keys():
|
|
88
|
+
continue
|
|
89
|
+
if isinstance(data[field_name], str):
|
|
90
|
+
try:
|
|
91
|
+
pre_parsed = json.loads(data[field_name])
|
|
92
|
+
except json.JSONDecodeError:
|
|
93
|
+
continue # Not JSON - skip
|
|
94
|
+
if isinstance(pre_parsed, str):
|
|
95
|
+
# This is likely that the raw value is e.g. `"hello"` which we
|
|
96
|
+
# Should really be parsed as '"hello"' in Python - but if we parse
|
|
97
|
+
# it as JSON it'll turn into just 'hello'. So we skip it.
|
|
98
|
+
continue
|
|
99
|
+
new_data[field_name] = pre_parsed
|
|
100
|
+
assert new_data.keys() == data.keys()
|
|
101
|
+
return new_data
|
|
102
|
+
|
|
103
|
+
model_config = ConfigDict(
|
|
104
|
+
arbitrary_types_allowed=True,
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def func_metadata(func: Callable, skip_names: Sequence[str] = ()) -> FuncMetadata:
|
|
109
|
+
"""Given a function, return metadata including a pydantic model representing its signature.
|
|
110
|
+
|
|
111
|
+
The use case for this is
|
|
112
|
+
```
|
|
113
|
+
meta = func_to_pyd(func)
|
|
114
|
+
validated_args = meta.arg_model.model_validate(some_raw_data_dict)
|
|
115
|
+
return func(**validated_args.model_dump_one_level())
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**critically** it also provides pre-parse helper to attempt to parse things from JSON.
|
|
119
|
+
|
|
120
|
+
Args:
|
|
121
|
+
func: The function to convert to a pydantic model
|
|
122
|
+
skip_names: A list of parameter names to skip. These will not be included in
|
|
123
|
+
the model.
|
|
124
|
+
Returns:
|
|
125
|
+
A pydantic model representing the function's signature.
|
|
126
|
+
"""
|
|
127
|
+
sig = _get_typed_signature(func)
|
|
128
|
+
params = sig.parameters
|
|
129
|
+
dynamic_pydantic_model_params: dict[str, Any] = {}
|
|
130
|
+
globalns = getattr(func, "__globals__", {})
|
|
131
|
+
for param in params.values():
|
|
132
|
+
if param.name.startswith("_"):
|
|
133
|
+
raise InvalidSignature(
|
|
134
|
+
f"Parameter {param.name} of {func.__name__} may not start with an underscore"
|
|
135
|
+
)
|
|
136
|
+
if param.name in skip_names:
|
|
137
|
+
continue
|
|
138
|
+
annotation = param.annotation
|
|
139
|
+
|
|
140
|
+
# `x: None` / `x: None = None`
|
|
141
|
+
if annotation is None:
|
|
142
|
+
annotation = Annotated[
|
|
143
|
+
None,
|
|
144
|
+
Field(
|
|
145
|
+
default=param.default
|
|
146
|
+
if param.default is not inspect.Parameter.empty
|
|
147
|
+
else PydanticUndefined
|
|
148
|
+
),
|
|
149
|
+
]
|
|
150
|
+
|
|
151
|
+
# Untyped field
|
|
152
|
+
if annotation is inspect.Parameter.empty:
|
|
153
|
+
annotation = Annotated[
|
|
154
|
+
Any,
|
|
155
|
+
Field(),
|
|
156
|
+
# 🤷
|
|
157
|
+
WithJsonSchema({"title": param.name, "type": "string"}),
|
|
158
|
+
]
|
|
159
|
+
|
|
160
|
+
field_info = FieldInfo.from_annotated_attribute(
|
|
161
|
+
_get_typed_annotation(annotation, globalns),
|
|
162
|
+
param.default
|
|
163
|
+
if param.default is not inspect.Parameter.empty
|
|
164
|
+
else PydanticUndefined,
|
|
165
|
+
)
|
|
166
|
+
dynamic_pydantic_model_params[param.name] = (field_info.annotation, field_info)
|
|
167
|
+
continue
|
|
168
|
+
|
|
169
|
+
arguments_model = create_model(
|
|
170
|
+
f"{func.__name__}Arguments",
|
|
171
|
+
**dynamic_pydantic_model_params,
|
|
172
|
+
__base__=ArgModelBase,
|
|
173
|
+
)
|
|
174
|
+
resp = FuncMetadata(arg_model=arguments_model)
|
|
175
|
+
return resp
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
def _get_typed_annotation(annotation: Any, globalns: Dict[str, Any]) -> Any:
|
|
179
|
+
if isinstance(annotation, str):
|
|
180
|
+
annotation = ForwardRef(annotation)
|
|
181
|
+
annotation, status = try_eval_type(annotation, globalns, globalns)
|
|
182
|
+
|
|
183
|
+
# This check and raise could perhaps be skipped, and we (FastMCP) just call
|
|
184
|
+
# model_rebuild right before using it 🤷
|
|
185
|
+
if status is False:
|
|
186
|
+
raise InvalidSignature(f"Unable to evaluate type annotation {annotation}")
|
|
187
|
+
|
|
188
|
+
return annotation
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
def _get_typed_signature(call: Callable[..., Any]) -> inspect.Signature:
|
|
192
|
+
"""Get function signature while evaluating forward references"""
|
|
193
|
+
signature = inspect.signature(call)
|
|
194
|
+
globalns = getattr(call, "__globals__", {})
|
|
195
|
+
typed_params = [
|
|
196
|
+
inspect.Parameter(
|
|
197
|
+
name=param.name,
|
|
198
|
+
kind=param.kind,
|
|
199
|
+
default=param.default,
|
|
200
|
+
annotation=_get_typed_annotation(param.annotation, globalns),
|
|
201
|
+
)
|
|
202
|
+
for param in signature.parameters.values()
|
|
203
|
+
]
|
|
204
|
+
typed_signature = inspect.Signature(typed_params)
|
|
205
|
+
return typed_signature
|
fastmcp/utilities/logging.py
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import logging
|
|
4
4
|
from typing import Literal
|
|
5
5
|
|
|
6
|
+
from rich.console import Console
|
|
6
7
|
from rich.logging import RichHandler
|
|
7
8
|
|
|
8
9
|
|
|
@@ -27,5 +28,7 @@ def configure_logging(
|
|
|
27
28
|
level: the log level to use
|
|
28
29
|
"""
|
|
29
30
|
logging.basicConfig(
|
|
30
|
-
level=level,
|
|
31
|
+
level=level,
|
|
32
|
+
format="%(message)s",
|
|
33
|
+
handlers=[RichHandler(console=Console(stderr=True), rich_tracebacks=True)],
|
|
31
34
|
)
|
fastmcp/utilities/types.py
CHANGED
|
@@ -47,7 +47,9 @@ class Image:
|
|
|
47
47
|
if self.path:
|
|
48
48
|
with open(self.path, "rb") as f:
|
|
49
49
|
data = base64.b64encode(f.read()).decode()
|
|
50
|
-
|
|
50
|
+
elif self.data is not None:
|
|
51
51
|
data = base64.b64encode(self.data).decode()
|
|
52
|
+
else:
|
|
53
|
+
raise ValueError("No image data available")
|
|
52
54
|
|
|
53
55
|
return ImageContent(type="image", data=data, mimeType=self._mime_type)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: fastmcp
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: A more ergonomic interface for MCP servers
|
|
5
5
|
Author: Jeremiah Lowin
|
|
6
6
|
License: Apache-2.0
|
|
@@ -16,10 +16,20 @@ Requires-Dist: copychat>=0.5.2; extra == 'dev'
|
|
|
16
16
|
Requires-Dist: ipython>=8.12.3; extra == 'dev'
|
|
17
17
|
Requires-Dist: pdbpp>=0.10.3; extra == 'dev'
|
|
18
18
|
Requires-Dist: pre-commit; extra == 'dev'
|
|
19
|
+
Requires-Dist: pyright>=1.1.389; extra == 'dev'
|
|
19
20
|
Requires-Dist: pytest-asyncio>=0.23.5; extra == 'dev'
|
|
21
|
+
Requires-Dist: pytest-flakefinder; extra == 'dev'
|
|
20
22
|
Requires-Dist: pytest-xdist>=3.6.1; extra == 'dev'
|
|
21
23
|
Requires-Dist: pytest>=8.3.3; extra == 'dev'
|
|
22
24
|
Requires-Dist: ruff; extra == 'dev'
|
|
25
|
+
Provides-Extra: tests
|
|
26
|
+
Requires-Dist: pre-commit; extra == 'tests'
|
|
27
|
+
Requires-Dist: pyright>=1.1.389; extra == 'tests'
|
|
28
|
+
Requires-Dist: pytest-asyncio>=0.23.5; extra == 'tests'
|
|
29
|
+
Requires-Dist: pytest-flakefinder; extra == 'tests'
|
|
30
|
+
Requires-Dist: pytest-xdist>=3.6.1; extra == 'tests'
|
|
31
|
+
Requires-Dist: pytest>=8.3.3; extra == 'tests'
|
|
32
|
+
Requires-Dist: ruff; extra == 'tests'
|
|
23
33
|
Description-Content-Type: text/markdown
|
|
24
34
|
|
|
25
35
|
<!-- omit in toc -->
|
|
@@ -236,6 +246,27 @@ async def fetch_weather(city: str) -> str:
|
|
|
236
246
|
return response.text
|
|
237
247
|
```
|
|
238
248
|
|
|
249
|
+
Complex input handling example:
|
|
250
|
+
```python
|
|
251
|
+
from pydantic import BaseModel, Field
|
|
252
|
+
from typing import Annotated
|
|
253
|
+
|
|
254
|
+
class ShrimpTank(BaseModel):
|
|
255
|
+
class Shrimp(BaseModel):
|
|
256
|
+
name: Annotated[str, Field(max_length=10)]
|
|
257
|
+
|
|
258
|
+
shrimp: list[Shrimp]
|
|
259
|
+
|
|
260
|
+
@mcp.tool()
|
|
261
|
+
def name_shrimp(
|
|
262
|
+
tank: ShrimpTank,
|
|
263
|
+
# You can use pydantic Field in function signatures for validation.
|
|
264
|
+
extra_names: Annotated[list[str], Field(max_length=10)],
|
|
265
|
+
) -> list[str]:
|
|
266
|
+
"""List all shrimp names in the tank"""
|
|
267
|
+
return [shrimp.name for shrimp in tank.shrimp] + extra_names
|
|
268
|
+
```
|
|
269
|
+
|
|
239
270
|
### Prompts
|
|
240
271
|
|
|
241
272
|
Prompts are reusable templates that help LLMs interact with your server effectively. They're like "best practices" encoded into your server. A prompt can be as simple as a string:
|
|
@@ -488,23 +519,20 @@ FastMCP requires Python 3.10+ and [uv](https://docs.astral.sh/uv/).
|
|
|
488
519
|
|
|
489
520
|
### Installation
|
|
490
521
|
|
|
491
|
-
|
|
522
|
+
For development, we recommend installing FastMCP with development dependencies, which includes various utilities the maintainers find useful.
|
|
492
523
|
|
|
493
524
|
```bash
|
|
494
|
-
git clone https://github.com/
|
|
525
|
+
git clone https://github.com/jlowin/fastmcp.git
|
|
495
526
|
cd fastmcp
|
|
527
|
+
uv sync --frozen --extra dev
|
|
496
528
|
```
|
|
497
529
|
|
|
498
|
-
|
|
530
|
+
For running tests only (e.g., in CI), you only need the testing dependencies:
|
|
499
531
|
|
|
500
532
|
```bash
|
|
501
|
-
uv
|
|
502
|
-
source .venv/bin/activate
|
|
503
|
-
uv sync --frozen --all-extras --dev
|
|
533
|
+
uv sync --frozen --extra tests
|
|
504
534
|
```
|
|
505
535
|
|
|
506
|
-
|
|
507
|
-
|
|
508
536
|
### Testing
|
|
509
537
|
|
|
510
538
|
Please make sure to test any new functionality. Your tests should be simple and atomic and anticipate change rather than cement complex patterns.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
fastmcp/__init__.py,sha256=Y5dHGBwyQPgNP5gzOyNIItefvMZ3vJLdom1oV8A1u_k,248
|
|
2
|
+
fastmcp/exceptions.py,sha256=q9djUDmpwmGEWcHI8q4UzJBtf7s7UtgL--OB7OaGzyQ,435
|
|
3
|
+
fastmcp/server.py,sha256=VBO8UfhxT-bj1zhSO6M5TnIrYooHfEkegP8W-KcmGog,22302
|
|
4
|
+
fastmcp/cli/__init__.py,sha256=7hrwtCHX9nMd9qcz7R_JFSoqbL71fC35cBLXBS430mg,88
|
|
5
|
+
fastmcp/cli/claude.py,sha256=5SoVEsA_PnOyOe2bcItvfcCwuhfX6W99TP1nXahLIJE,4442
|
|
6
|
+
fastmcp/cli/cli.py,sha256=sWNhq0ryeWcT_ANCW-Ss4ldHfptVDm8d6GjNtJe-8x8,13510
|
|
7
|
+
fastmcp/prompts/__init__.py,sha256=4BsMxoYolpoxg74xkkkzCFL8vvdkLVJ5cIPNs1ND1Jo,99
|
|
8
|
+
fastmcp/prompts/base.py,sha256=8zAIvO3MyiBKs-c-fURMbTBi4CW-UuCizQ0Mv5t2Wnc,5530
|
|
9
|
+
fastmcp/prompts/manager.py,sha256=EkexOB_N4QNtC-UlZmIcWcau91ceO2O1K4_kD75pA_A,1485
|
|
10
|
+
fastmcp/prompts/prompt_manager.py,sha256=5uR14gsi7l0YHwbxFH7N5b_ACHHRWyTtBAH3R0-G5rk,1129
|
|
11
|
+
fastmcp/resources/__init__.py,sha256=9QShop6ckX3Khh3BQLZNkB6R2ZhwskAcnh7-sIuX-W8,464
|
|
12
|
+
fastmcp/resources/base.py,sha256=mKJUiOQaGJAc0qEim0R3Xzd_COtW3anOghAwGOmZ0v0,1368
|
|
13
|
+
fastmcp/resources/resource_manager.py,sha256=b0PKpG-pKi7x2Yx-qaeknjv0mqL17zixSIYOz2V5G6o,3271
|
|
14
|
+
fastmcp/resources/templates.py,sha256=_JHJ8sZqHsQM9p81Bcc_0-OBkYnYd1dFBoibFEMLwkw,2884
|
|
15
|
+
fastmcp/resources/types.py,sha256=VbMaQ1n-UfN1eSQjz0LcadrmOBtAx6TadXkO4nA3fgg,6048
|
|
16
|
+
fastmcp/tools/__init__.py,sha256=ZboxhyMJDl87Svjov8YwNYwNZi55P9VhmpTjBZLesnk,96
|
|
17
|
+
fastmcp/tools/base.py,sha256=aJEOnNUs5KiTC16Szr8AEZyozTtpp0vZXtF5wMIA2mM,2797
|
|
18
|
+
fastmcp/tools/tool_manager.py,sha256=PT6XHcQWzhdC6kfdsJaddRn7VLps4nAs5FMG8l1j8Zc,1617
|
|
19
|
+
fastmcp/utilities/__init__.py,sha256=-imJ8S-rXmbXMWeDamldP-dHDqAPg_wwmPVz-LNX14E,31
|
|
20
|
+
fastmcp/utilities/func_metadata.py,sha256=xJWWOoMC0oxMK0R8cbC7w1HLfT8K0jBDlapdCTVxOTI,7503
|
|
21
|
+
fastmcp/utilities/logging.py,sha256=1ipiOXzgWUp3Vih_JtEiLX7aAFmrUDZNr4KrZbofZTM,818
|
|
22
|
+
fastmcp/utilities/types.py,sha256=kCjz2h3UlMAfHBB-HR5w6s9kauX0KLyQzRuHyhpaP4A,1810
|
|
23
|
+
fastmcp-0.4.0.dist-info/METADATA,sha256=86PQLRngMLSdkTOGcjt_Xv6_StUP2e-o9pW4JEqyG-4,16374
|
|
24
|
+
fastmcp-0.4.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
25
|
+
fastmcp-0.4.0.dist-info/entry_points.txt,sha256=ff8bMtKX1JvXyurMibAacMSKbJEPmac9ffAKU9mLnM8,44
|
|
26
|
+
fastmcp-0.4.0.dist-info/licenses/LICENSE,sha256=l3hc_411P__OCHoZlE2ZYWekMW-fmIZe9cYnGVyhu9I,1071
|
|
27
|
+
fastmcp-0.4.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Jeremiah Lowin
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
fastmcp-0.3.4.dist-info/RECORD
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
fastmcp/__init__.py,sha256=Y5dHGBwyQPgNP5gzOyNIItefvMZ3vJLdom1oV8A1u_k,248
|
|
2
|
-
fastmcp/exceptions.py,sha256=K0rCgXsUVlws39hz98Tb4BBf_BzIql_zXFZgqbkNTiE,348
|
|
3
|
-
fastmcp/server.py,sha256=V6BaciC5u9g_XzbvPkafjGO8OtEBPGy_KlV535Au0do,22234
|
|
4
|
-
fastmcp/cli/__init__.py,sha256=7hrwtCHX9nMd9qcz7R_JFSoqbL71fC35cBLXBS430mg,88
|
|
5
|
-
fastmcp/cli/claude.py,sha256=5SoVEsA_PnOyOe2bcItvfcCwuhfX6W99TP1nXahLIJE,4442
|
|
6
|
-
fastmcp/cli/cli.py,sha256=Ub2iNwnCVRO4TbC6Rr_1xOeTKnDN-9XE1z1O1yZatbg,11664
|
|
7
|
-
fastmcp/prompts/__init__.py,sha256=4BsMxoYolpoxg74xkkkzCFL8vvdkLVJ5cIPNs1ND1Jo,99
|
|
8
|
-
fastmcp/prompts/base.py,sha256=WaSsfyFSsUPUbcApkGy3Pm-Ne-Gk-5ZwU3efqRYn1mQ,4996
|
|
9
|
-
fastmcp/prompts/manager.py,sha256=EkexOB_N4QNtC-UlZmIcWcau91ceO2O1K4_kD75pA_A,1485
|
|
10
|
-
fastmcp/prompts/prompt_manager.py,sha256=5uR14gsi7l0YHwbxFH7N5b_ACHHRWyTtBAH3R0-G5rk,1129
|
|
11
|
-
fastmcp/resources/__init__.py,sha256=9QShop6ckX3Khh3BQLZNkB6R2ZhwskAcnh7-sIuX-W8,464
|
|
12
|
-
fastmcp/resources/base.py,sha256=inm2uhaE6KPQEsMd4SyDLbRIOjQrXahSn84RNT3Y6MY,1723
|
|
13
|
-
fastmcp/resources/resource_manager.py,sha256=b0PKpG-pKi7x2Yx-qaeknjv0mqL17zixSIYOz2V5G6o,3271
|
|
14
|
-
fastmcp/resources/templates.py,sha256=EmLlI-ddBBzSTAUiA6-knFnHCE3MPMW2ZoH9WswPKvI,2868
|
|
15
|
-
fastmcp/resources/types.py,sha256=ofE6bfeQQfPSmaWrLGDf3qjCP0kGjKmvupsHDYkSrj0,5658
|
|
16
|
-
fastmcp/tools/__init__.py,sha256=ZboxhyMJDl87Svjov8YwNYwNZi55P9VhmpTjBZLesnk,96
|
|
17
|
-
fastmcp/tools/base.py,sha256=JPdTx8SAl5pKsHyIVxnsLG88f3fbjnopDTOAZ_PoVQE,2585
|
|
18
|
-
fastmcp/tools/tool_manager.py,sha256=PT6XHcQWzhdC6kfdsJaddRn7VLps4nAs5FMG8l1j8Zc,1617
|
|
19
|
-
fastmcp/utilities/__init__.py,sha256=-imJ8S-rXmbXMWeDamldP-dHDqAPg_wwmPVz-LNX14E,31
|
|
20
|
-
fastmcp/utilities/logging.py,sha256=VLJdNc0tIYoQZmpobehLUnWrQz7NXnuwSqrDlFt2RF0,738
|
|
21
|
-
fastmcp/utilities/types.py,sha256=jFlZMZsKrJg4NWc1vTBIILLoHpTVwSd-vxO7ycoRuig,1718
|
|
22
|
-
fastmcp-0.3.4.dist-info/METADATA,sha256=-DqzP1SZTCU0qgtFZ7K3ABSaswQz9Q5ShWU-UwN_mkM,15260
|
|
23
|
-
fastmcp-0.3.4.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
24
|
-
fastmcp-0.3.4.dist-info/entry_points.txt,sha256=ff8bMtKX1JvXyurMibAacMSKbJEPmac9ffAKU9mLnM8,44
|
|
25
|
-
fastmcp-0.3.4.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
26
|
-
fastmcp-0.3.4.dist-info/RECORD,,
|
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
|
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
-
|
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
-
the copyright owner that is granting the License.
|
|
14
|
-
|
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
-
other entities that control, are controlled by, or are under common
|
|
17
|
-
control with that entity. For the purposes of this definition,
|
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
-
direction or management of such entity, whether by contract or
|
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
-
exercising permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation
|
|
28
|
-
source, and configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
|
31
|
-
transformation or translation of a Source form, including but
|
|
32
|
-
not limited to compiled object code, generated documentation,
|
|
33
|
-
and conversions to other media types.
|
|
34
|
-
|
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
-
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
-
(an example is provided in the Appendix below).
|
|
39
|
-
|
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
-
the Work and Derivative Works thereof.
|
|
47
|
-
|
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
|
49
|
-
the original version of the Work and any modifications or additions
|
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
-
|
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
-
subsequently incorporated within the Work.
|
|
65
|
-
|
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
|
72
|
-
|
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
-
where such license applies only to those patent claims licensable
|
|
79
|
-
by such Contributor that are necessarily infringed by their
|
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
-
institute patent litigation against any entity (including a
|
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
-
or contributory patent infringement, then any patent licenses
|
|
86
|
-
granted to You under this License for that Work shall terminate
|
|
87
|
-
as of the date such litigation is filed.
|
|
88
|
-
|
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
-
modifications, and in Source or Object form, provided that You
|
|
92
|
-
meet the following conditions:
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or
|
|
95
|
-
Derivative Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
|
108
|
-
include a readable copy of the attribution notices contained
|
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
|
111
|
-
of the following places: within a NOTICE text file distributed
|
|
112
|
-
as part of the Derivative Works; within the Source form or
|
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
|
114
|
-
within a display generated by the Derivative Works, if and
|
|
115
|
-
wherever such third-party notices normally appear. The contents
|
|
116
|
-
of the NOTICE file are for informational purposes only and
|
|
117
|
-
do not modify the License. You may add Your own attribution
|
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
-
that such additional attribution notices cannot be construed
|
|
121
|
-
as modifying the License.
|
|
122
|
-
|
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
|
124
|
-
may provide additional or different license terms and conditions
|
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
-
the conditions stated in this License.
|
|
129
|
-
|
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
-
this License, without any additional terms or conditions.
|
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
-
the terms of any separate license agreement you may have executed
|
|
136
|
-
with Licensor regarding such Contributions.
|
|
137
|
-
|
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for reasonable and customary use in describing the
|
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
-
|
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
|
152
|
-
|
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
|
158
|
-
incidental, or consequential damages of any character arising as a
|
|
159
|
-
result of this License or out of the use or inability to use the
|
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
-
other commercial damages or losses), even if such Contributor
|
|
163
|
-
has been advised of the possibility of such damages.
|
|
164
|
-
|
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
-
or other liability obligations and/or rights consistent with this
|
|
169
|
-
License. However, in accepting such obligations, You may act only
|
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|
|
177
|
-
|
|
178
|
-
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
-
|
|
180
|
-
To apply the Apache License to your work, attach the following
|
|
181
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
-
replaced with your own identifying information. (Don't include
|
|
183
|
-
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
-
comment syntax for the file format. We also recommend that a
|
|
185
|
-
file or class name and description of purpose be included on the
|
|
186
|
-
same "printed page" as the copyright notice for easier
|
|
187
|
-
identification within third-party archives.
|
|
188
|
-
|
|
189
|
-
Copyright [yyyy] [name of copyright owner]
|
|
190
|
-
|
|
191
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
-
you may not use this file except in compliance with the License.
|
|
193
|
-
You may obtain a copy of the License at
|
|
194
|
-
|
|
195
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
-
|
|
197
|
-
Unless required by applicable law or agreed to in writing, software
|
|
198
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
-
See the License for the specific language governing permissions and
|
|
201
|
-
limitations under the License.
|
|
File without changes
|
|
File without changes
|