Skip to Content
TensorPass
Quickstart

WordPress

Add a chat that answers on the visitor's own AI to a WordPress site with the AI Connect plugin, as a block or a shortcode, with the site's posts served to it as an MCP server.

The AI Connect plugin for WordPress adds the chat of the Web Components to a site as a block and as a shortcode, and serves the site's published posts and pages as an MCP server. The visitor's model searches the site before it answers, on the visitor's own account through AI Wallet, so the site pays no inference and needs no build step.

You need WordPress 6.5 or later with PHP 8.1, and Chrome with AI Wallet installed and one account connected to try it.

Install the plugin

In WordPress, open Plugins, Add New Plugin, Upload Plugin, choose aiconnect.zip, then activate AI Connect. The plugin holds the Web Components script and loads it only on the pages that show a chat, deferred.

Add the chat with the block

In the editor, add the AI Connect Chat block. Its settings sit in the sidebar:

SettingWhat it sets
FormPopup, opened from a button (the default), Panel at the page edge, Inline, where the block sits or Full page.
HeadingThe chat's heading.
Button labelThe text of the button that opens a popup or a panel.
Question box placeholderThe placeholder of the question box.
Instructions for the visitor's AIWhat the visitor's model is told before the first question. Left empty, it answers from the site's posts and pages.

To show the chat on every page of a block theme, add the block to a template part, such as the footer, in Appearance, Editor.

Add the chat with the shortcode

Classic themes and page builders take the shortcode:

[aiconnect_chat variant="popup" launcher_label="Ask us" heading="Ask the club"]
AttributeWhat it sets
variantpopup (the default), panel, inline or page.
headingThe chat's heading.
launcher_labelThe text of the button that opens a popup or a panel.
placeholderThe placeholder of the question box.
systemThe instructions for the visitor's model.

The chat speaks the site's language when it is English, French, Hebrew, Arabic or Chinese, and English otherwise. A site in traditional Chinese gets the chat in simplified Chinese. Hebrew and Arabic lay it out right to left.

Offer the TensorPass sign in

A visitor without AI Wallet gets the wallet's install button and Sign in with OpenRouter in the chat's connection step, with no setting. To offer Sign in with TensorPass as well, get a site key for the site's domain and enter it in TensorPass site key under Settings, AI Connect. The plugin passes it to every chat as the site-key attribute. The key is public and also works on a local WordPress at http://localhost. The web accounts page describes both sign ins.

The sign in return page

The plugin ships the page the sign in window comes back to, at /wp-content/plugins/aiconnect/sign-in.html, and passes its address to every chat as the sign-in-callback attribute. A visitor who signs in to OpenRouter or TensorPass in the popup returns there with a code. The page runs finishSignIn() from aiconnect-callback.js, the 2 KB script the plugin carries beside the Web Components script: it hands the code to the chat that opened the popup and closes, and the chat trades the code for the visitor's key. When the browser keeps the window open, the page says the visitor can close it. The web accounts page describes the return page of any site.

The web server serves sign-in.html as a static file, so the popup loads no theme, no other plugin and no WordPress code. Its address carries no query string with pretty or plain permalinks, and the provider adds its code to it. The page must stay on the site's own origin, since the chat refuses a return page on another one: a site that serves wp-content from a CDN domain keeps /wp-content/plugins/aiconnect/sign-in.html served from its own domain. A server rule that blocks HTML files under wp-content/plugins blocks the sign in too, and needs an exception for this file.

The site's MCP server

The plugin serves an MCP server at /wp-json/aiconnect/v1/mcp, over Streamable HTTP in JSON. The block and the shortcode point the chat at it. It has two tools:

ToolInputReturns
search_postsquery, and limit from 1 to 10 (5 by default)Each match with its id, title, address, date and excerpt.
get_postidThe post or page with its text, up to 8,000 characters.

The tools return only what any visitor can read already: published posts and pages of the public post types, without a password. Drafts, private posts and protected posts stay out.

The same server works as a connector in the AI apps that take a remote MCP server, such as Claude and ChatGPT. To check it from a terminal:

curl -s -X POST https://example.com/wp-json/aiconnect/v1/mcp \
  -H 'Content-Type: application/json' -H 'Accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'

Test the plugin

integrations/wordpress/scripts/e2e.sh starts WordPress and MariaDB in Docker at http://localhost:5046 with the plugin, publishes a post and the pages with the chat, and runs the end to end tests: the MCP server serves the published posts only, the editor inserts the block with its settings, and a visitor with AI Wallet asks the chat and gets an answer from the site's posts.

The sign in tests run with pretty permalinks, then with plain ones. A visitor without AI Wallet clicks Sign in with OpenRouter, the popup opens https://openrouter.ai/auth with the return page as callback_url, and the test sends the popup back to the return page with a made up code. The popup closes, the chat sends the code and its PKCE verifier to OpenRouter's key exchange, OpenRouter refuses the code, and the chat shows "OpenRouter did not finish the sign in. Try again." The same passes after Google's OAuth page cuts the popup from the chat, and in a tab the browser keeps open. The stack and its volumes are removed when the tests end.

On this page