使用说明
xampp-mcp
English | Español
MCP server for administering XAMPP and MySQL on Windows from MCP clients over stdio
(VS Code, Copilot agents, Claude Code, etc.).
It speaks MCP protocol revision 2026-07-28 as well as the legacy (initialize) era,
so current clients keep connecting unchanged.
Requirements
- Windows
- Node.js 22+
- XAMPP installed (
C:\xamppby default)
Installation
npm package:
- https://www.npmjs.com/package/xampp-mcp
Global install:
npm install -g xampp-mcp
Local install in a project:
npm i xampp-mcp
MCP client configuration
There are two possible locations and they are not equivalent — even the root key differs:
| File | Read by | Root key |
|---|---|---|
.vscode/mcp.json |
VS Code | servers |
.mcp.json in the project root |
Claude Code and Copilot's Agent Host | mcpServers |
Neither is deprecated. But VS Code's documentation warns that "when Agent Host is enabled,
the Agent Host doesn't read .vscode/mcp.json directly", and recommends the root file "for
MCP configuration that is portable across the Agent Host and other Copilot tools". If you
use both clients you need both files: the schemas differ, so they cannot be merged.
VS Code — .vscode/mcp.json
Recommended example:
{
"servers": {
"xamppMcp": {
"type": "stdio",
"command": "xampp-mcp",
"args": [],
"env": {
"XAMPP_DIR": "C:\\xampp",
"XAMPP_MCP_DATA_DIR": "${workspaceFolder}/mcp-data"
}
}
}
}
If you installed the package locally (npm i xampp-mcp), you can use:
{
"servers": {
"xamppMcp": {
"type": "stdio",
"command": "node",
"args": ["${workspaceFolder}/node_modules/xampp-mcp/dist/server.js"],
"env": {
"XAMPP_DIR": "C:\\xampp",
"XAMPP_MCP_DATA_DIR": "${workspaceFolder}/mcp-data"
}
}
}
}
Claude Code and Agent Host — .mcp.json in the root
{
"mcpServers": {
"xampp": {
"command": "npx",
"args": ["-y", "xampp-mcp"],
"env": {
"XAMPP_DIR": "C:\\xampp",
"XAMPP_MCP_DATA_DIR": "${XAMPP_MCP_DATA_DIR:-./mcp-data}"
}
}
}
}
Claude Code expands ${VAR} and ${VAR:-default} in command, args and env, which
lets you commit this file and still let each machine override the path through its own
environment variable.
${CLAUDE_PROJECT_DIR} does not help here, even though it exists: Claude Code sets it
in the spawned server's environment, not in its own, so it has no value yet when
.mcp.json is expanded and has to be written as ${CLAUDE_PROJECT_DIR:-.} — which in
practice falls back to .. A server that genuinely wants the project root should read
process.env.CLAUDE_PROJECT_DIR at runtime.
Environment variables
| Variable | Default | What it does |
|---|---|---|
XAMPP_DIR |
C:\xampp |
XAMPP installation |
XAMPP_APACHE_SERVICE |
Apache2.4 |
Apache Windows service name |
XAMPP_MYSQL_SERVICE |
mysql |
MySQL Windows service name |
MYSQL_HOST |
127.0.0.1 |
Default MySQL host |
MYSQL_PORT |
3306 |
Default MySQL port |
MYSQL_USER |
root |
Default MySQL user |
MYSQL_PASSWORD |
(empty) | Default MySQL password |
XAMPP_MCP_DATA_DIR |
working directory | Root every file path is confined to (export, import, diagrams) |
XAMPP_PHP_SCRIPTS_DIR |
<XAMPP_DIR>\htdocs |
Root php_cli_run may execute scripts from |
XAMPP_MCP_REMOTE_RENDER |
(disabled) | Set to 1 to let diagram_render upload the diagram to the remote renderer |
The last three are security boundaries. Read SECURITY.md before widening them.
Confirming destructive operations
The writing tools (db_create, query_execute, db_import, user_create,
grant_manage, db_export) do not act without confirmation.
If your MCP client supports elicitation, it asks you: "Create the database
"ventas"?". Accept and it proceeds; decline and nothing is touched. If your client does
not support it, the tool returns an error asking to resend with confirmed: true, as
before.
You can still pass confirmed: true explicitly to skip the prompt — useful in scripts.
Important usage notes
- If Apache/MySQL are down, you must start them yourself from the XAMPP Control Panel. The server never starts them on its own: it asks you and waits for your confirmation.
- Use
snake_case(_) for database and table names, and avoid-. - The server uses UTF-8 (
utf8mb4) so accents and special characters survive.
ER diagrams (recommended flow)
When you ask for a database diagram in VS Code chat:
- Run
diagram_erto get Mermaid from the real schema. It never leaves the machine. - Preview it in chat with
renderMermaidDiagram, usingstructuredContent.previewRequest.args.markup. - If the user confirms they want SVG, run
diagram_renderwithstructuredContent.renderRequest.args.
Step 3 requires XAMPP_MCP_REMOTE_RENDER=1: it renders through Kroki, a remote service, so
your real table and column names leave the machine. Without that variable the tool
validates the Mermaid and returns only the text block.
Compatibility notes:
renderMermaidDiagramis a VS Code chat capability, not something this server provides: VS Code controls its name and availability. It was introduced in 1.109 (January 2026) and since 1.121 lives in the built-inMermaid Markdown Featuresextension.- Use VS Code 1.131 or later: between 1.129.1 and 1.130.x a regression prevented the
tool from being registered, and the call fails with
Tool "renderMermaidDiagram" was not contributed. - The preview step is optional: if the tool does not exist in your client, the Mermaid is
already in
diagram_er's text output. For SVG, usediagram_render.
Development
npm install
npm run lint # typechecks src and tests
npm test # node:test, no extra dependencies
npm run build
Documentation
- Full tool list: docs/tools.md
- Security model: SECURITY.md
- Change history: CHANGELOG.md
License
This project is MIT licensed. See LICENSE.
