AI agents
wmpy mcp lets an AI coding agent such as Claude Code, Cursor or Copilot write, check, run and test WM Keyboard plugins with the tools the editors use.
wmpy mcp is an MCP server. It gives an AI
coding agent the plugin editor’s tools: the checks, the API reference, the
plugin running headless with pretend answers for the internet, the tests and
the packer. With it, an agent can write a plugin, see what its panel draws,
click through it, and fix what the checks find, without a phone.
Everything runs on your computer. pip_check and pip_install download
from PyPI. measure_budget, profile_plugin and record_mock run the
plugin with real https to the hosts its plugin.json lists, as
wmpy run does. No other tool uses
the network.
Install wmpy
Section titled “Install wmpy”Build it from the WM Keyboard source with Rust, as for the language server:
git clone https://github.com/wasi-master/wmkeyboardcd wmkeyboard/native/wmpycargo install --path .Add it to your agent
Section titled “Add it to your agent”wmpy mcp setup <client> prints what to add. With --write it merges the
server into the client’s config file, keeps everything else in it, and saves
the old file beside it as *.wmpy-backup.
claude mcp add wmpy -- wmpy mcpThat adds it for you alone. To share it with everyone who works on the
project, write it into the project’s .mcp.json:
wmpy mcp setup claude --writewmpy mcp setup cursor --writeThis adds the server to ~/.cursor/mcp.json:
{ "mcpServers": { "wmpy": {"command": "wmpy", "args": ["mcp"]} }}Run this in your project folder:
wmpy mcp setup vscode --writeIt writes .vscode/mcp.json, which Copilot’s agent mode reads:
{ "servers": { "wmpy": {"type": "stdio", "command": "wmpy", "args": ["mcp"]} }}wmpy mcp setup windsurf --writeThis adds the server to ~/.codeium/windsurf/mcp_config.json, under
mcpServers.
wmpy mcp setup zedZed keeps its MCP servers in settings.json, under context_servers:
"context_servers": { "wmpy": {"command": "wmpy", "args": ["mcp"], "env": {}}}Zed’s settings file usually has comments, which rewriting it would lose, so
--write refuses a file with comments. Paste the block yourself, or use
Add Server in Zed’s agent settings.
When the wmpy your shell finds is not the one you ran, the printed config
uses its full path. Pass --command /path/to/wmpy to choose another.
Restart the client, or reload its MCP servers, to pick up the change.
What the agent gets
Section titled “What the agent gets”| Tool | What it does |
|---|---|
new_plugin | Makes a plugin folder from a template, with wmpy new. |
check_plugin | Checks the Python and plugin.json without running anything. Each problem has its file, line, column and code, and help names the fix when there is one. |
render_plugin | Loads the plugin, sends a list of events, and returns what the panel draws, every call it made to the keyboard, and what it saved. |
session_start, session_event, session_render, session_settle, session_transform, session_storage, session_calls, session_stop | Keeps a plugin running so the agent can tap through it one event at a time and look at it in between. |
run_tests | Runs test.py and tests/test_*.py with wmpy test. |
pack_plugin | Builds the .wmplugin file with wmpy pack. |
pip_check, pip_install | Checks a PyPI package for use in a plugin, and copies it in. |
api_lookup, api_search | Signatures, docs and permissions from the model the editors complete from. |
list_permissions | Every permission and its tier, with the risky ones marked. |
read_docs | These docs as Markdown: the API, plugin.json, permissions, testing, error messages and every check code. |
fix_plugin | Makes the fixes the checks offer, with wmpy check --fix. Risky permissions and new hosts wait for risky: true. |
plugin_permissions | Each permission and host the code uses, needed, unused or missing, with wmpy permissions. |
translations | Extracts, checks and counts the locales/ files, with wmpy i18n. |
measure_budget, profile_plugin | How close a run comes to the keyboard’s limits, and which functions take the time, with wmpy budget and wmpy profile. |
record_mock | Runs the plugin against the real services and writes their replies to a mock file, secrets redacted, with wmpy mock record. |
list_devices, push_plugin | Lists the phones adb sees, and installs the plugin on one with wmpy push. |
format_file | Formats a .py file the way the editors do. |
write_stubs | Writes type stubs of the wm package, with wmpy stubs. |
The same docs are also MCP resources (wmpy://docs/api,
wmpy://docs/plugin-json, wmpy://docs/testing and others), for clients
that let you attach them to a conversation.
Calls to the keyboard
Section titled “Calls to the keyboard”A plugin running here has no phone behind it. Each call it makes to the
keyboard, such as http.get or ai.ask, is answered from a mock that the
agent passes in, the same shape the test runner
uses:
{ "http.request": {"status": 200, "text": "{\"temp\": 21}", "headers": {}}, "ui.toast": null}A call with no answer raises NotImplementedError inside the plugin, and the
result lists every call made, so the agent can see what to add. The plugin
gets every permission it declares, as in the editors.
The server’s protocol
Section titled “The server’s protocol”The server speaks MCP over stdio, and both kinds of client: those that open
with the initialize handshake (revisions up to 2025-11-25) and those that
send the protocol version with every request (2026-07-28). It needs no
settings.
An example
Section titled “An example”You ask: “Make a WM Keyboard plugin that shows today’s weather for a city, from Open-Meteo.” With the server added, an agent works like this:
new_pluginwith the weather template, or a blank one, inweather/.api_searchfor “http” andread_docsforapi, to learnhttp.get,plugin.stateand the widgets.- Writes
main.pyandplugin.json. check_plugin. It reports thathttp.getneeds thenetworkpermission and thatapi.open-meteo.comis not inhosts. The agent adds both and checks again until nothing is left.render_pluginwith a mock forhttp.requestand a click on the refresh button, to see the forecast drawn.- Writes
test.pywith the same mock, andrun_testsuntil it passes. pack_plugin, and tells you where the.wmpluginfile is.
You install that file on the phone. network is a
risky permission, so the keyboard
asks you to allow it the first time the plugin uses it.
