Skip to content

Commit 0610295

Browse files
committed
docs: remove .env approach and focus on MCP configuration
1 parent 843b56d commit 0610295

File tree

1 file changed

+22
-83
lines changed

1 file changed

+22
-83
lines changed

README.md

Lines changed: 22 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,11 @@ npx mysql-query-mcp-server
4545

4646
## Setup Instructions
4747

48-
### 1. Configure Your AI Tool to Use the MCP Server
48+
### Configure Your AI Tool to Use the MCP Server
4949

50-
1. Create or edit your MCP configuration file (e.g., `.cursor/mcp.json` for Cursor IDE):
50+
Create or edit your MCP configuration file (e.g., `.cursor/mcp.json` for Cursor IDE):
5151

52+
**Basic Configuration:**
5253
```json
5354
{
5455
"mysql": {
@@ -61,8 +62,7 @@ npx mysql-query-mcp-server
6162
}
6263
```
6364

64-
For more advanced configuration with environment variables embedded in the MCP config:
65-
65+
**Comprehensive Configuration with Database Credentials:**
6666
```json
6767
{
6868
"mysql": {
@@ -101,94 +101,30 @@ For more advanced configuration with environment variables embedded in the MCP c
101101
}
102102
```
103103

104-
#### Choosing the Right Configuration Approach
104+
### Choosing the Right Configuration Approach
105105

106106
There are two ways to configure the MySQL MCP server:
107107

108108
1. **Binary Configuration** (`type: "bin"`, `bin: "mysql-query-mcp"`)
109109
- **When to use**: When you've installed the package globally (`npm install -g mysql-query-mcp-server`)
110-
- **Pros**: Simpler configuration, cleaner MCP file
111-
- **Cons**: Requires global installation, uses a separate `.env` file for database credentials
110+
- **Pros**: Simpler configuration
111+
- **Cons**: Requires global installation
112112

113113
2. **Command Configuration** (`command: "npx"`, `args: ["mysql-query-mcp-server@latest"]`)
114114
- **When to use**: When you want to use the latest version without installing it globally
115115
- **Pros**: No global installation required, all configuration in one file
116-
- **Cons**: More complex configuration, credentials in MCP file (which may be preferred in some cases)
116+
- **Cons**: More complex configuration
117117

118118
Choose the approach that best fits your workflow. Both methods will work correctly with any AI assistant that supports MCP.
119119

120-
**Important Configuration Notes:**
120+
### Important Configuration Notes
121+
121122
- You must use the full environment names: LOCAL_, DEVELOPMENT_, STAGING_, PRODUCTION_
122123
- Abbreviations like DEV_ or PROD_ will not work
123124
- Global settings like DEBUG, MCP_MYSQL_SSL apply to all environments
124125
- At least one environment (typically "local") must be configured
125126
- You only need to configure the environments you plan to use
126-
127-
### 2. Alternative: Using a .env File
128-
129-
If you prefer to keep your database credentials in a separate file, you can use a `.env` file:
130-
131-
```env
132-
# Local Database
133-
LOCAL_DB_HOST=localhost
134-
LOCAL_DB_USER=root
135-
LOCAL_DB_PASS=your_password
136-
LOCAL_DB_NAME=your_database
137-
LOCAL_DB_PORT=3306
138-
LOCAL_DB_SSL=false
139-
140-
# Development Database (optional)
141-
DEVELOPMENT_DB_HOST=dev.example.com
142-
DEVELOPMENT_DB_USER=dev_user
143-
DEVELOPMENT_DB_PASS=dev_password
144-
DEVELOPMENT_DB_NAME=dev_database
145-
DEVELOPMENT_DB_PORT=3306
146-
DEVELOPMENT_DB_SSL=true
147-
148-
# Staging Database (optional)
149-
STAGING_DB_HOST=staging.example.com
150-
STAGING_DB_USER=staging_user
151-
STAGING_DB_PASS=staging_password
152-
STAGING_DB_NAME=staging_database
153-
STAGING_DB_PORT=3306
154-
STAGING_DB_SSL=true
155-
156-
# Production Database (optional)
157-
PRODUCTION_DB_HOST=prod.example.com
158-
PRODUCTION_DB_USER=prod_user
159-
PRODUCTION_DB_PASS=prod_password
160-
PRODUCTION_DB_NAME=prod_database
161-
PRODUCTION_DB_PORT=3306
162-
PRODUCTION_DB_SSL=true
163-
164-
# Debug Mode
165-
DEBUG=false
166-
```
167-
168-
**Important:** The `.env` file must be placed in the current working directory from where you run the MySQL MCP server. The server will automatically look for a `.env` file in this location. If you're using:
169-
170-
- **Global installation**: The `.env` file should be in the directory where you run the commands
171-
- **NPX method**: The `.env` file should be in the directory where you run `npx mysql-query-mcp-server`
172-
- **MCP command method**: You can skip the `.env` file entirely and use the embedded environment variables
173-
174-
You can copy the included `.env.example` file to get started:
175-
```bash
176-
cp .env.example .env
177-
```
178-
179-
When using a `.env` file, your MCP configuration can be simplified to:
180-
181-
```json
182-
{
183-
"mysql": {
184-
"name": "MySQL Query MCP",
185-
"description": "MySQL read-only query access through MCP",
186-
"type": "bin",
187-
"enabled": true,
188-
"bin": "mysql-query-mcp"
189-
}
190-
}
191-
```
127+
- For security reasons, consider using environment variables or secure credential storage for production credentials
192128

193129
## Configuration Options
194130

@@ -250,7 +186,11 @@ Use the info tool to check the status of our production database.
250186

251187
#### 3. environments
252188

253-
List all configured environments from your `.env` file.
189+
List all configured environments from your configuration:
190+
191+
```
192+
Use the environments tool to show me which database environments are available.
193+
```
254194

255195
## Available Tools
256196

@@ -282,7 +222,7 @@ Get detailed information about your database:
282222

283223
### 3. environments
284224

285-
List all configured environments from your setup:
225+
List all configured environments from your configuration:
286226

287227
```
288228
Use the environments tool to show me which database environments are available.
@@ -294,19 +234,18 @@ Use the environments tool to show me which database environments are available.
294234
- ✅ Each environment has its own isolated connection pool
295235
- ✅ SSL connections are supported for production environments
296236
- ✅ Query timeouts prevent runaway operations
297-
- ⚠️ Keep your `.env` file secure and never commit it to source control
237+
- ⚠️ Consider using secure credential management for database credentials
298238

299239
## Troubleshooting
300240

301241
### Connection Issues
302242

303243
If you're having trouble connecting:
304244

305-
1. Verify your database credentials in `.env` or your MCP configuration
306-
2. Check the location of your `.env` file (it must be in the current working directory)
307-
3. Ensure the MySQL server is running and accessible
308-
4. Check for firewall rules blocking connections
309-
5. Enable debug mode for detailed logs: `DEBUG=true mysql-query-mcp`
245+
1. Verify your database credentials in your MCP configuration
246+
2. Ensure the MySQL server is running and accessible
247+
3. Check for firewall rules blocking connections
248+
4. Enable debug mode by setting DEBUG=true in your configuration
310249

311250
### Common Errors
312251

0 commit comments

Comments
 (0)