1.0.10 • Published 5 months ago

mcp-mysql-connector v1.0.10

Weekly downloads
-
License
MIT
Repository
-
Last release
5 months ago

MCP MySQL Connector

A Model Context Protocol (MCP) plugin for connecting to MySQL databases from Cursor IDE.

Installation

Option 1: Use with npx (Recommended)

You can use the plugin directly with npx without installing it:

npx -y mcp-mysql-connector mysql://user:password@host:port/database

Option 2: Install globally

npm install -g mcp-mysql-connector
mcp-mysql-connector mysql://user:password@host:port/database

Option 3: Clone the repository

# Clone the repository
git clone https://github.com/yourusername/mcp-mysql-connector.git
cd mcp-mysql-connector

# Install dependencies
npm install

# Run the plugin
node index.js mysql://user:password@host:port/database

Setup with Cursor IDE

For easier setup with Cursor IDE, you can use the setup script:

npx -y mcp-mysql-connector-setup

This will guide you through the process of setting up the MCP MySQL Connector with Cursor IDE.

Connection String Format

The connection string should be in the following format:

mysql://user:password@host:port/database

Example:

mysql://root:password@localhost:3306/mydatabase

You can also add SSL support by appending ?ssl=true to the connection string:

mysql://user:password@host:port/database?ssl=true

How It Works

This plugin creates a simple HTTP server that implements the Model Context Protocol. It connects to your MySQL database and allows Cursor IDE to run SQL queries against it.

The server listens on port 3000 by default and accepts POST requests with SQL queries. The results are returned as JSON.

Important Note: The MySQL connection uses the port specified in the connection string (default: 3306), while the MCP server runs on port 3000. Make sure Cursor is configured to use port 3000 for the MCP connection.

Using with Cursor IDE

Once the MCP server is running, you can use it with Cursor IDE to run SQL queries against your MySQL database.

  1. Open Cursor
  2. Go to MCP Servers
  3. Click "Add new MCP server"
  4. Enter a name (e.g., "MySQL")
  5. Enter the command: npx -y mcp-mysql-connector mysql://user:password@host:port/database

Publishing to npm

If you want to publish this package to npm, follow these steps:

  1. Create an npm account if you don't have one: https://www.npmjs.com/signup
  2. Login to npm from the command line:
    npm login
  3. Publish the package:
    npm publish

License

MIT

1.0.10

5 months ago

1.0.9

5 months ago

1.0.8

5 months ago

1.0.7

5 months ago

1.0.5

5 months ago

1.0.4

5 months ago

1.0.3

5 months ago

1.0.2

5 months ago

1.0.1

5 months ago

1.0.0

5 months ago