Skip to content

Commit dc4309c

Browse files
Merge pull request #22 from arjunkmrm/update-smithery-config
Add local docker container support to smithery.yaml configuration
2 parents 224af11 + ed40a3e commit dc4309c

File tree

2 files changed

+27
-8
lines changed

2 files changed

+27
-8
lines changed

Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@ RUN pip install --no-cache-dir -r requirements.txt
1515
COPY src/ /app/src
1616

1717
# Set environment variables for MySQL (these can be overwritten with `docker run -e`)
18-
ENV MYSQL_HOST=localhost
18+
ENV MYSQL_HOST=host.docker.internal
19+
ENV MYSQL_PORT=3306
1920
ENV MYSQL_USER=your_username
2021
ENV MYSQL_PASSWORD=your_password
2122
ENV MYSQL_DATABASE=your_database
23+
ENV PYTHONPATH=/app/src
2224

2325
# Command to run the server
24-
CMD ["python", "-m", "mysql_mcp_server"]
26+
CMD ["python", "-m", "mysql_mcp_server.server"]

smithery.yaml

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,41 @@ startCommand:
66
# JSON Schema defining the configuration options for the MCP.
77
type: object
88
required:
9-
- mysqlHost
109
- mysqlUser
1110
- mysqlPassword
1211
- mysqlDatabase
1312
properties:
1413
mysqlHost:
1514
type: string
16-
description: The hostname of the MySQL server.
15+
description: "The hostname of the MySQL server. Use localhost for local connections or a specific address for remote databases. For Docker, host.docker.internal allows accessing the host machine."
16+
default: "host.docker.internal"
17+
mysqlPort:
18+
type: number
19+
description: "The port of the MySQL server (default: 3306)."
20+
default: 3306
1721
mysqlUser:
1822
type: string
19-
description: The username for MySQL authentication.
23+
description: "The username for MySQL authentication."
2024
mysqlPassword:
2125
type: string
22-
description: The password for MySQL authentication.
26+
description: "The password for MySQL authentication."
2327
mysqlDatabase:
2428
type: string
25-
description: The database to connect to.
29+
description: "The database to connect to."
2630
commandFunction:
2731
# A function that produces the CLI command to start the MCP on stdio.
2832
|-
29-
(config) => ({ command: 'python', args: ['-m', 'mysql_mcp_server'], env: { MYSQL_HOST: config.mysqlHost, MYSQL_USER: config.mysqlUser, MYSQL_PASSWORD: config.mysqlPassword, MYSQL_DATABASE: config.mysqlDatabase } })
33+
(config) => ({
34+
command: 'docker',
35+
args: [
36+
'run',
37+
'-i',
38+
'--rm',
39+
'-e', `MYSQL_HOST=${config.mysqlHost}`,
40+
'-e', `MYSQL_PORT=${config.mysqlPort}`,
41+
'-e', `MYSQL_USER=${config.mysqlUser}`,
42+
'-e', `MYSQL_PASSWORD=${config.mysqlPassword}`,
43+
'-e', `MYSQL_DATABASE=${config.mysqlDatabase}`,
44+
'smithery/mysql-mcp-server:latest'
45+
]
46+
})

0 commit comments

Comments
 (0)