Skip to content

WordPress Integration

When you run extract_wordpress_text, the server:

  1. Connects to your WordPress MySQL database
  2. Reads the post by ID — content, title, slug, and excerpt
  3. Creates a full backup of the post on disk
  4. Returns all translatable text in chunk format
  5. Waits for you to submit the translation

When you submit via submit_bulk_translation, the server:

  1. Matches chunks to the original structure
  2. Updates post_content, post_title, post_name (slug), and post_excerpt in the database
  3. Confirms the update

The original post is never modified until you explicitly submit the translation.


The server connects using environment variables. Set these before starting your MCP client.

VariableDefaultDescription
WP_MYSQL_HOSTlocalhostMySQL server hostname or IP
WP_MYSQL_PORT3306MySQL port
WP_MYSQL_USERMySQL username (required)
WP_MYSQL_PASSWORDMySQL password
WP_MYSQL_DATABASEDatabase name (required)
WP_TABLE_PREFIXwp_WordPress table prefix
WP_BACKUP_DIRcurrent dirDirectory where backups are saved

Create a .env file in the same directory as the divi-translator binary:

.env
WP_MYSQL_HOST=localhost
WP_MYSQL_PORT=3306
WP_MYSQL_USER=wordpress_user
WP_MYSQL_PASSWORD=strong_password
WP_MYSQL_DATABASE=wordpress_db
WP_TABLE_PREFIX=wp_
WP_BACKUP_DIR=/var/backups/divi-translations

WordPress posts have four fields that can be translated:

FieldMarkerNotes
Post content{{CHUNK_XXX}}Main Divi page content
Title{{POST_TITLE}}Shown in browser tab and page header
Slug{{POST_SLUG}}URL path — use hyphens, no spaces, no special characters
Excerpt{{POST_EXCERPT}}Short summary used in archives and SEO
POST METADATA (translate these too):
======================================
{{POST_TITLE}}
Welcome to Our Store
{{/POST_TITLE}}
{{POST_SLUG}}
welcome-to-our-store
{{/POST_SLUG}}
{{POST_EXCERPT}}
Discover our amazing products and services.
{{/POST_EXCERPT}}
CONTENT TO TRANSLATE:
=====================
{{CHUNK_001}}
<h2>Our Story</h2>
<p>We have been crafting...</p>
{{/CHUNK_001}}
{{POST_TITLE}}
Bienvenido a Nuestra Tienda
{{/POST_TITLE}}
{{POST_SLUG}}
bienvenido-a-nuestra-tienda
{{/POST_SLUG}}
{{POST_EXCERPT}}
Descubre nuestros increíbles productos y servicios.
{{/POST_EXCERPT}}
{{CHUNK_001}}
<h2>Nuestra Historia</h2>
<p>Llevamos años creando...</p>
{{/CHUNK_001}}

Before writing any changes to WordPress, the server saves a complete backup of the post.

Backup file format:

{WP_BACKUP_DIR}/post_{postId}_{timestamp}.txt

Backup contents:

POST ID: 42
BACKUP DATE: 2025-01-18 14:30:22
TITLE: Welcome to Our Store
SLUG: welcome-to-our-store
EXCERPT: Discover our products...
---
[et_pb_section fb_built="1" ...][et_pb_row ...][et_pb_text ...]
<h2>Our Story</h2>
...
[/et_pb_text][/et_pb_row][/et_pb_section]

Backups are plain text and can be used to restore a post manually via the WordPress admin or a MySQL query.


  1. Find the post ID in WordPress admin (Posts → hover over a post → the URL shows post=42)

  2. Ask Claude to translate:

    Translate WordPress post ID 42 to German.
    Use extract_wordpress_text, translate keeping all markers, then submit with submit_bulk_translation.
  3. Claude extracts the post — calls extract_wordpress_text with postId: 42 and targetLang: "de". The server creates a backup and returns the extractionId and text.

  4. Claude translates — no additional tool calls during translation.

  5. Claude submits — calls submit_bulk_translation with the extractionId and the translated text.

  6. Server updates WordPress — post title, slug, excerpt, and content are updated in the database.


The server can connect to any MySQL instance reachable from the machine running the MCP client. For a remote WordPress installation:

.env
WP_MYSQL_HOST=mysql.example.com
WP_MYSQL_PORT=3306
WP_MYSQL_USER=remote_user
WP_MYSQL_PASSWORD=remote_password
WP_MYSQL_DATABASE=wordpress_production