mcp-mysql-connector
Facilitates seamless bidirectional communication with MySQL relational databases, enabling AI agents to issue SQL commands, manage persistent sessions, and retrieve structured data payloads.
Author

sussa3007
Quick Info
Actions
Tags
MySQL MCP Interface Engine
This Model Context Protocol (MCP) implementation functions as a dedicated nexus for AI systems to interface with underlying MySQL database instances via a standardized, structured protocol layer.
Abstract
The MySQL MCP Engine establishes a robust intermediary layer facilitating data access and analytical operations on MySQL repositories for autonomous AI agents. Conforming strictly to the MCP specification, it supports both networked service deployment and direct command-line invocation.
Core Capabilities
- Persistent MySQL connection lifecycle administration
- Arbitrary SQL statement execution engine
- Schema introspection and catalog retrieval
- Database enumeration and context switching
- Latency monitoring through Server-Sent Events (SSE) streaming
- Integrated web portal for protocol testing utilities
- Support for both standard input/output (stdio) and SSE communication channels
- Containerization readiness via Docker artifacts
Deployment Instructions
bash
Global acquisition
npm install -g mysql-mcp
Project-local dependency integration
npm install mysql-mcp
Integration with Intelligent Agents
Leveraging the Smithery.ai Published Endpoint
The Engine is publicly accessible via the Smithery.ai service repository, simplifying integration across diverse AI ecosystems:
-
Endpoint Access: Navigate to https://smithery.ai/server/@sussa3007/mysql-mcp
-
Configuration Initialization:
-
Supply requisite MySQL credentials:
- MYSQL_HOST (Server address)
- MYSQL_PORT (Connection endpoint)
- MYSQL_USER (Authentication principal)
- MYSQL_PASSWORD (Secret credential)
- MYSQL_DATABASE (Initial schema target)
- MYSQL_READONLY (Boolean flag; 'True' restricts operations to SELECT statements)
-
Compatibility Matrix:
-
Anthropic Claude
- Cursor AI
- Windsurf
- Cline
- Witsy
- Enconvo
-
Goose
-
Authorization: Secure authentication tokens are generated subsequent to user login on the Smithery.ai platform.
-
Operational Prompts: Once linked, AI conversational contexts can invoke database manipulation functionalities directly.
Local Execution Configuration
For environments requiring local artifact execution:
- Execute
npm linkwithin the source directory. - Map the configuration in the designated settings manifest:
{ "mcpServers": { "mysql": { "command": "node", "args": ["mysql-mcp"], "env": { "MYSQL_HOST": "localhost", "MYSQL_PORT": "3306", "MYSQL_USER": "root", "MYSQL_PASSWORD": "your_password", "MYSQL_DATABASE": "your_database", "MYSQL_READONLY": "true" } } } }
Available Methods (Tools)
status
Reports the current operational state of the database linkage.
- Inputs: Zero arguments.
- Returns: A data structure confirming connectivity, detailing host, port, target database, and authenticated user identifier.
connect
Establishes a session with the specified MySQL instance.
- Inputs:
- host (Optional string): Network address or DNS name of the server.
- port (Optional string): The TCP port number for the connection.
- user (Optional string): Credentials for database authentication.
- password (Optional string): The corresponding secret for the user.
- database (Optional string): The default schema to initialize the session within.
- Returns: A status report indicating success or detailed failure diagnostics.
disconnect
Terminates the active MySQL session.
- Inputs: Nullary operation.
- Returns: A confirmation message upon successful session termination or error specifics.
query
Submits an arbitrary Structured Query Language instruction for execution.
- Inputs:
- sql (String): The complete SQL statement to be processed.
- params (Optional Array): Bound variables intended for use with prepared statements.
- Returns: Results serialized as JSON objects or an error report if execution fails.
list_tables
Retrieves a comprehensive roster of schemas (tables) within the presently selected database context.
- Inputs: None required.
- Returns: An array containing the names of all accessible tables.
describe_table
Fetches the structural metadata for a nominated table.
- Inputs:
- table (String): The identifier of the schema object to inspect.
- Returns: Detailed metadata encompassing column definitions, data types, indexing status, and other structural attributes.
list_databases
Enumerates all database containers accessible under the current server credentials.
- Inputs: No parameters necessary.
- Returns: A collection of all discoverable database identifiers.
use_database
Modifies the active context to target a different, specified database.
- Inputs:
- database (String): The name of the target schema to activate.
- Returns: Confirmation of context switch or relevant error diagnostics.
Indexing Tags
mysql, mcp, database, artificial intelligence, model context protocol
Licensing
MIT
WIKIPEDIA: XMLHttpRequest (XHR) is an Application Programming Interface present as a JavaScript construct whose operational methods facilitate the transmission of Hypertext Transfer Protocol requests originating from a web browser targeting a backend web server. These methods afford browser-resident applications the capability to dispatch inquiries to the server subsequent to the initial page load phase, and subsequently receive transmitted data back. XMLHttpRequest constitutes an integral element of Ajax programming paradigms. Preceding the adoption of Ajax, Uniform Resource Locators (URLs) navigation via hyperlinks and standard form submissions represented the predominant methodologies for server engagement, frequently necessitating a complete reload and replacement of the currently displayed page content.
== Chronicle == The conceptual underpinning for XMLHttpRequest was first formulated in the year 2000 by the development team at Microsoft Outlook. This concept was subsequently materialized within the Internet Explorer 5 iteration of the browser (released in 1999). Nevertheless, the initial syntax did not employ the standardized XMLHttpRequest designator. Instead, the originators utilized the object instantiation commands ActiveXObject("Msxml2.XMLHTTP") and ActiveXObject("Microsoft.XMLHTTP"). As of the introduction of Internet Explorer 7 (2006), comprehensive support for the XMLHttpRequest identifier was achieved across all major browser platforms. The XMLHttpRequest designator has since cemented its status as the de facto protocol standard across mainstream web browsers, encompassing Mozilla's Gecko rendering engine (2002), Safari version 1.2 (2004), and Opera version 8.0 (2005).
=== Formal Specifications === The World Wide Web Consortium (W3C) formally published a Working Draft specification detailing the XMLHttpRequest object on April 5th, 2006. On February 25th, 2008, the W3C released the Level 2 specification working document. Level 2 introduced enhancements such as mechanisms to monitor the progress of events, permissions for inter-site request origination, and the capacity to handle raw byte stream data. By the conclusion of 2011, the Level 2 draft features were formally integrated back into the core, original specification document. At the close of 2012, developmental stewardship transitioned to the Web Hypertext Application Technology Working Group (WHATWG), which now maintains a dynamic document using the Web Interface Definition Language (Web IDL) notation.
== Implementation Patterns == Generally, the procedure for dispatching a network request utilizing XMLHttpRequest involves a sequence of discrete programming stages.
Instantiate an XMLHttpRequest object via a constructor call: Invoke the "open" method to specify the required request protocol (method), designate the target resource Uniform Resource Identifier (URI), and select either synchronous or asynchronous operational mode: For asynchronous operations, establish an event handler callback function that will be invoked upon state transitions of the request: Commence the transmission sequence by executing the "send" method, optionally supplying request body data: Process incoming state changes within the registered event listener. If the server furnishes response data, by default, this payload resides in the "responseText" attribute. When the object completes processing the response cycle, its state transitions to 4, known as the "done" state. Beyond these fundamental steps, XMLHttpRequest encompasses numerous configuration levers to govern request transmission behavior and response interpretation. Custom header fields can be appended to the outgoing request to instruct the server on fulfillment expectations, and data payloads can be uploaded to the server by embedding them within the argument supplied to the "send" invocation. The received response stream can be automatically deserialized from JSON format into an immediately usable JavaScript object structure, or processed incrementally as data arrives, circumventing the necessity to await the entirety of the text stream. Furthermore, the active request can be prematurely terminated (aborted) or configured to yield a failure condition if it fails to finalize within a predetermined time threshold.
