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
Define All Schemas
Include complete request and response schemas: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: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:Implement Caching
Cache frequently accessed data:- Server-side caching: Use Redis or similar for API responses
- HTTP caching headers: Set appropriate
Cache-Controlheaders - Tydli caching: Tydli can cache responses based on your headers
Batch Operations
Combine multiple requests when possible: Instead of:Optimize Query Parameters
Only request fields you need:Monitor Response Times
Track and optimize slow endpoints:- Set up performance monitoring
- Log slow queries (
>1second) - 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:MCP-Specific Best Practices
Test with MCP Inspector
Before deploying, test your MCP server:- All tools are discovered correctly
- Parameters are properly validated
- Responses are formatted correctly
Provide Helpful Tool Descriptions
MCP tools use your OpenAPIoperationId and description. Make them clear:
Bad:
Handle Errors Gracefully
Return clear error messages:Keep Deployments Updated
When you update your API:- Update your OpenAPI spec
- Test changes in staging Tydli deployment
- Update production Tydli deployment
- AI agents automatically see new capabilities
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 (
>2seconds) - 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
- Check Rate Limits for quota information
- See MCP Compliance for protocol details
- Review Authentication Methods for API security
- Join our Discord for community best practices