mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-16 05:34:44 +00:00
feat: initialize tfcode project structure
- Add README.md as living documentation - Add tfcode.json schema and config template - Add FORK_MANAGEMENT.md with mirror-based fork strategy - Add scripts/rebrand.sh for reapplying branding after upstream merges - Add packages/tf-sync Python module using official ToothFairyAI SDK - Add packages/tf-mcp-bridge TypeScript module (stub) - Multi-region support (AU, EU, US) - Tool sync: MCP servers, Agent Skills, Database Scripts, API Functions
This commit is contained in:
54
packages/tf-sync/src/tf_sync/mcp.py
Normal file
54
packages/tf-sync/src/tf_sync/mcp.py
Normal file
@@ -0,0 +1,54 @@
|
||||
"""
|
||||
MCP server sync module for tfcode.
|
||||
Uses the official ToothFairyAI Python SDK.
|
||||
"""
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from tf_sync.config import TFConfig
|
||||
from tf_sync.tools import SyncedTool, sync_tools, ToolType
|
||||
|
||||
|
||||
class MCPServerSyncResult(BaseModel):
|
||||
"""Result of MCP server sync operation."""
|
||||
|
||||
success: bool
|
||||
servers: list[SyncedTool] = []
|
||||
error: str | None = None
|
||||
|
||||
|
||||
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.
|
||||
|
||||
Args:
|
||||
config: TFConfig instance
|
||||
|
||||
Returns:
|
||||
MCPServerSyncResult with synced MCP servers
|
||||
"""
|
||||
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
|
||||
Reference in New Issue
Block a user