Skip to main content

Best Practices

Production-ready guidelines for deploying and managing your Tydli MCP servers.

OpenAPI Spec Guidelines

The quality of your OpenAPI specification directly impacts how well AI agents understand and use your API.

Use Clear Operation IDs

Bad: operation1, op2, endpoint_3 Good: getUserById, createOrder, listProducts AI agents use operation IDs to understand what each endpoint does. Make them descriptive and follow a consistent naming convention.

Add Detailed Descriptions

AI agents use these descriptions to determine when to call your API. The more context you provide, the better.

Define All Schemas

Include complete request and response schemas:
This helps AI agents validate requests before sending them.

Document Parameters

Explain what each parameter means and provide examples:

Include Examples

Provide example requests and responses:

Version Your API

Use versioning in your spec to manage changes:

Security Recommendations

Protect your APIs and MCP servers from unauthorized access and abuse.

Use Environment-Specific Credentials

Never use production credentials in development. Create separate API keys for:
  • Development: Limited permissions, test data only
  • Staging: Mirror production setup with dummy data
  • Production: Full permissions, real data, strict monitoring

Implement Rate Limiting

Protect your underlying APIs from abuse:
Tydli respects rate limit headers from your API and can enforce additional limits.

Monitor Access Logs

Review who’s accessing your MCP servers regularly:
  • Check Tydli deployment logs for unusual patterns
  • Set up alerts for failed authentication attempts
  • Monitor for excessive API calls from single sources

Rotate Credentials Regularly

Update API keys on a schedule:
  • Production: Every 90 days
  • Development: Every 180 days
  • After employee departure: Immediately
  • After suspected compromise: Immediately

Use Scoped Permissions

Give AI agents minimum required access: Bad: Full admin API key with all permissions Good: Scoped key with only:
  • Read access to users
  • Write access to tickets
  • No access to billing or admin functions

Enable Audit Logging

Track all API calls for compliance and debugging:
  • Log request timestamps
  • Record which tool/resource was accessed
  • Track success/failure rates
  • Monitor for data access patterns

Performance Optimization

Ensure your MCP servers respond quickly and efficiently.

Use Pagination

Limit large result sets to improve response times:
AI agents can automatically handle paginated responses when properly documented.

Implement Caching

Cache frequently accessed data:
  • Server-side caching: Use Redis or similar for API responses
  • HTTP caching headers: Set appropriate Cache-Control headers
  • Tydli caching: Tydli can cache responses based on your headers
Example:

Batch Operations

Combine multiple requests when possible: Instead of:
Use:
Document batch endpoints in your OpenAPI spec for AI agents to use.

Optimize Query Parameters

Only request fields you need:
This reduces response sizes and improves performance.

Monitor Response Times

Track and optimize slow endpoints:
  • Set up performance monitoring
  • Log slow queries (>1 second)
  • Optimize database queries
  • Add indexes where needed
  • Consider read replicas for heavy read operations

Use Webhooks

Avoid polling when events can push updates: Instead of polling every minute:
Use webhooks:
Document webhook configuration in your OpenAPI spec.

MCP-Specific Best Practices

Test with MCP Inspector

Before deploying, test your MCP server:
This helps you verify:
  • All tools are discovered correctly
  • Parameters are properly validated
  • Responses are formatted correctly

Provide Helpful Tool Descriptions

MCP tools use your OpenAPI operationId and description. Make them clear: Bad:
Good:

Handle Errors Gracefully

Return clear error messages:
AI agents can use these to provide better feedback to users.

Keep Deployments Updated

When you update your API:
  1. Update your OpenAPI spec
  2. Test changes in staging Tydli deployment
  3. Update production Tydli deployment
  4. AI agents automatically see new capabilities
No need to update Claude Desktop config - MCP handles discovery automatically.

Monitoring & Maintenance

Health Checks

Regularly verify your MCP server:
  • Check Tydli dashboard for deployment status
  • Monitor error rates in logs
  • Test critical endpoints manually
  • Set up uptime monitoring

Performance Metrics

Track these key metrics:
  • Response time: Median and p95 latency
  • Error rate: Percentage of failed requests
  • Request volume: Requests per minute/hour/day
  • Cache hit rate: If using caching

Alerting

Set up alerts for:
  • Deployment failures
  • High error rates (>5%)
  • Slow responses (>2 seconds)
  • Authentication failures
  • Rate limit exceeded

Regular Reviews

Monthly checklist:
  • Review access logs for unusual patterns
  • Check error logs and fix common issues
  • Update OpenAPI spec documentation
  • Rotate API credentials
  • Review and optimize slow endpoints
  • Update AI agent prompts if needed
  • Test critical user journeys

Next Steps