Hachidori MCP
Integrates with Anki through Hachidori Relay to support Hachidori's dictionary sharing and Anki configuration, including changing deck settings and template fields.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Hachidori MCP Set up French with English definitions."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Hachidori MCP
Let your AI configure Hachidori:
Set up French for me, then make a userscript that highlights the popup's first definition.
The AI writes the script and calls this server's tools to install it. Settings, language profiles and dictionary imports go through Hachidori's own validated, revisioned save paths. This server does not edit browser profile files or execute generated JavaScript in Node.
Requirements
Node.js 22.15 or later.
Hachidori with the
mcp-configuration-v1capability. The companion extension change is in Hachidori PR #746. Until that change ships, load the extension from that PR.Hachidori Relay, installed in Anki, with Anki and your sharing browser open. The existing relay is sufficient; this server does not need a new Anki add-on build or AnkiConnect.
Settings → Sharing must say Sharing through Anki. Hachidori starts sharing once it has a dictionary: on an empty installation, first import one dictionary in Hachidori. Only one browser can be the sharing host on a relay port.
Related MCP server: perch-mcp
Install and connect
git clone https://github.com/bee-san/hachidori-mcp.git
cd hachidori-mcp
npm ciAdd this to your MCP client's server configuration (for example Claude Desktop, Cursor, or another client that can launch a local stdio MCP server):
{
"mcpServers": {
"hachidori": {
"command": "node",
"args": ["/absolute/path/to/hachidori-mcp/src/cli.js"]
}
}
}Use your actual absolute path; on Windows it can be
C:/Users/you/hachidori-mcp/src/cli.js. Restart the client after adding it.
No build step or AI API key is needed. This server uses stdio, so it belongs
on the computer that can reach your relay; it is not a hosted HTTP connector URL.
Only MCP messages are written to stdout during normal operation.
The default relay is ws://127.0.0.1:8771/link. If you changed the sharing port,
add an environment entry to the server configuration:
"env": { "HACHIDORI_RELAY_URL": "ws://127.0.0.1:8871/link" }An explicitly configured network relay also works if the host's Also with my other computers switch permits it. The relay's existing access rules apply; there is no additional MCP HTTP listener or independently exposed settings API.
What you can ask
“Set up French with English definitions.”
“Use German, but keep my Japanese settings.”
“Make the popup wider and turn off autoplay.”
“Change my French Anki deck to French Mining.”
“Make a CSS userscript for the popup, and install it.”
“Edit that userscript, disable it, or remove it.”
“Import this Yomitan ZIP into my French profile.”
setup_language accepts names and codes from the host's live language registry.
It adds a missing profile, enables Multiple languages, imports a dictionary if
there is no enabled term dictionary, and selects it on the sharing browser.
English definitions are the default. It resolves availability from
Wiktionary-to-Yomitan's live catalogue
using that project's documented download layout. Supply dictionaryUrls to use
other HTTPS Yomitan ZIPs, or [] to prepare only the profile. A repeat setup uses
an existing usable dictionary. The other browsers linked to Hachidori retain
their own lookup-language selections.
Generated JavaScript is compiled to check syntax, then saved as a Hachidori userscript. Chrome's Allow User Scripts or Firefox's Allow user scripts permission must be enabled by the user once. Reload open pages after changing JavaScript. CSS applies to the next popup and needs no user-script permission. Saving a script is distinct from proving it has run on a particular page. The server provides the AI a userscript guide, both as a tool and an MCP resource.
Tools
Tool | Purpose |
| Current settings, profile, revisions and userscript registration; optional key filter |
| Live defaults, valid enum choices, ranges, scope, themes and pack settings |
| Patch settings or pack settings using the latest revision |
| Supported packs and configured profiles |
| Add, provision and activate a language |
| Select the host's existing profile and automatic switching |
| Installed dictionaries for a profile |
| Stream an HTTPS download or local ZIP through the relay's chunk upload |
| IDs, names, sizes and optional source code |
| Add, edit or toggle one script without replacing the others |
| Delete one saved script |
| Authoring API, CSS scope, permission and reload rules |
The configure-language prompt combines setup with an optional userscript
request. hachidori://userscript-guide is the corresponding guide resource.
Writes and failures
Read settings first. For settings and scripts, pass the returned revision as
baseRevision; language selection instead uses selection.revision. A stale
revision is refused, so an open Settings tab is not silently overwritten.
Nested objects merge, arrays replace, and omitted values stay as they were.
Use the dedicated script tool instead of replacing the userScripts array.
Credentials are redacted in tool results and merged on the host, so the AI need
not receive or repeat existing Anki keys. Never send a redaction placeholder
back as a setting value. Anki flat fields update the first Template; a supplied
anki.templates array replaces the complete Template list.
Failed tools return MCP isError. Disconnects and timeouts after a write say
that its outcome is unknown; the server never automatically replays a write.
Read current state before retrying. Language setup reports completed steps if a
later download or save fails; successful earlier steps remain applied.
Dictionary downloads stream through a temporary file which is removed on
success or failure. They are imported in chunks on one relay session, with
replace: false by default. A catalogue request has a 30-second deadline;
imports have a five-minute deadline. For large dictionaries, configure your
MCP client's tool timeout to allow that time. Local source files are never removed.
The server ignores relay storage snapshots and broadcasts instead of returning
personal dictionary text, lookup history or known-word lists to the AI.
If connection fails, check Anki, the browser and Settings → Sharing. An older Hachidori gets an explicit compatibility error. If script registration is unavailable, enable the browser permission and reload the page.
Development
npm ci
npm run check
npm test
npm pack --dry-runThe tests use the official MCP client against the shipped stdio CLI and real WebSocket connections. The optional end-to-end suite also uses the actual Python relay and Chromium extension, with fixture dictionaries:
# Check out compatible hachidori and hachidori-anki beside this repository.
npm ci --prefix ../hachidori/test/tooling
node ../hachidori/test/run.mjs install-chrome
npm run test:integrationSet HACHIDORI_PATH, HACHIDORI_ANKI_PATH, or HACHIDORI_CHROME for other
locations. The integration suite creates a temporary browser profile and does
not touch your existing installation. CI pins the compatible extension commit;
advance that pin when changing the bridge protocol.
GPL-3.0-or-later. Dictionary and generated-script licences are independent.
Available Tools
12 toolshachidori_delete_userscriptADestructive
Delete one installed userscript by ID. Reload open pages to stop code that already ran.
Inputs: id (required), baseRevision (required).
hachidori_describe_settingsARead-only
Discover valid setting keys, defaults, global/profile scope, numeric ranges, language requirements and experimental flags from the installed Hachidori. Do not invent settings.
Inputs: keys, profileId.
hachidori_get_settingsARead-only
Read current settings and revisions. Credentials are redacted. Optional keys reduce output. selection.revision is for select_language; revision is for settings and scripts.
Inputs: keys, profileId.
hachidori_import_dictionaryADestructive
Import a Yomitan ZIP from an HTTPS URL or absolute local path into the requested profile. Supply exactly one source. replace=false preserves an installed dictionary with the same title by adding a separate copy.
Inputs: profileId (required), url, path, replace.
hachidori_list_dictionariesBRead-only
List dictionaries installed for a language profile.
Inputs: profileId.
hachidori_list_languagesARead-only
List supported language packs and existing profiles from the sharing host.
Inputs: no named parameters.
hachidori_list_userscriptsARead-only
Read installed scripts, stable IDs, revision and browser registration state. Scripts are global across languages. includeCode=false returns names and sizes only.
Inputs: includeCode.
hachidori_save_userscriptA
Create or patch one userscript, preserving others and its position. Omit id for a new script (provide name); reuse an existing id to edit or toggle. JavaScript is syntax-checked without execution. Read the guide first. Reload pages to run changed JavaScript.
Inputs: baseRevision (required), id, css, name, +2 more.
hachidori_select_languageAIdempotent
Select an existing language for lookups on the sharing HOST browser. Multiple languages must be enabled. Use selection.revision as baseRevision. Linked browsers keep their own selection.
Inputs: profileId (required), baseRevision (required), autoSwitch.
hachidori_setup_languageA
Set up a language by name or code (e.g. French/fr): create its profile, enable multiple languages, install a Wiktionary dictionary if it has no usable dictionary, then activate it on the host. English definitions by default. Explicit dictionaryUrls override the default; [] skips downloads. Partial progress is reported on failure.
Inputs: language (required), activate, dictionaryUrls, definitionLanguage.
hachidori_update_settingsAIdempotent
Patch settings using the latest revision. Objects merge recursively; arrays replace. Supports reading, appearance, theme, audio and Anki settings plus language pack settings. Use save_userscript for script edits.
Inputs: options (required), baseRevision (required), profileId, packSettings.
hachidori_userscript_guideARead-only
Read the userscript API, popup events, shadow DOM, CSS scope and permission/reload requirements before writing a script.
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 12 tools
Most tools have clearly distinct targets: settings vs. languages vs. dictionaries vs. userscripts. However, describe_settings/get_settings both read settings, and setup_language/select_language both affect the active language, so an agent could occasionally misselect despite the explanatory descriptions.
All tools use the hachidori_ prefix and snake_case, with a mostly consistent verb_noun pattern (describe_settings, update_settings, list_dictionaries, save_userscript). The main deviation is hachidori_userscript_guide, which is noun-based rather than verb-based.
The 12 tools are well-scoped for a browser-extension settings/language/userscript server. Each tool maps to a meaningful operation, and the set is neither too thin nor bloated.
Core workflows are covered: settings inspection/update, language setup/selection, dictionary listing/import, and userscript list/save/delete plus a guide. Minor lifecycle gaps exist, such as no explicit dictionary deletion or language/profile disable operation.
Related MCP Connectors
Use your own Windows, Mac or Linux computer from ChatGPT, Claude, Cursor or Gemini CLI: run commands, read, write and search files, run long processes. Your computer only makes an outgoing connection (no open ports or VPN). Read-only mode, allowed folders, blocked commands and an action log keep you in control. Free plan available.
Connect ChatGPT, Claude, Cursor or VS Code to your Windows PC: files, terminal, browser, apps.
Persistent memory, hybrid search and a goal graph for AI agents, over stdio or remote HTTP.
Use your Mac, Windows or Linux computer from ChatGPT, Claude or Codex: files, commands, documents.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables an AI agent to run local tools on the user's own machine via stdio, including command execution, workspace file read/write, and system status checks.52MIT
- AlicenseBqualityBmaintenanceGives AI agents bidirectional control of a Perchance.org generator: reading and editing its source, running eval, driving the live UI, and reading console/errors. It also offers a fast browser-free path for pulling and searching generator source, all through 27 tools over stdio.276MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI chatbots to act like coding agents on your own computer by executing code, editing files, running terminal commands, and performing Git operations through a secure cloud bridge. Supports token-based pairing, path sandboxing, and configurable approval for destructive actions.MIT
- AlicenseNot gradedqualityAmaintenanceConnects web AI chats and local clients to your own machine through one OAuth-gated MCP endpoint, exposing 38 governed tools for files, shell commands, search, Git, SQLite, browser automation, DevTools, background tasks, localhost services, clipboard, notifications, ports, and Postman control. It lets assistants build and edit projects, inspect databases and local APIs, drive browser workflows, and manage long-running jobs without handing every client unrestricted shell access.MIT