MCP Integration
Connect AI assistants like Claude directly to your DYPAI backend using the Model Context Protocol.
What is MCP?
The Model Context Protocol (MCP) is an open standard that allows LLMs to interact with external tools and data sources. With DYPAI's MCP integration, AI assistants can:
- Query and modify your database
- Execute Edge Functions
- Manage files in storage
- Interact with your APIs
- Perform complex multi-step operations
MCP is supported by Claude, GPT-4, and other compatible models.
Setting Up MCP
Get API Credentials
Go to your project settings and copy your Project ID and API Key.
Configure Claude Desktop
Add the DYPAI MCP server to your Claude Desktop configuration.
Test Connection
Restart Claude Desktop and verify the connection works.
Claude Desktop Configuration
Edit your claude_desktop_config.json file:
{
"mcpServers": {
"dypai": {
"command": "npx",
"args": ["-y", "@dypai/mcp-server"],
"env": {
"DYPAI_PROJECT_URL": "https://your-project.dypai.io",
"DYPAI_API_KEY": "your-service-role-key"
}
}
}
}Configuration File Locations
| OS | Path |
|---|---|
| macOS | ~/Library/Projectlication Support/Claude/claude_desktop_config.json |
| Windows | %APPDATA%\Claude\claude_desktop_config.json |
| Linux | ~/.config/Claude/claude_desktop_config.json |
Use your service role key for MCP, as it needs full access to perform operations.
Available Tools
Once connected, the LLM has access to these tools:
Database Tools
| Tool | Description |
|---|---|
database_query | Execute SELECT queries |
database_insert | Insert new records |
database_update | Update existing records |
database_delete | Delete records |
database_schema | Get table schemas |
Storage Tools
| Tool | Description |
|---|---|
storage_list | List files in a bucket |
storage_upload | Upload files |
storage_download | Download files |
storage_delete | Delete files |
API Tools
| Tool | Description |
|---|---|
api_call | Call custom API endpoints |
edge_function | Execute Edge Functions |
Example Prompts
Here are examples of what you can ask Claude to do:
// Database queries
"Show me all users who signed up this week"
"Create a new product with name 'Widget' and price 29.99"
"Update the status of order #123 to 'shipped'"
// Storage operations
"List all files in the 'documents' bucket"
"What's the total size of files uploaded today?"
// Complex operations
"Generate a report of sales by category for last month"
"Find users who haven't logged in for 30 days and send them an email"
"Analyze the posts table and suggest indexes for better performance"Environment Variables
| Variable | Description | Required |
|---|---|---|
DYPAI_PROJECT_URL | Your project API URL | Yes |
DYPAI_API_KEY | Service role API key | Yes |
DYPAI_SCHEMA | Database schema (default: public) | No |
Security Considerations
- Use service role key only in trusted environments
- MCP operations bypass Row Level Security
- All operations are logged for audit
- Consider using read-only keys for analysis tasks
Never share your MCP configuration file or expose API keys publicly.
Troubleshooting
Connection Issues
- Verify the JSON syntax in your config file
- Check that the API key is valid
- Ensure Node.js is installed (for npx)
- Restart Claude Desktop after config changes
Permission Errors
- Verify you're using the service role key
- Check that the key has required permissions
- Ensure the key hasn't been revoked