Templafy Server
БесплатноНе проверенA production-ready MCP server for Templafy Data Sources API, enabling Claude to manage data sources, fields, items, and item fields via natural language.
Описание
A production-ready MCP server for Templafy Data Sources API, enabling Claude to manage data sources, fields, items, and item fields via natural language.
README
A production-ready MCP (Model Context Protocol) server for Templafy Data Sources API. This server provides a middle layer between Claude and the Templafy Public API, focusing exclusively on Data Sources functionality.
Features
- Complete Data Sources API Coverage: All CRUD operations for data sources, fields, items, and item fields
- Type Safety: Full TypeScript support with Zod validation
- Robust Error Handling: Proper HTTP error mapping with special handling for 423 Locked responses
- Retry Logic: Exponential backoff for server errors with configurable retry attempts
- Security: API key redaction in logs, input validation, and rate limiting
- Observability: Structured logging with request tracking and performance metrics
- Production Ready: Comprehensive error handling, graceful shutdown, and proper resource management
Prerequisites
- Node.js 20 or higher
- Templafy API access with Admin permissions
- Valid API key from Templafy Admin
Installation
- Clone or download this repository
- Install dependencies:
npm install
- Copy the environment configuration:
cp env.example .env
- Configure your environment variables in
.env:
# Required
TENANT_ID=your-tenant-id
TEMPLAFY_API_KEY=your-api-key
# Optional (defaults shown)
TEMPLAFY_API_VERSION=v2
AUTH_HEADER_NAME=Authorization
AUTH_SCHEME=ApiKey
REQUEST_TIMEOUT_MS=30000
DEBUG_HTTP=false
Environment Variables
| Variable | Required | Default | Description |
|---|---|---|---|
TENANT_ID |
Yes | - | Your Templafy tenant ID |
TEMPLAFY_API_KEY |
Yes | - | API key from Templafy Admin |
TEMPLAFY_API_VERSION |
No | v2 |
API version to use |
AUTH_HEADER_NAME |
No | Authorization |
HTTP header name for authentication |
AUTH_SCHEME |
No | ApiKey |
Authentication scheme |
REQUEST_TIMEOUT_MS |
No | 30000 |
Request timeout in milliseconds |
DEBUG_HTTP |
No | false |
Enable HTTP request/response logging |
Usage
Development
Start the server in development mode with hot reload:
npm run dev
Production
Build and run the production server:
npm run build
node dist/server.js
Registering with Claude Desktop
Add the following configuration to your Claude Desktop MCP settings:
{
"mcpServers": {
"templafy": {
"command": "node",
"args": ["/path/to/templafy-mcp-server/dist/server.js"],
"env": {
"TENANT_ID": "your-tenant-id",
"TEMPLAFY_API_KEY": "your-api-key"
}
}
}
}
Available Tools
Data Sources
listDataSources
List data sources with optional search and pagination.
Parameters:
searchQuery(optional): Search query to filter data sourcespage(optional): Page number (default: 1)pageSize(optional): Items per page (default: 50, max: 200)
Example:
{
"searchQuery": "customer data",
"page": 1,
"pageSize": 25
}
getDataSource
Get a specific data source by ID.
Parameters:
id(required): Data source ID
createDataSource
Create a new data source.
Parameters:
name(required): Data source namedescription(optional): Data source descriptionfields(optional): Array of field definitions
Example:
{
"name": "Customer Database",
"description": "Customer information and contact details",
"fields": [
{
"name": "Customer Name",
"type": "text",
"required": true,
"description": "Full customer name"
},
{
"name": "Email",
"type": "text",
"required": true,
"description": "Customer email address"
}
]
}
updateDataSource
Update an existing data source.
Parameters:
id(required): Data source IDname(optional): Updated namedescription(optional): Updated descriptionfields(optional): Updated field definitions
deleteDataSource
Delete a data source.
Parameters:
id(required): Data source ID
Fields
getField
Get a specific field from a data source.
Parameters:
dataSourceId(required): Data source IDfieldId(required): Field ID
createField
Create a new field in a data source.
Parameters:
dataSourceId(required): Data source IDfield(required): Field definition
Example:
{
"dataSourceId": "ds-123",
"field": {
"name": "Phone Number",
"type": "text",
"required": false,
"description": "Customer phone number"
}
}
updateField
Update an existing field.
Parameters:
dataSourceId(required): Data source IDfieldId(required): Field IDfield(required): Updated field definition
deleteField
Delete a field from a data source.
Parameters:
dataSourceId(required): Data source IDfieldId(required): Field ID
Items
listItems
List items in a data source with pagination.
Parameters:
dataSourceId(required): Data source IDpage(optional): Page number (default: 1)pageSize(optional): Items per page (default: 50, max: 200)
getItem
Get a specific item from a data source.
Parameters:
dataSourceId(required): Data source IDitemId(required): Item ID
createItem
Create a new item in a data source.
Parameters:
dataSourceId(required): Data source IDfields(optional): Item field values
Example:
{
"dataSourceId": "ds-123",
"fields": {
"customer-name": "John Doe",
"email": "[email protected]",
"phone": "+1-555-0123"
}
}
updateItem
Update an existing item.
Parameters:
dataSourceId(required): Data source IDitemId(required): Item IDfields(optional): Updated field values
deleteItem
Delete an item from a data source.
Parameters:
dataSourceId(required): Data source IDitemId(required): Item ID
Item Fields
putItemField
Set or update a specific field value for an item.
Parameters:
dataSourceId(required): Data source IDitemId(required): Item IDfieldId(required): Field IDvalue(required): Field value (type depends on field type)
Example:
{
"dataSourceId": "ds-123",
"itemId": "item-456",
"fieldId": "field-789",
"value": "Updated value"
}
deleteItemField
Delete a specific field value from an item.
Parameters:
dataSourceId(required): Data source IDitemId(required): Item IDfieldId(required): Field ID
Field Types
The following field types are supported:
text: Text stringsnumber: Numeric valuesimage: Image referencesreference: References to other datacolor: Color valuestheme: Theme referencesfont: Font specifications
Error Handling
The server provides comprehensive error handling:
- Validation Errors: Input validation with clear error messages
- HTTP Errors: Proper mapping of HTTP status codes to MCP errors
- 423 Locked: Special handling for locked resources with lock reason and dependent resources
- Retry Logic: Automatic retry with exponential backoff for server errors
- Rate Limiting: Built-in protection against excessive API calls
Example Error Response
{
"ok": false,
"error": {
"status": 423,
"code": "LOCKED",
"message": "Data source is locked",
"lockReason": {
"reason": "Data source is being used by active templates",
"dependentResources": ["template-1", "template-2"]
}
}
}
Development
Scripts
npm run dev: Start development server with hot reloadnpm run build: Build production bundlenpm run lint: Run ESLintnpm run typecheck: Run TypeScript type checkingnpm run test: Run test suitenpm run test:watch: Run tests in watch mode
Testing
The project includes a comprehensive test suite using Vitest and MSW (Mock Service Worker):
# Run all tests
npm test
# Run tests in watch mode
npm run test:watch
# Run specific test file
npm test dataSources.test.ts
Code Structure
src/
├── server.ts # MCP server entry point
├── templafyClient.ts # HTTP client with retry logic
├── types.ts # TypeScript types and Zod schemas
├── tools/ # MCP tool implementations
│ ├── dataSources.ts # Data source tools
│ ├── fields.ts # Field tools
│ ├── items.ts # Item tools
│ └── itemFields.ts # Item field tools
└── util/ # Utility modules
├── env.ts # Environment configuration
├── logger.ts # Logging utilities
└── errors.ts # Error handling
Security
- API keys are automatically redacted from logs
- Input validation prevents injection attacks
- Rate limiting protects against abuse
- No sensitive data is logged in production
Monitoring
The server provides structured logging with:
- Request/response tracking with unique IDs
- Performance metrics (duration, status codes)
- Error tracking with context
- Optional HTTP debugging mode
Troubleshooting
Common Issues
- Authentication Errors: Verify your
TENANT_IDandTEMPLAFY_API_KEYare correct - Timeout Errors: Increase
REQUEST_TIMEOUT_MSfor slow networks - Rate Limiting: The server includes built-in rate limiting; reduce concurrent requests if needed
- 423 Locked Errors: Check the
lockReasonfor dependent resources that need to be unlocked first
Debug Mode
Enable debug logging to troubleshoot issues:
DEBUG_HTTP=true npm run dev
This will log all HTTP requests and responses (with sensitive data redacted).
License
This project is licensed under the MIT License.
Установка Templafy Server
У этого сервера нет опубликованного пакета — он собирается из исходников. Открой репозиторий и следуй инструкции в README.
▸ github.com/slaarhuis/MCP-Templafy-datasourcesFAQ
Templafy Server MCP бесплатный?
Да, Templafy Server MCP бесплатный — установка в пару кликов через Unyly без оплаты.
Нужен ли API-ключ для Templafy Server?
Нет, Templafy Server работает без API-ключей и переменных окружения.
Templafy Server — hosted или self-hosted?
Доступен hosted-вариант: Unyly запускает сервер в облаке, локальная установка не обязательна.
Как установить Templafy Server в Claude Desktop, Claude Code или Cursor?
Открой Templafy Server на unyly.org, выбери вкладку своего клиента (Claude Desktop, Claude Code, Cursor) и нажми Install — конфиг сгенерируется автоматически, без правки JSON.
Похожие MCP
Fetch
Web content fetching and conversion for efficient LLM usage.
AWS KB Retrieval
Retrieval from AWS Knowledge Base using Bedrock Agent Runtime.
автор: modelcontextprotocolSpring AI MCP Server
Provides auto-configuration for setting up an MCP server in Spring Boot applications.
llm-analysis-assistant
A very streamlined mcp client that supports calling and monitoring stdio/sse/streamableHttp, and can also view request responses through the /logs page. It also
автор: xuzexin-hzCompare Templafy Server with
Не уверен что выбрать?
Найди свой стек за 60 секунд
Автор?
Embed-бейдж для README
Похожее
Все в категории ai
