aixtools 0.2.19__py3-none-any.whl → 0.2.20__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.
Potentially problematic release.
This version of aixtools might be problematic. Click here for more details.
- aixtools/_version.py +2 -2
- aixtools/mcp/__init__.py +5 -1
- aixtools/{logging/mcp_middleware.py → mcp/middleware.py} +1 -1
- aixtools/mcp/server.py +72 -0
- {aixtools-0.2.19.dist-info → aixtools-0.2.20.dist-info}/METADATA +1 -1
- {aixtools-0.2.19.dist-info → aixtools-0.2.20.dist-info}/RECORD +9 -8
- {aixtools-0.2.19.dist-info → aixtools-0.2.20.dist-info}/WHEEL +0 -0
- {aixtools-0.2.19.dist-info → aixtools-0.2.20.dist-info}/entry_points.txt +0 -0
- {aixtools-0.2.19.dist-info → aixtools-0.2.20.dist-info}/top_level.txt +0 -0
aixtools/_version.py
CHANGED
|
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
|
28
28
|
commit_id: COMMIT_ID
|
|
29
29
|
__commit_id__: COMMIT_ID
|
|
30
30
|
|
|
31
|
-
__version__ = version = '0.2.
|
|
32
|
-
__version_tuple__ = version_tuple = (0, 2,
|
|
31
|
+
__version__ = version = '0.2.20'
|
|
32
|
+
__version_tuple__ = version_tuple = (0, 2, 20)
|
|
33
33
|
|
|
34
34
|
__commit_id__ = commit_id = None
|
aixtools/mcp/__init__.py
CHANGED
|
@@ -4,8 +4,12 @@ Model Context Protocol (MCP) implementation for AI agent communication.
|
|
|
4
4
|
|
|
5
5
|
from aixtools.mcp.exceptions import AixToolError
|
|
6
6
|
from aixtools.mcp.fast_mcp_log import FastMcpLog
|
|
7
|
+
from aixtools.mcp.middleware import AixErrorHandlingMiddleware
|
|
8
|
+
from aixtools.mcp.server import create_mcp_server
|
|
7
9
|
|
|
8
10
|
__all__ = [
|
|
9
|
-
"
|
|
11
|
+
"AixErrorHandlingMiddleware",
|
|
10
12
|
"AixToolError",
|
|
13
|
+
"FastMcpLog",
|
|
14
|
+
"create_mcp_server",
|
|
11
15
|
]
|
|
@@ -7,7 +7,7 @@ import traceback
|
|
|
7
7
|
from fastmcp.server.middleware.error_handling import ErrorHandlingMiddleware
|
|
8
8
|
from fastmcp.server.middleware.middleware import MiddlewareContext
|
|
9
9
|
|
|
10
|
-
from aixtools.mcp import AixToolError
|
|
10
|
+
from aixtools.mcp.exceptions import AixToolError
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
class AixErrorHandlingMiddleware(ErrorHandlingMiddleware):
|
aixtools/mcp/server.py
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"""Utilities for FastMCP servers."""
|
|
2
|
+
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
from fastmcp import FastMCP
|
|
6
|
+
from fastmcp.server.middleware.logging import LoggingMiddleware
|
|
7
|
+
from fastmcp.server.middleware.timing import TimingMiddleware
|
|
8
|
+
from fastmcp.utilities.types import NotSet
|
|
9
|
+
|
|
10
|
+
from aixtools.auth.auth import AccessTokenAuthProvider
|
|
11
|
+
from aixtools.logging.logging_config import get_logger
|
|
12
|
+
from aixtools.mcp.middleware import AixErrorHandlingMiddleware
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def create_mcp_server(
|
|
16
|
+
*,
|
|
17
|
+
name: str,
|
|
18
|
+
instructions: str | None = None,
|
|
19
|
+
**kwargs: Any,
|
|
20
|
+
) -> FastMCP:
|
|
21
|
+
"""
|
|
22
|
+
MCP server instance with preconfigured auth and middleware.
|
|
23
|
+
|
|
24
|
+
All FastMCP constructor parameters are supported via **kwargs.
|
|
25
|
+
|
|
26
|
+
Args:
|
|
27
|
+
name: Server name
|
|
28
|
+
instructions: Optional server instructions
|
|
29
|
+
**kwargs: All other FastMCP constructor parameters:
|
|
30
|
+
- version: str | None
|
|
31
|
+
- auth: AuthProvider | None (AccessTokenAuthProvider if not set, pass None to disable)
|
|
32
|
+
- middleware: list[Middleware] | None (custom middleware if not set, pass None to disable)
|
|
33
|
+
- lifespan: Callable | None
|
|
34
|
+
- tool_serializer: Callable[[Any], str] | None
|
|
35
|
+
- cache_expiration_seconds: float | None
|
|
36
|
+
- on_duplicate_tools: DuplicateBehavior | None
|
|
37
|
+
- on_duplicate_resources: DuplicateBehavior | None
|
|
38
|
+
- on_duplicate_prompts: DuplicateBehavior | None
|
|
39
|
+
- resource_prefix_format: Literal["protocol", "path"] | None
|
|
40
|
+
- mask_error_details: bool | None
|
|
41
|
+
- tools: list[Tool | Callable] | None
|
|
42
|
+
- tool_transformations: dict[str, ToolTransformConfig] | None
|
|
43
|
+
- dependencies: list[str] | None
|
|
44
|
+
- include_tags: set[str] | None
|
|
45
|
+
- exclude_tags: set[str] | None
|
|
46
|
+
- include_fastmcp_meta: bool | None
|
|
47
|
+
|
|
48
|
+
Returns:
|
|
49
|
+
Configured FastMCP server instance
|
|
50
|
+
"""
|
|
51
|
+
middleware = kwargs.pop("middleware", NotSet)
|
|
52
|
+
auth = kwargs.pop("auth", NotSet)
|
|
53
|
+
|
|
54
|
+
if middleware is NotSet:
|
|
55
|
+
middleware = [
|
|
56
|
+
LoggingMiddleware(include_payloads=True, logger=get_logger("middleware.log")),
|
|
57
|
+
AixErrorHandlingMiddleware(include_traceback=True, logger=get_logger("middleware.err")),
|
|
58
|
+
TimingMiddleware(logger=get_logger("middleware.timing")),
|
|
59
|
+
]
|
|
60
|
+
|
|
61
|
+
if auth is NotSet:
|
|
62
|
+
auth = AccessTokenAuthProvider()
|
|
63
|
+
|
|
64
|
+
mcp_args = {
|
|
65
|
+
"name": name,
|
|
66
|
+
"instructions": instructions,
|
|
67
|
+
"auth": auth,
|
|
68
|
+
"middleware": middleware,
|
|
69
|
+
**kwargs,
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return FastMCP(**mcp_args)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
aixtools/__init__.py,sha256=9NGHm7LjsQmsvjTZvw6QFJexSvAU4bCoN_KBk9SCa00,260
|
|
2
|
-
aixtools/_version.py,sha256=
|
|
2
|
+
aixtools/_version.py,sha256=4N3ayuoZZJYPEGMvrxu7tnGigRTxbAdCyp5a8y7c6aw,706
|
|
3
3
|
aixtools/app.py,sha256=JzQ0nrv_bjDQokllIlGHOV0HEb-V8N6k_nGQH-TEsVU,5227
|
|
4
4
|
aixtools/chainlit.md,sha256=yC37Ly57vjKyiIvK4oUvf4DYxZCwH7iocTlx7bLeGLU,761
|
|
5
5
|
aixtools/context.py,sha256=I_MD40ZnvRm5WPKAKqBUAdXIf8YaurkYUUHSVVy-QvU,598
|
|
@@ -59,16 +59,17 @@ aixtools/logging/log_objects.py,sha256=gohsgcfyr8vsY7G_hfmj973-Ek1_PN-bMMLEUA-4u
|
|
|
59
59
|
aixtools/logging/logging_config.py,sha256=LvxV3C75-I0096PpcCIbgM-Cp998LzWXeMM14HYbU20,4985
|
|
60
60
|
aixtools/logging/mcp_log_models.py,sha256=7-H2GJXiiyLhpImuyLLftAGG4skxJal8Swax0ob04MY,3463
|
|
61
61
|
aixtools/logging/mcp_logger.py,sha256=d2I5l4t0d6rQH17w23FpE1IUD8Ax-mSaKfByCH86q4I,6257
|
|
62
|
-
aixtools/logging/mcp_middleware.py,sha256=0kpTAwvz9Fd_mFDP3J9ldH4dPP-bhcUjLJKELGOx0IQ,2257
|
|
63
62
|
aixtools/logging/model_patch_logging.py,sha256=CW5-kKI-zNEgZhNV4vx3EQu6fbrEtX7VjA6fE5loRLQ,2916
|
|
64
63
|
aixtools/logging/open_telemetry.py,sha256=fJjF1ou_8GyfNfbyWDQPGK6JAUrUaPwURYPHhXEtDBE,1121
|
|
65
|
-
aixtools/mcp/__init__.py,sha256=
|
|
64
|
+
aixtools/mcp/__init__.py,sha256=y6Akm5xeEFJ0K0TNM6aiTsUSe5k5kft8LSTaSEaY7vE,404
|
|
66
65
|
aixtools/mcp/client.py,sha256=1flZ49irNzM6kdoKKocwFslFR3exDVWccoR0fp9SPvk,18396
|
|
67
66
|
aixtools/mcp/example_client.py,sha256=QCFGP3NCNJMOKWjUOnFwjnbJhUSb879IA1ZYmwjRnmc,889
|
|
68
67
|
aixtools/mcp/example_server.py,sha256=1SWCyrLWsAnOa81HC4QbPJo_lBVu0b3SZBWI-qDh1vQ,458
|
|
69
68
|
aixtools/mcp/exceptions.py,sha256=9m3hy9fRINbXTSgkE71XW_luklgH6xBRp7VnSRfpyzQ,173
|
|
70
69
|
aixtools/mcp/fast_mcp_log.py,sha256=XYOS406dVjn5YTHyGRsRvVNQ0SKlRObfrKj6EeLFjHg,1057
|
|
71
70
|
aixtools/mcp/faulty_mcp.py,sha256=uU9vlNGCS_i2k20wocVMaDHTlYjMQxuzjILad9O1cjA,12807
|
|
71
|
+
aixtools/mcp/middleware.py,sha256=V-bWhSL6F-tv74EtqaoYjbvxIUCIfG3XKz1khU7ebU4,2268
|
|
72
|
+
aixtools/mcp/server.py,sha256=wpN7tJmUZqGsb_rOVfXbyTFJ9VPnQl7nG5wa1JAz-No,2566
|
|
72
73
|
aixtools/model_patch/model_patch.py,sha256=JT-oHubIn2LeoSwWbzEQ5vLH7crJmFUecHyQfaAFHa0,1813
|
|
73
74
|
aixtools/server/__init__.py,sha256=rwPx020YpOzCnrxA80Lc4yLLcIp-Mpe9hNqVO9wDPv0,448
|
|
74
75
|
aixtools/server/app_mounter.py,sha256=0tJ0tC140ezAjnYdlhpLJQjY-TO8NVw7D8LseYCCVY8,3336
|
|
@@ -94,8 +95,8 @@ aixtools/utils/chainlit/cl_agent_show.py,sha256=vaRuowp4BRvhxEr5hw0zHEJ7iaSF_5bo
|
|
|
94
95
|
aixtools/utils/chainlit/cl_utils.py,sha256=fxaxdkcZg6uHdM8uztxdPowg3a2f7VR7B26VPY4t-3c,5738
|
|
95
96
|
aixtools/vault/__init__.py,sha256=fsr_NuX3GZ9WZ7dGfe0gp_5-z3URxAfwVRXw7Xyc0dU,141
|
|
96
97
|
aixtools/vault/vault.py,sha256=9dZLWdZQk9qN_Q9Djkofw9LUKnJqnrX5H0fGusVLBhA,6037
|
|
97
|
-
aixtools-0.2.
|
|
98
|
-
aixtools-0.2.
|
|
99
|
-
aixtools-0.2.
|
|
100
|
-
aixtools-0.2.
|
|
101
|
-
aixtools-0.2.
|
|
98
|
+
aixtools-0.2.20.dist-info/METADATA,sha256=Z5i3qRQdNfrFrKutnd6j0UMFab38xzXcKl7Hr2GKnos,27958
|
|
99
|
+
aixtools-0.2.20.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
100
|
+
aixtools-0.2.20.dist-info/entry_points.txt,sha256=q8412TG4T0S8K0SKeWp2vkVPIDYQs0jNoHqcQ7qxOiA,155
|
|
101
|
+
aixtools-0.2.20.dist-info/top_level.txt,sha256=wBn-rw9bCtxrR4AYEYgjilNCUVmKY0LWby9Zan2PRJM,9
|
|
102
|
+
aixtools-0.2.20.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|