mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-15 21:24:48 +00:00
feat: sync
This commit is contained in:
@@ -1,12 +1,17 @@
|
||||
"""
|
||||
MCP server sync module for tfcode.
|
||||
Uses the official ToothFairyAI Python SDK.
|
||||
|
||||
NOTE: MCP servers are not currently exposed via the ToothFairyAI SDK.
|
||||
This module is reserved for future implementation when MCP server
|
||||
discovery is added to the SDK.
|
||||
|
||||
For now, MCP servers should be configured manually via tfcode.json.
|
||||
"""
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from tf_sync.config import TFConfig
|
||||
from tf_sync.tools import SyncedTool, sync_tools, ToolType
|
||||
from tf_sync.tools import SyncedTool, ToolType
|
||||
|
||||
|
||||
class MCPServerSyncResult(BaseModel):
|
||||
@@ -21,34 +26,16 @@ def sync_mcp_servers(config: TFConfig) -> MCPServerSyncResult:
|
||||
"""
|
||||
Sync MCP servers from ToothFairyAI workspace.
|
||||
|
||||
MCP servers are tools with isMCPServer=true.
|
||||
Credentials stay in TF and are accessed via tf_proxy.
|
||||
NOTE: Currently not supported. MCP servers are not exposed via the SDK.
|
||||
Configure MCP servers manually in tfcode.json instead.
|
||||
|
||||
Args:
|
||||
config: TFConfig instance
|
||||
|
||||
Returns:
|
||||
MCPServerSyncResult with synced MCP servers
|
||||
MCPServerSyncResult with error message
|
||||
"""
|
||||
result = sync_tools_by_type(config, [ToolType.MCP_SERVER])
|
||||
|
||||
if not result.success:
|
||||
return MCPServerSyncResult(
|
||||
success=False,
|
||||
error=result.error,
|
||||
)
|
||||
|
||||
# Get MCP servers from tools with isMCPServer
|
||||
mcp_servers = [
|
||||
t for t in result.tools
|
||||
if t.is_mcp_server
|
||||
]
|
||||
|
||||
return MCPServerSyncResult(
|
||||
success=True,
|
||||
servers=mcp_servers,
|
||||
)
|
||||
|
||||
|
||||
# Import from tools module
|
||||
from tf_sync.tools import sync_tools_by_type
|
||||
success=False,
|
||||
error="MCP server sync not available via SDK. Configure MCP servers in tfcode.json.",
|
||||
)
|
||||
Reference in New Issue
Block a user