fix: Remove unused legacy mcp-mysql_* variables

These variables were deprecated in favor of profile-based routing but
were never removed from the code. They existed in the struct definition,
getters, and setters but were not consumed anywhere - Query_Tool_Handler
uses target_auth_map via mcp_auth_profiles and mcp_target_profiles.

Removed:
- mcp-mysql_hosts, mcp-mysql_ports, mcp-mysql_user, mcp-mysql_password,
  mcp-mysql_schema from MCP_Thread.h struct
- Variable names from mcp_thread_variables_names array
- Initialization, cleanup, getters, and setters in MCP_Thread.cpp
- Documentation in doc/MCP/VARIABLES.md
release-notes-3.0.6-4.0.6-draft
Rene Cannao 2 months ago
parent 723c2daaba
commit 70647fb426

@ -151,62 +151,6 @@ Backend credentials are defined in MCP tables, not in client requests:
The in-memory target/auth map is loaded by `MCP_Threads_Handler` from runtime tables and used by the query executor connection pools.
#### `mcp-mysql_hosts`
- **Type:** String (comma-separated)
- **Default:** `"127.0.0.1"`
- **Description:** Legacy POC variable used by non-routed components (for example static harvester defaults). Routed query execution uses MCP profile tables.
- **Runtime:** Yes
- **Example:**
```sql
SET mcp-mysql_hosts='192.168.1.10,192.168.1.11,192.168.1.12';
LOAD MCP VARIABLES TO RUNTIME;
```
#### `mcp-mysql_ports`
- **Type:** String (comma-separated)
- **Default:** `"3306"`
- **Description:** Legacy POC variable used by non-routed components (for example static harvester defaults). Routed query execution uses MCP profile tables.
- **Runtime:** Yes
- **Example:**
```sql
SET mcp-mysql_ports='3306,3307,3308';
LOAD MCP VARIABLES TO RUNTIME;
```
#### `mcp-mysql_user`
- **Type:** String
- **Default:** `""` (empty)
- **Description:** Legacy POC variable. Routed query execution uses credentials from `mcp_auth_profiles`.
- **Runtime:** Yes
- **Example:**
```sql
SET mcp-mysql_user='mcp_user';
LOAD MCP VARIABLES TO RUNTIME;
```
#### `mcp-mysql_password`
- **Type:** String
- **Default:** `""` (empty)
- **Description:** Legacy POC variable. Routed query execution uses credentials from `mcp_auth_profiles`.
- **Runtime:** Yes
- **Note:** Password is stored in plaintext in `global_variables`. Use restrictive MySQL user permissions.
- **Example:**
```sql
SET mcp-mysql_password='secure-password';
LOAD MCP VARIABLES TO RUNTIME;
```
#### `mcp-mysql_schema`
- **Type:** String
- **Default:** `""` (empty)
- **Description:** Legacy POC variable. Routed query execution uses `default_schema` from `mcp_auth_profiles`.
- **Runtime:** Yes
- **Example:**
```sql
SET mcp-mysql_schema='mydb';
LOAD MCP VARIABLES TO RUNTIME;
```
### Catalog Configuration
The catalog database path is **hardcoded** to `mcp_catalog.db` in the ProxySQL datadir and cannot be changed at runtime. The catalog stores:

@ -99,12 +99,6 @@ public:
* from regular MCP usage.
*/
bool mcp_stats_enable_debug_tools;
// MySQL Tool Handler configuration
char* mcp_mysql_hosts; ///< Comma-separated list of MySQL hosts
char* mcp_mysql_ports; ///< Comma-separated list of MySQL ports
char* mcp_mysql_user; ///< MySQL username for tool connections
char* mcp_mysql_password; ///< MySQL password for tool connections
char* mcp_mysql_schema; ///< Default schema/database
// Catalog path is hardcoded to mcp_catalog.db in the datadir
} variables;

