Code samples for your WP MCP integration to Gemini using Postman


Thank you so much for watching the video.

Here are the code samples and references used throughout the tutorial to help you follow along and set up your WooCommerce MCP integration successfully.


Code To Initialize (First Request)

You must send this exact HTTP header with every request to:

https://yourstore.com/wp-json/woocommerce/mcp

Header Name:X-MCP-API-Key

Header Value:ck_xxxxxxxxxxxxxxxx:cs_xxxxxxxxxxxxxxxxxxxxxxxxxx

(Consumer Key + colon : + Consumer Secret — no spaces)

{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"protocolVersion": "2024-11-05",
"capabilities": {},
"clientInfo": {
"name": "Postman-Test",
"version": "1.0"
}
}
}

After sending, check the Response Headers (in Postman, go to the Headers tab under the response).

Look for a header named mcp-session-id (or Mcp-Session-Id).

Copy that value. Send Initiation again

Code To Get List tools

{
"jsonrpc": "2.0",
"id": 3,
"method": "tools/list",
"params": {}
}