@buena/sdk package.
Installation & Setup
Core API Methods
All API methods are accessed throughbuena.default.* and return promises.
Lead Management
listLeads(options?)
List all leads with optional filtering and pagination.
Parameters:
401- Invalid API key403- Insufficient permissions429- Rate limit exceeded500- Server error
createLead(leadData)
Create a new lead in your database.
Parameters:
400- Invalid lead data (missing required fields, invalid email format)401- Invalid API key409- Lead with email already exists422- Validation error (invalid phone format, invalid LinkedIn URL)429- Rate limit exceeded500- Server error
getLead(leadId)
Retrieve a specific lead by ID.
Parameters:
401- Invalid API key404- Lead not found500- Server error
updateLead(leadId, updateData)
Update an existing lead’s information.
Parameters:
400- Invalid update data401- Invalid API key404- Lead not found409- Email already exists (if updating email)422- Validation error500- Server error
deleteLead(leadId)
Permanently delete a lead from your database.
Parameters:
401- Invalid API key404- Lead not found500- Server error
API Key Management
listApiKeys()
List all API keys for your account.
Parameters: None
Returns:
401- Invalid API key403- Insufficient permissions500- Server error
createApiKey(keyData)
Create a new API key for your account.
Parameters:
400- Invalid key data (missing name, invalid permissions)401- Invalid API key403- Insufficient permissions422- Validation error500- Server error
System Health
healthCheck()
Check the API system status and your connection.
Parameters: None
Returns:
500- Server error503- Service unavailable
Error Handling
All methods can throwSDKError exceptions:
Rate Limiting
The API enforces rate limits:- 100 requests per minute for most endpoints
- 20 requests per minute for resource creation (createLead, createApiKey)
X-RateLimit-Limit- Total requests allowedX-RateLimit-Remaining- Requests remainingX-RateLimit-Reset- Unix timestamp when limit resets
TypeScript Support
The SDK includes full TypeScript definitions:MCP Integration
The TypeScript SDK includes a built-in MCP (Model Context Protocol) server that enables AI assistants to directly interact with your Buena.ai data.Starting the MCP Server
AI Assistant Configuration
Claude Desktop Configuration:Available MCP Tools
The MCP server exposes these tools to AI assistants:Lead Management Tools
buena_list_leads- Search and filter leadsbuena_create_lead- Create new leadsbuena_get_lead- Retrieve lead detailsbuena_update_lead- Update lead informationbuena_delete_lead- Delete leads
API Management Tools
buena_list_api_keys- List API keysbuena_create_api_key- Create new API keysbuena_health_check- Check system status
MCP Usage Examples
Lead Search via AI Assistant:MCP Server Configuration
Environment Variables:buena-mcp.config.json):
Testing MCP Integration
Manual Server Test:Advanced MCP Features
Custom Tool Extensions:MCP Troubleshooting
Common Issues and Solutions:-
Server Won’t Start
-
AI Assistant Connection Issues
-
Tool Call Failures

