data-struct-accessor-mysql-toolkit
Facilitates secure interaction with MySQL databases, enabling data querying, structural definition management, performance diagnostics, and automated derivation of corporate intelligence reports.
Author

zajTools
Quick Info
Actions
Tags
Data Structure Accessor for MySQL (DSAMCP)
This implementation adheres to the Model Context Protocol (MCP) server specification, offering robust connectivity to MySQL RDBMS instances. Its primary functions revolve around executing structured query language (SQL) commands, inspecting and modifying database schemata, and synthesizing analytical findings into actionable business intelligence artifacts.
Core Functionalities
- Execute arbitrary SQL directives against a designated MySQL instance.
- Provision and maintain database structures (tables, indexes).
- Perform diagnostic scans on database layout and metadata.
- Generate and persist critical business assessments.
- Provide persistent access to an aggregated analytical narrative.
Operational Toolset
Data Manipulation & Retrieval Interface
- fetch_data: Executes read-only SQL operations to extract datasets.
- Argument:
query_string(Text) - The precise SELECT SQL payload. -
Output: Data set represented as an array of standardized records (objects).
-
modify_data: Handles transactional modifications (INSERT, UPDATE, DELETE).
- Argument:
transaction_payload(Text) - The SQL statement intended for data modification. -
Output:
{ affected_rows: Integer }indicating scope of change. -
define_structure: Issues commands to instantiate new database entities.
- Argument:
ddl_statement(Text) - The CREATE TABLE SQL instruction. - Output: Success confirmation for structure instantiation.
Metadata & Schema Exploration
- catalog_entities: Retrieves a comprehensive enumeration of all accessible collections (tables).
- Input: None required.
-
Output: List of entity identifiers (table names).
-
inspect_entity: Yields detailed metadata pertaining to a specific structure.
- Argument:
entity_identifier(Text) - The name of the structure to examine. - Output: Array detailing column specifications, including naming conventions and type mappings.
Intelligence Synthesis Module
- inject_assessment: Incorporates newly derived business insights into the central repository.
- Argument:
derived_insight(Text) - A synthesized observation derived from data analysis. - Output: Acknowledgment of successful archival.
- Side Effect: Triggers an update cycle on the
memo://intelligence_logresource.
Managed Artifacts
The server exposes one primary, dynamically managed artifact:
- memo://intelligence_log: A centralized, chronologically ordered log accumulating all discovered analytical insights.
- Behavior: Self-maintaining; refreshes automatically upon invocation of the
inject_assessmentfunction.
Engineering Specifications
This MCP server is engineered as a native implementation of the Model Context Protocol, eschewing reliance on vendor-specific client libraries where possible. Key technological components include:
- mysql2: Primary driver for database connectivity and communication.
- yargs: Utility for parsing invocation arguments from the operational environment.
- readline: Standard module for managing input/output streams.
The communication paradigm strictly adheres to the JSON-RPC 2.0 specification for service discovery, listing capabilities, and remote execution management.
Environmental Configuration
Configuration parameters for database connectivity are managed exclusively via environment variables, typically loaded from a root-level .env file.
dotenv
Connection Protocol Identifier
DB_PROTOCOL=mysql
Server Address
DB_HOST=localhost
Service Port
DB_PORT=3306
Credential: Principal User (Mandatory)
DB_USERNAME=my_enterprise_user
Credential: Secret Key (Mandatory)
DB_PASSWORD=secure_access_key
Target Schema Identifier (Mandatory)
DB_SCHEMA=corporate_data_warehouse
Refer to the companion .env.example for initialization procedures: Copy the template, rename it to .env, and populate the required credential fields.
Integration within Claude Desktop Environment
To enable this service within the host environment (cline_mcp_settings.json):
"mcpServers": { "mysql_accessor": { "command": "node", "args": [ "/absolute/path/to/DSAMCP/dist/main.js" ], "disabled": false, "autoApprove": [] } }
Crucially, configuration relies on the system environment variables (.env), bypassing command-line parameter passing for sensitive credentials.
Deployment Sequence
-
Secure a copy of the repository: bash git clone https://github.com/zajTools/zaj-MySQL-MCP.git dsamcp_repo cd dsamcp_repo
-
Establish the configuration file: bash cp .env.example .env
Modify .env with your specific database parameters
-
Install required dependencies: bash npm install
-
Compile the source code: bash npm run compile
-
Initiate the server process: bash node dist/main.js
Illustrative Examples and Demonstrations
To expedite onboarding, we provide supporting materials:
- Sample Data Model: A comprehensive relational structure simulating transactional business activities (e.g., sales, inventory, client profiles).
- Predefined Queries: A collection of parameterized SQL examples showcasing tool capabilities.
- Interaction Blueprints: Scenarios detailing optimal conversational flows for data interrogation.
Initiate guided exploration via:
- Consult the Demonstration Protocol Guide.
- Execute the Initialization SQL Script against your target instance.
- Configure the DSAMCP server pointing to the initialized database.
- Commence data exploration sessions with the model interface!
These materials are generalized aids; the toolkit is fully interoperable with any accessible, compliant MySQL system.
Licensing
This software is distributed under the permissive MIT License terms.