@ -36,12 +36,6 @@ static const char* mcp_thread_variables_names[] = {
"stats_show_queries_max_rows",
"stats_show_processlist_max_rows",
"stats_enable_debug_tools",
// MySQL Tool Handler configuration
"mysql_hosts",
"mysql_ports",
"mysql_user",
"mysql_password",
"mysql_schema",
NULL
};
@ -66,12 +60,6 @@ MCP_Threads_Handler::MCP_Threads_Handler() {
variables.mcp_stats_show_queries_max_rows = 200;
variables.mcp_stats_show_processlist_max_rows = 200;
variables.mcp_stats_enable_debug_tools = false;
// MySQL Tool Handler default values
variables.mcp_mysql_hosts = strdup("127.0.0.1");
variables.mcp_mysql_ports = strdup("3306");
variables.mcp_mysql_user = strdup("");
variables.mcp_mysql_password = strdup("");
variables.mcp_mysql_schema = strdup("");
status_variables.total_requests = 0;
status_variables.failed_requests = 0;
@ -105,17 +93,6 @@ MCP_Threads_Handler::~MCP_Threads_Handler() {
free(variables.mcp_ai_endpoint_auth);
if (variables.mcp_rag_endpoint_auth)
free(variables.mcp_rag_endpoint_auth);
// Free MySQL Tool Handler variables
if (variables.mcp_mysql_hosts)
free(variables.mcp_mysql_hosts);
if (variables.mcp_mysql_ports)
free(variables.mcp_mysql_ports);
if (variables.mcp_mysql_user)
free(variables.mcp_mysql_user);
if (variables.mcp_mysql_password)
free(variables.mcp_mysql_password);
if (variables.mcp_mysql_schema)
free(variables.mcp_mysql_schema);
if (mcp_server) {
delete mcp_server;
@ -248,27 +225,6 @@ int MCP_Threads_Handler::get_variable(const char* name, char* val) {
sprintf(val, "%s", variables.mcp_stats_enable_debug_tools ? "true" : "false");
return 0;
}
// MySQL Tool Handler configuration
if (!strcmp(name, "mysql_hosts")) {
sprintf(val, "%s", variables.mcp_mysql_hosts ? variables.mcp_mysql_hosts : "");
return 0;
}
if (!strcmp(name, "mysql_ports")) {
sprintf(val, "%s", variables.mcp_mysql_ports ? variables.mcp_mysql_ports : "");
return 0;
}
if (!strcmp(name, "mysql_user")) {
sprintf(val, "%s", variables.mcp_mysql_user ? variables.mcp_mysql_user : "");
return 0;
}
if (!strcmp(name, "mysql_password")) {
sprintf(val, "%s", variables.mcp_mysql_password ? variables.mcp_mysql_password : "");
return 0;
}
if (!strcmp(name, "mysql_schema")) {
sprintf(val, "%s", variables.mcp_mysql_schema ? variables.mcp_mysql_schema : "");
return 0;
}
return -1;
}
@ -393,37 +349,6 @@ int MCP_Threads_Handler::set_variable(const char* name, const char* value) {
}
return -1;
}
// MySQL Tool Handler configuration
if (!strcmp(name, "mysql_hosts")) {
if (variables.mcp_mysql_hosts)
free(variables.mcp_mysql_hosts);
variables.mcp_mysql_hosts = strdup(value);
return 0;
}
if (!strcmp(name, "mysql_ports")) {
if (variables.mcp_mysql_ports)
free(variables.mcp_mysql_ports);
variables.mcp_mysql_ports = strdup(value);
return 0;
}
if (!strcmp(name, "mysql_user")) {
if (variables.mcp_mysql_user)
free(variables.mcp_mysql_user);
variables.mcp_mysql_user = strdup(value);
return 0;
}
if (!strcmp(name, "mysql_password")) {
if (variables.mcp_mysql_password)
free(variables.mcp_mysql_password);
variables.mcp_mysql_password = strdup(value);
return 0;
}
if (!strcmp(name, "mysql_schema")) {
if (variables.mcp_mysql_schema)
free(variables.mcp_mysql_schema);
variables.mcp_mysql_schema = strdup(value);
return 0;
}
return -1;
}

Loading…
Cancel
Save