d365fo-client 0.2.4__py3-none-any.whl → 0.3.1__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.
- d365fo_client/__init__.py +7 -1
- d365fo_client/auth.py +9 -21
- d365fo_client/cli.py +25 -13
- d365fo_client/client.py +8 -4
- d365fo_client/config.py +52 -30
- d365fo_client/credential_sources.py +5 -0
- d365fo_client/main.py +1 -1
- d365fo_client/mcp/__init__.py +3 -1
- d365fo_client/mcp/auth_server/__init__.py +5 -0
- d365fo_client/mcp/auth_server/auth/__init__.py +30 -0
- d365fo_client/mcp/auth_server/auth/auth.py +372 -0
- d365fo_client/mcp/auth_server/auth/oauth_proxy.py +989 -0
- d365fo_client/mcp/auth_server/auth/providers/__init__.py +0 -0
- d365fo_client/mcp/auth_server/auth/providers/apikey.py +83 -0
- d365fo_client/mcp/auth_server/auth/providers/azure.py +393 -0
- d365fo_client/mcp/auth_server/auth/providers/bearer.py +25 -0
- d365fo_client/mcp/auth_server/auth/providers/jwt.py +547 -0
- d365fo_client/mcp/auth_server/auth/redirect_validation.py +65 -0
- d365fo_client/mcp/auth_server/dependencies.py +136 -0
- d365fo_client/mcp/client_manager.py +16 -67
- d365fo_client/mcp/fastmcp_main.py +407 -0
- d365fo_client/mcp/fastmcp_server.py +598 -0
- d365fo_client/mcp/fastmcp_utils.py +431 -0
- d365fo_client/mcp/main.py +40 -13
- d365fo_client/mcp/mixins/__init__.py +24 -0
- d365fo_client/mcp/mixins/base_tools_mixin.py +55 -0
- d365fo_client/mcp/mixins/connection_tools_mixin.py +50 -0
- d365fo_client/mcp/mixins/crud_tools_mixin.py +311 -0
- d365fo_client/mcp/mixins/database_tools_mixin.py +685 -0
- d365fo_client/mcp/mixins/label_tools_mixin.py +87 -0
- d365fo_client/mcp/mixins/metadata_tools_mixin.py +565 -0
- d365fo_client/mcp/mixins/performance_tools_mixin.py +109 -0
- d365fo_client/mcp/mixins/profile_tools_mixin.py +713 -0
- d365fo_client/mcp/mixins/sync_tools_mixin.py +321 -0
- d365fo_client/mcp/prompts/action_execution.py +1 -1
- d365fo_client/mcp/prompts/sequence_analysis.py +1 -1
- d365fo_client/mcp/tools/crud_tools.py +3 -3
- d365fo_client/mcp/tools/sync_tools.py +1 -1
- d365fo_client/mcp/utilities/__init__.py +1 -0
- d365fo_client/mcp/utilities/auth.py +34 -0
- d365fo_client/mcp/utilities/logging.py +58 -0
- d365fo_client/mcp/utilities/types.py +426 -0
- d365fo_client/metadata_v2/sync_manager_v2.py +2 -0
- d365fo_client/metadata_v2/sync_session_manager.py +7 -7
- d365fo_client/models.py +139 -139
- d365fo_client/output.py +2 -2
- d365fo_client/profile_manager.py +62 -27
- d365fo_client/profiles.py +118 -113
- d365fo_client/settings.py +367 -0
- d365fo_client/sync_models.py +85 -2
- d365fo_client/utils.py +2 -1
- {d365fo_client-0.2.4.dist-info → d365fo_client-0.3.1.dist-info}/METADATA +273 -18
- d365fo_client-0.3.1.dist-info/RECORD +85 -0
- d365fo_client-0.3.1.dist-info/entry_points.txt +4 -0
- d365fo_client-0.2.4.dist-info/RECORD +0 -56
- d365fo_client-0.2.4.dist-info/entry_points.txt +0 -3
- {d365fo_client-0.2.4.dist-info → d365fo_client-0.3.1.dist-info}/WHEEL +0 -0
- {d365fo_client-0.2.4.dist-info → d365fo_client-0.3.1.dist-info}/licenses/LICENSE +0 -0
- {d365fo_client-0.2.4.dist-info → d365fo_client-0.3.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,109 @@
|
|
1
|
+
"""Performance tools mixin for FastMCP server."""
|
2
|
+
|
3
|
+
import json
|
4
|
+
import logging
|
5
|
+
from datetime import datetime
|
6
|
+
|
7
|
+
from .base_tools_mixin import BaseToolsMixin
|
8
|
+
|
9
|
+
logger = logging.getLogger(__name__)
|
10
|
+
|
11
|
+
|
12
|
+
class PerformanceToolsMixin(BaseToolsMixin):
|
13
|
+
"""Performance monitoring and configuration tools for FastMCP server."""
|
14
|
+
|
15
|
+
def register_performance_tools(self):
|
16
|
+
"""Register all performance tools with FastMCP."""
|
17
|
+
|
18
|
+
@self.mcp.tool()
|
19
|
+
async def d365fo_get_server_performance() -> dict:
|
20
|
+
"""Get FastMCP server performance statistics and health metrics.
|
21
|
+
|
22
|
+
Returns:
|
23
|
+
Dict with server performance data
|
24
|
+
"""
|
25
|
+
try:
|
26
|
+
performance_stats = self.get_performance_stats()
|
27
|
+
|
28
|
+
# Add client manager health stats
|
29
|
+
client_health = await self.client_manager.health_check()
|
30
|
+
|
31
|
+
return {
|
32
|
+
"server_performance": performance_stats,
|
33
|
+
"client_health": client_health,
|
34
|
+
"timestamp": datetime.now().isoformat(),
|
35
|
+
}
|
36
|
+
|
37
|
+
except Exception as e:
|
38
|
+
logger.error(f"Get server performance failed: {e}")
|
39
|
+
return {"error": str(e)}
|
40
|
+
|
41
|
+
@self.mcp.tool()
|
42
|
+
async def d365fo_reset_performance_stats() -> dict:
|
43
|
+
"""Reset server performance statistics.
|
44
|
+
|
45
|
+
Returns:
|
46
|
+
Dict with reset confirmation
|
47
|
+
"""
|
48
|
+
try:
|
49
|
+
# Reset performance stats
|
50
|
+
self._request_stats = {
|
51
|
+
"total_requests": 0,
|
52
|
+
"total_errors": 0,
|
53
|
+
"avg_response_time": 0.0,
|
54
|
+
"last_reset": datetime.now(),
|
55
|
+
}
|
56
|
+
self._request_times = []
|
57
|
+
self._connection_pool_stats = {
|
58
|
+
"active_connections": 0,
|
59
|
+
"peak_connections": 0,
|
60
|
+
"connection_errors": 0,
|
61
|
+
"pool_hits": 0,
|
62
|
+
"pool_misses": 0,
|
63
|
+
}
|
64
|
+
|
65
|
+
# Clean up expired sessions
|
66
|
+
self._cleanup_expired_sessions()
|
67
|
+
|
68
|
+
return {
|
69
|
+
"performance_stats_reset": True,
|
70
|
+
"reset_timestamp": datetime.now().isoformat(),
|
71
|
+
}
|
72
|
+
|
73
|
+
except Exception as e:
|
74
|
+
logger.error(f"Reset performance stats failed: {e}")
|
75
|
+
return {"error": str(e), "reset_successful": False}
|
76
|
+
|
77
|
+
@self.mcp.tool()
|
78
|
+
async def d365fo_get_server_config() -> dict:
|
79
|
+
"""Get current FastMCP server configuration and feature status.
|
80
|
+
|
81
|
+
Returns:
|
82
|
+
Dict with server configuration
|
83
|
+
"""
|
84
|
+
try:
|
85
|
+
from ... import __version__
|
86
|
+
|
87
|
+
config_info = {
|
88
|
+
"server_version": __version__,
|
89
|
+
"stateless_mode": self._stateless_mode,
|
90
|
+
"json_response_mode": self._json_response_mode,
|
91
|
+
"max_concurrent_requests": self._max_concurrent_requests,
|
92
|
+
"request_timeout": self._request_timeout,
|
93
|
+
"batch_size": self._batch_size,
|
94
|
+
"transport_config": self.config.get("server", {}).get(
|
95
|
+
"transport", {}
|
96
|
+
),
|
97
|
+
"performance_config": self.config.get("performance", {}),
|
98
|
+
"cache_config": self.config.get("cache", {}),
|
99
|
+
"security_config": self.config.get("security", {}),
|
100
|
+
}
|
101
|
+
|
102
|
+
return {
|
103
|
+
"server_config": config_info,
|
104
|
+
"timestamp": datetime.now().isoformat(),
|
105
|
+
}
|
106
|
+
|
107
|
+
except Exception as e:
|
108
|
+
logger.error(f"Get server config failed: {e}")
|
109
|
+
return {"error": str(e)}
|