๐Ÿ—„๏ธ MySQL Database MCP Configuration

Complete guide to integrate MySQL/MariaDB databases with AI4CALL: connect company databases, create custom SQL queries as MCP tools, allow assistant to read/write data in real time during calls

AI4CALL - MCP Database Connector Configuration

Go to "MARKET" โ†’ "Marketplace Plugin" and click Purchase on "Database Connector" โ†’ FREE

Go to "MARKET" โ†’ "My Plugins" and click Configure on "Database Connector"

โš ๏ธ Third-party services

The integrations described refer to third-party services.
Rate limits, authentication methods, technical configurations, costs, and policies are defined exclusively by the respective providers and may change over time.

Costs for external services are borne directly by the end user to the service providers themselves and are in no way managed or mediated by our portal (e.g., Meta or other providers for WhatsApp, Zapier, Calendly, etc.).

โš ๏ธ IMPORTANT - Database Security
The Database Connector plugin allows executing SQL queries directly on your database. For security reasons: 1) Always configure connections with DB users having limited permissions to only necessary operations 2) Test queries in development environment before using in production 3) Do not use database administrator credentials 4) Regularly monitor executed queries logs

1

What are Database MCP and how they work

Database MCP is an AI4CALL plugin that transforms your SQL queries into tools the assistant can use during real-time calls. Allows AI to access your company data without need for manual export/import.

Database MCP Features:
  • Real-time connection: Assistant accesses database during call
  • Parametric queries: Create queries accepting parameters (e.g. customer ID, date range)
  • Integrated security: Each query has its own permission context
  • Complete logging: All operations are tracked and recorded
  • Multiple support: MySQL, MariaDB, PostgreSQL, SQL Server
๐Ÿ’ก When to use Database MCP
  • Customers: Verify product availability, prices, deadlines
  • Support: Consult ticket history, active contracts
  • Sales: Check inventory, promotional prices
  • Administration: Verify invoices, payments, deadlines
  • Projects: Consult timeline, assigned resources
๐Ÿ”’ Security Considerations
  • โœ… Best Practice: Create dedicated DB user with specific permissions
  • โœ… Secure Queries: Always use prepared statements for parameters
  • โœ… Limited Access: Grant only SELECT on necessary tables
  • โŒ Avoid: DROP, DELETE, TRUNCATE permissions
  • โŒ Avoid: Queries accepting direct SQL input
2

Configure database connection

Before creating queries, you need to configure connection to your database. Ensure you have available: host, database name, username, password and port.

Connection procedure:
  1. Go to "MARKET" โ†’ "My Plugins"
  2. Click "Configure" on "Database Connector"
  3. Insert connection data:
    • DB Type: MySQL / MariaDB
    • Host: server address (e.g. localhost or IP)
    • Port: 3306 (default MySQL)
    • Database: database name
    • Username: user with permissions
    • Password: user password
  4. Click "Test Connection"
  5. If all ok, click "Save Configuration"
โœ… Connection Successful
If test shows "Connection established successfully", it means AI4CALL can communicate with your database. A list of available tables will be displayed, confirming permissions are correctly configured.
๐Ÿ” Connection Problems Troubleshooting
  • Error "Host unreachable": Verify DB server is online and accessible from AI4CALL network
  • Error "Access denied": Check username/password and user permissions
  • Error "Database not found": Verify database exists and is correctly written
  • Firewall/Port blocked: Ensure port 3306 is open on server
  • Remote connection: For remote servers, verify host allows connections from external IPs
AI4CALL database connection configuration
Connection configuration: insert host, database, user and password
Database connection test successful
Positive connection test: database tables are visible and selectable
3

Create custom SQL queries

Now you can create SQL queries the assistant will use as tools. Each query can have dynamic parameters AI will compile during call.

Query creation:
  1. In plugin configuration, go to section "SQL Queries"
  2. Click "New Query"
  3. Configure query:
    • Query Name: Descriptive name (e.g. "Search Customer by Email")
    • Description: Explain to assistant what query does
    • SQL Query: SQL code with eventual parameters {param}
    • Parameters: Define name and type of each parameter
    • Involved Tables: Select used tables
  4. Use "Preview Results" to test
  5. Click "Save Query"
๐Ÿ’ก Useful Query Examples
Example 1 - Customer search:
SELECT * FROM clienti WHERE email = {email_cliente}

Example 2 - Recent orders:
SELECT * FROM ordini WHERE cliente_id = {id_cliente} AND data > DATE_SUB(NOW(), INTERVAL 30 DAY)

