Skip to content

Commit ae84979

Browse files
committed
Expand documentation
1 parent 6edccb4 commit ae84979

File tree

4 files changed

+98
-3
lines changed

4 files changed

+98
-3
lines changed

docs/mcp-server/installation.md

+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
sidebar_position: 1
3+
---
4+
5+
# Installation
6+
7+
You can install the MCP Server plugin to turn any WordPress site into a fully functioning MCP server.
8+
9+
[![Download latest nightly build](https://img.shields.io/badge/Download%20latest%20nightly-24282D?style=for-the-badge&logo=Files&logoColor=ffffff)](https://mcp-wp.github.io/mcp-server/mcp.zip)
10+
11+
This WordPress plugin aims to implement the new [Streamable HTTP transport](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#streamable-http), as described in the latest MCP specification. It is supposed to work with any MCP client that supports this transport, but it has been tested mostly with the [WP-CLI AI command](https://github.com/mcp-wp/ai-command).
12+
13+
Under the hood it uses the [`logiscape/mcp-sdk-php`](https://github.com/logiscape/mcp-sdk-php) package to set up a fully functioning MCP server. Then, this functionality is exposed through a new `wp-json/mcp/v1/mcp` REST API route in WordPress.
14+
15+
## Usage
16+
17+
Install the latest version of the plugin, either via the link above or the following WP-CLI command:
18+
19+
```bash
20+
wp plugin install --activate https://github.com/mcp-wp/mcp-server/archive/refs/heads/main.zip
21+
```
22+
23+
Then, go to Users -> Profile in your WordPress admin and create a new application password.
24+
25+
After that, you can add the MCP server to your WP-CLI config like so:
26+
27+
```bash
28+
wp mcp server add "mysite" "https://johndie:yourapplicationpassword@example.com/wp-json/mcp/v1/mcp"
29+
```
30+
31+
To verify that it works as expected, you can run something like this:
32+
33+
```bash
34+
wp ai --skip-builtin-servers "List my most recent posts"
35+
```
36+
37+
`--skip-builtin-servers` ignores the MCP server of your local installation so that only the remote one is connected to.
38+
39+
Example using cURL:
40+
41+
```bash
42+
curl -i -X POST -H "Content-Type: application/json" http://johndoe@yourapplicationpassword:example.com/wp-json/mcp/v1/mcp -d '{"jsonrpc":"2.0", "method":"initialize", "id": "0"}'
43+
```
44+
45+
## Testing
46+
47+
You can also test this plugin's functionality with the [MCP Inspector](https://github.com/modelcontextprotocol/inspector), which is a developer tool for testing and debugging MCP servers.
48+
49+
For this purpose, the plugin also supports authentication via the `Authorization` header, so you can pass the application password like so:
50+
51+
```http
52+
Authorization: Bearer johndoe:yourapplicationpassword
53+
```
54+
55+
Example using cURL:
56+
57+
```bash
58+
curl -i -X POST -H "Content-Type: application/json" -H "Authorization: Bearer johndoe:yourapplicationpassword" http://example.com/wp-json/mcp/v1/mcp -d '{"jsonrpc":"2.0", "method":"initialize", "id": "0"}'
59+
```

docs/mcp-server/reference.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ $server->register_tool(
1919
[
2020
'name' => 'calculate_total',
2121
'description' => 'Calculate the total amount'
22-
'callable' => function( $params ) {
22+
'callback' => function( $params ) {
2323
return $params['price'] * $params['quantity'];
2424
},
2525
'inputSchema' => [

docs/wp-cli/commands.md

+16
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,24 @@ wp ai <prompt> [--skip-wordpress]
1616
<prompt>
1717
AI prompt.
1818
19+
[--skip-builtin-servers]
20+
Skip loading the built-in servers.
21+
1922
[--skip-wordpress]
2023
Run command without loading WordPress. (Not implemented yet)
24+
25+
[--approval-mode]
26+
Approve tool usage before running.
27+
28+
[--service]
29+
Manually specify the AI service to use.
30+
Depends on the available AI services.
31+
Examples: 'google', 'anthropic', 'openai'.
32+
33+
[--model]
34+
Manually specify the LLM model that should be used.
35+
Depends on the available AI services.
36+
Examples: 'gemini-2.0-flash', 'gpt-4o'.
2137
```
2238

2339
**EXAMPLES**

docs/wp-cli/installation.md

+22-2
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,30 @@ sidebar_position: 1
66

77
Installing this package requires WP-CLI v2.11 or greater. Update to the latest stable release with `wp cli update`.
88

9-
Tip: for better on support of the latest PHP versions, use the v2.12 nightly build with `wp cli update --nightly`.
9+
Tip: for better support of the latest PHP versions, use the v2.12 nightly build with `wp cli update --nightly`.
1010

11-
To install the latest development version of this package, use the following command instead:
11+
To install the latest development version of this package, use the following command:
1212

1313
```bash
1414
wp package install mcp-wp/ai-command:dev-main
1515
```
16+
17+
Right now this package requires a local WordPress installation with the [AI Servicdes](https://github.com/felixarntz/ai-services) plugin active. That plugin is where you configure your LLM API key.
18+
19+
```bash
20+
wp plugin install --activate ai-services
21+
```
22+
23+
After that, within the local WordPress installation, you can run the first command:
24+
25+
```bash
26+
wp ai "Greet my friend Pascal" # uses the example "greet-user" tool
27+
```
28+
29+
You can use [dedicated commands](./commands.md) for adding local or remote MCP servers. For example:
30+
31+
```bash
32+
wp mcp server add "mysite" "https://example.com/wp-json/mcp/v1/mcp
33+
```
34+
35+
If you want to use MCP with another WordPress installation, install the [MCP Server WordPress plugin](../mcp-server).

0 commit comments

Comments
 (0)