2026-03-24 13:51:14 +11:00

71 lines
1.6 KiB
Markdown

# tf-sync
ToothFairyAI workspace sync layer for tfcode.
## Purpose
This Python module syncs tools from a ToothFairyAI workspace to tfcode:
- **MCP Servers** - Tools with `isMCPServer=true`
- **Agent Skills** - Tools with `isAgentSkill=true`
- **Database Scripts** - Tools with `isDatabaseScript=true`
- **API Functions** - Tools with `requestType` set
## Installation
```bash
pip install tf-sync
```
## Usage
```python
from tf_sync import (
load_config,
validate_credentials,
sync_tools,
sync_mcp_servers,
ToolType,
)
# Load configuration from environment (TF_WORKSPACE_ID, TF_API_KEY, TF_REGION)
config = load_config()
# Validate credentials
result = validate_credentials(config)
if result.success:
print(f"Connected to workspace: {result.workspace_name}")
# Sync all tools (API Functions)
result = sync_tools(config)
for tool in result.tools:
print(f"- {tool.name} ({tool.tool_type.value})")
```
## Configuration
Set these environment variables:
- `TF_WORKSPACE_ID` - Your ToothFairyAI workspace UUID
- `TF_API_KEY` - Your ToothFairyAI API key
- `TF_REGION` - Region: `dev`, `au` (default), `eu`, or `us`
## Region URLs
| Region | Base URL | Use Case |
|--------|----------|----------|
| `dev` | api.toothfairylab.link | Development/Testing |
| `au` | api.toothfairyai.com | Australia (Default) |
| `eu` | api.eu.toothfairyai.com | Europe |
| `us` | api.us.toothfairyai.com | United States |
## Dependencies
- `toothfairyai` - Official ToothFairyAI Python SDK
- `pydantic` - Data validation
- `httpx` - HTTP client
- `rich` - Console output
## License
MIT