Example 3 - Product availability:
SELECT nome, quantita FROM prodotti WHERE id = {id_prodotto} AND quantita > 0

Example 4 - Expiring invoices:
SELECT * FROM fatture WHERE cliente_id = {id_cliente} AND pagata = 0 AND scadenza BETWEEN NOW() AND DATE_ADD(NOW(), INTERVAL 7 DAY)
โš ๏ธ Query Security
  • Always use parameters: Never concatenate values directly in queries
  • Limit results: Always add LIMIT to queries that might return many records
  • Specify columns: Avoid SELECT * when possible, list only necessary columns
  • Test with real data: Verify query works with different parameter values
  • Consider performance: Complex queries might slow database during calls
SQL query creation with parameters
Parametric query creation: define name, description, SQL and parameters
4

Activate queries as MCP tools

After creating and testing queries, you need to activate them as MCP tools so assistant can use them during calls.

Activation procedure:
  1. In query list, find the one you want to activate
  2. Activate the switch "Activate as MCP Tool"
  3. Configure tool options:
    • Visibility: Choose in which assistants it will be available
    • Priority: Set when assistant should use this tool
    • MCP Description: How tool is presented to AI
  4. Click "Save Tool Settings"
  5. Repeat for all queries you want to make available
โœ… Tool Activated Successfully
Once activated, the tool will appear in list of available MCP tools for assistant. AI will be able to recognize when to use it based on description you provided and conversation context.
๐Ÿ’ก When Assistant Uses Tools
Assistant autonomously decides when to use MCP tool based on:

1. Conversation context: If talking about customers, orders, products, etc.
2. Specific questions: "What is status of my order?", "Do I have expiring invoices?"
3. Missing parameters: AI will ask necessary parameters (e.g. "I need customer email")
4. Tool description: How accurately you described query purpose
Query activation as MCP tool
Tool activation: enable switch and configure visibility and priority
5

Instruct the assistant on how to use tools

Last step is to instruct assistant on when and how to use database tools you configured. You can do this through system instructions and conversation examples.

๐Ÿ“ Workflows and Examples
System Instructions Example:
"If user asks information about customers, orders, products or invoices, use MCP database tools to retrieve updated information. Ask necessary parameters (e.g. email, ID, name) if not provided."

Conversation Example:
User: "I'd like to know status of my recent order"
AI: "Certainly! To retrieve your recent orders, I need your email. Can you provide it?"
User: "mario.rossi@email.com"
AI: [Uses tool "Search Orders by Email" with parameter email_cliente="mario.rossi@email.com"]
AI: "I found 2 recent orders: ..."
๐Ÿงช Complete Flow Test
To test everything works:

1. Start a test call with assistant
2. Ask information that should activate a database tool
3. Verify AI:
- Recognizes need to use tool
- Asks missing parameters if necessary
- Correctly executes query
- Presents results understandably
4. Check logs in plugin to see executed query
5. Verify data is correct and updated

โ“ Database MCP Frequently Asked Questions

Answers to the most common questions about Database Connector MCP configuration and usage

Currently plugin supports one database connection per instance. If you need to access multiple databases, you can: 1) Use a central database replicating necessary data, 2) Create views combining data from multiple databases, 3) Configure multiple AI4CALL instances with different connections.

Yes, queries are executed in real time when assistant decides to use the tool. Database response is incorporated in AI response almost instantly, typically in less than 2-3 seconds.

If database is unreachable, assistant will receive connection error and inform user it cannot retrieve data at the moment. Call will continue normally for other functionalities.

Yes, but with extreme caution. We recommend: 1) Use DB users with minimal necessary permissions, 2) Add confirmations before destructive operations, 3) Implement automatic backups, 4) Test thoroughly in development environment.

There's no fixed limit to number of queries, but for optimal performance we recommend: 1) Maximum 20-30 active queries simultaneously, 2) Group similar queries in one parametric, 3) Deactivate queries not frequently used.

Yes, plugin supports any MySQL/MariaDB compatible database, including cloud services. Typical configuration: 1) Use endpoint provided by cloud as host, 2) Configure security group to allow AI4CALL IP, 3) Use SSL if required.

If you modify tables/columns: 1) Update queries using those tables, 2) Test all modified queries, 3) Communicate changes to users if affecting results, 4) Consider backward compatibility (e.g. new optional columns).

Yes, using SQL conditions: WHERE (email = {email} OR {email} IS NULL). The assistant will still try to provide all defined parameters. For truly optional parameters, create separate queries with and without that parameter.


Some of the ai4call users