loading…
Search for a command to run...
loading…
Read-only MCP server for exploring WordPress MySQL/MariaDB databases. Provides schema inspection, relationship mapping, and safe SQL querying.
Read-only MCP server for exploring WordPress MySQL/MariaDB databases. Provides schema inspection, relationship mapping, and safe SQL querying.
Read-only MCP server for exploring WordPress MySQL/MariaDB databases. Provides schema inspection, relationship mapping, and safe SQL querying.
information_schema, mysql, performance_schema, sysNo installation required when using uvx. The MCP server is installed automatically when configured.
Alternatively, install manually:
pip install wp-db-mcp
Create a dedicated read-only MySQL user:
CREATE USER 'wp_mcp_reader'@'localhost' IDENTIFIED BY 'your_secure_password';
GRANT SELECT ON your_wordpress_db.* TO 'wp_mcp_reader'@'localhost';
FLUSH PRIVILEGES;
| Variable | Default | Description |
|---|---|---|
WP_DB_HOST |
127.0.0.1 |
Database host (ignored if socket is set) |
WP_DB_PORT |
3306 |
Database port (ignored if socket is set) |
WP_DB_SOCKET |
(empty) | Unix socket path (for Local, MAMP, etc.) |
WP_DB_USER |
root |
Database user |
WP_DB_PASSWORD |
(empty) | Database password |
WP_DB_NAME |
wordpress |
Database name |
WP_TABLE_PREFIX |
(auto-detect) | Table prefix (e.g. wp_) |
WP_MAX_ROWS |
1000 |
Maximum rows per query |
WP_QUERY_TIMEOUT |
30 |
Query timeout in seconds |
Add to your MCP settings JSON:
{
"mcpServers": {
"wp-db": {
"command": "uvx",
"args": [
"--from",
"wp-db-mcp",
"wp-db-mcp"
],
"env": {
"WP_DB_HOST": "127.0.0.1",
"WP_DB_PORT": "3306",
"WP_DB_USER": "wp_mcp_reader",
"WP_DB_PASSWORD": "your_password",
"WP_DB_NAME": "your_wordpress_db"
}
}
}
}
claude mcp add wp-db \
-e WP_DB_HOST=127.0.0.1 \
-e WP_DB_USER=wp_mcp_reader \
-e WP_DB_PASSWORD=secret \
-e WP_DB_NAME=mysite \
-- uvx --from wp-db-mcp wp-db-mcp
Local uses Unix sockets. Find your socket path in Local's site info (Database tab), then:
{
"mcpServers": {
"wp-db": {
"command": "uvx",
"args": [
"--from",
"wp-db-mcp",
"wp-db-mcp"
],
"env": {
"WP_DB_SOCKET": "/Users/you/Library/Application Support/Local/run/XXXXXXXX/mysql/mysqld.sock",
"WP_DB_USER": "root",
"WP_DB_PASSWORD": "root",
"WP_DB_NAME": "local"
}
}
}
}
To find your socket path in Local:
List all tables with engine, row count, and size. Supports multisite site_id filter.
Show columns, types, keys, and indexes for a specific table. Accepts full name or core suffix (e.g. posts instead of wp_posts).
Generate a complete database schema with all columns, indexes, and detected relationships. Outputs JSON or CSV. Toggle include_plugins to include non-core tables. Uses optimized batch queries.
Map how WordPress tables relate to each other:
wp_posts -> wp_postmeta (via post_id)wp_posts -> wp_term_relationships -> wp_term_taxonomy -> wp_termswp_posts -> wp_comments (via comment_post_ID)wp_users -> wp_usermeta (via user_id)wp_users -> wp_posts (via post_author)wp_terms -> wp_termmeta (via term_id)Execute raw SELECT queries with safety checks. Blocked: INSERT, UPDATE, DELETE, DROP, system schemas, and all other write/DDL operations. Row limit and timeout enforced. Returns has_more indicator for pagination.
Search posts by title or content using LIKE matching. Filter by post_type and post_status. Returns content preview (first 200 chars).
Get all terms for a post, traversing the full relationship chain. Filter by taxonomy.
Get all posts for a term. Filter by post_type and post_status. Returns has_more indicator.
List all taxonomies registered in the database with term counts and total usage.
Get all meta key-value pairs for a post. Filter by meta_key (exact or LIKE pattern).
Get all meta key-value pairs for a user. Filter by meta_key. Note: In multisite, user meta is shared across all sites.
Get all meta key-value pairs for a comment. Filter by meta_key.
These tools query relationships created by the WP Content Connect library.
Discover all relationship names registered in WP Content Connect. Queries both post_to_post and post_to_user tables to list distinct relationship names with their connection counts. Useful for exploring what relationships exist before querying specific connections.
Get posts connected to a post via the post_to_post table. Supports filtering by relationship name and direction (from, to, or any).
Get users connected to a post via the post_to_user table. Supports filtering by relationship name.
Get posts connected to a user via the post_to_user table (reverse lookup). Supports filtering by relationship name.
List all post connections for a given relationship name. Returns all connection pairs with both posts' details (ID, title, type) and the relationship order.
These tools support the "shadow taxonomy" pattern where posts are related through taxonomy terms that store the source post ID in term meta.
Discover shadow taxonomies in the database. Identifies taxonomies where terms have meta values that reference valid post IDs. Returns taxonomy name, meta key used, term count, and linked post count. Useful for exploring what shadow relationships exist.
Find posts related via a shadow taxonomy. Given a source post, finds all terms where the term meta matches the post ID, then returns all posts assigned to those terms.
Parameters:
post_id: Source post IDtaxonomy: Shadow taxonomy name (e.g., speaker_shadow)meta_key: Term meta key storing the post ID (e.g., shadow_post_id)Get the source post for a shadow term (reverse lookup). Given a term ID, finds the post whose ID is stored in the term's meta.
List all posts using a shadow taxonomy relationship. Returns all posts assigned to shadow terms, with term info (ID, name) and source post details (ID, title, type).
Once configured, just ask questions in natural language. The AI will automatically use the appropriate tools.
For sites using the WP Content Connect library:
For sites using shadow taxonomies (where posts are related through taxonomy terms that store post IDs in term meta):
For multisite installations, pass site_id to any tool:
site_id=None or site_id=1 -> main site (uses base prefix, e.g. wp_)site_id=2 -> sub-site 2 (uses wp_2_)site_id=3 -> sub-site 3 (uses wp_3_)The wp_get_relationships tool auto-detects all multisite prefixes.
Note: wp_users and wp_usermeta are shared across all sites in multisite.
Set include_plugins=true in wp_get_schema to include all tables beyond WordPress core.
For WooCommerce, the schema will include tables like:
wp_wc_orders, wp_wc_order_product_lookupwp_woocommerce_* tablesUse wp_query to explore any table directly.
MIT
Выполни в терминале:
claude mcp add wp-database-mcp-server -- npx Query your database in natural language
автор: AnthropicRead-only database access with schema inspection.
автор: modelcontextprotocolInteract with Redis key-value stores.
автор: modelcontextprotocolDatabase interaction and business intelligence capabilities.
автор: modelcontextprotocolНе уверен что выбрать?
Найди свой стек за 60 секунд
Автор?
Embed-бейдж для README
Похожее
Все в категории data