Repository navigation
mcp start here
Status: Implemented
Last Updated: 2026-11-13
Audience: Developers and coding agents
Last verified: 2026-11-13 against b1688a8de (flags, script options, error codes and the short tool list checked in the source)
Code: src/Martlet.Mcp/Program.cs, src/Martlet.Mcp.Protocol/McpServer.cs, src/Martlet.Mcp.Protocol/McpServer.Discovery.cs, src/Martlet.Mcp.Protocol/Tools/StartTools.cs, scripts/Register-MartletMcp.ps1, scripts/Invoke-MartletMcp.ps1
Part of MCP in Martlet: the tools and screens of the Start here area of martlet_guide (connecting an assistant, the server, its flags, verifying changes and extending the server). The index lists the other pages.
Martlet.Mcp is a local stdio MCP server (Windows). It runs only when an
assistant starts it, never listens on a network port and works on the Martlet
data folder of the current Windows user (%LOCALAPPDATA%\Martlet).
- Run
.\scripts\Register-MartletMcp.ps1from a checkout. It builds the server, copies it to%LOCALAPPDATA%\Martlet.Mcp\server-<time>(so a running server never locks the checkout's build) and adds amartletserver to GitHub Copilot CLI and app (~\.copilot\mcp-config.json), Claude Desktop (%APPDATA%\Claude\claude_desktop_config.json) and VS Code (%APPDATA%\Code\User\mcp.json), for each one installed.-Client copilotchooses one,-ReadOnlyleaves changes off,-AllowUiEffectsadds--allow-ui-effects, and-Unregisterremoves the entry. Each run first copies the file to a new<file>.martlet-backup-<date>-<time>and prints its path; the first backup and the four newest are kept. A file with comments (VS Code'smcp.jsonmay have them) is left as it is unless you add-Force, because the rewrite removes the comments; the backup keeps them. - Restart the assistant.
- Ask it, for example: "Make a Martlet character called Ava, a cheerful
astronomer who speaks briefly, with the built-in look." The assistant starts
with
martlet_guide.
To configure a client by hand, give it the full path of Martlet.Mcp.exe:
{
"mcpServers": {
"martlet": { "command": "C:\\path\\to\\Martlet.Mcp.exe", "args": ["--allow-changes"] }
}
}| Flag | What it does |
|---|---|
--allow-changes |
Lets character_create, character_update, character_use, character_delete, settings_set, skill_directory_add, preferences_add, preferences_update, preferences_remove, game_state_correct and game_state_delete save, and memory_forget and memory_where change memory (their preview: true runs without the flag). It also lets the tools that write save or write: logs_export, character_picture with outputPath, kept_motions_check with a dataDirectory, character_eyes with save or forget, character_touch_zones and character_reaction_changes with save, discord_companion_check with requestFrom, thinking_speed_check with seedSlow and thinking_fallback_timing with seed. Tool permissions lists each tool. Without the flag they refuse and say how to turn it on. The FIXTURE saves also refuse Martlet's own data folder (%LOCALAPPDATA%\Martlet), and an output file is never on a network path or over an existing file. |
--allow-ui-effects |
Lets ui_* tools press buttons, type and toggle (see Local MCP control). Without it they only navigate and read. |
--all-tools |
Lists every tool. Without it, tools/list has only the short list of the tools an assistant needs most (much smaller, and under the 128-tool limit of some clients); every tool still runs by name. martlet_guide says how many tools there are and how many are listed. |
-
Instructions at
initialize: what Martlet is, where to start, the tool groups and which flags are on.serverInfohas the titleMartletand the Martlet version. -
The short list (24 tools):
martlet_guide,martlet_call,characters_list,character_find_looks,character_find_on_web,character_create,character_update,character_use,character_delete,settings_get,settings_schema,settings_set,doctor_status,doctor_list,doctor_run,logs_tail, and the window toolsui_connect,ui_snapshot,ui_click,ui_select,ui_set_text,ui_toggle,ui_set_rangeandui_scroll. The otherui_*tools (ui_type,ui_move,ui_tray,ui_long_texts) run by name. Each has atitleand MCP behavior hints (readOnlyHint,destructiveHint,idempotentHint,openWorldHint). -
martlet_guide(start here): what Martlet is, the server's state (version, flags, the data folder, whether the app runs now), the common tasks step by step (topic:overview,characters,settings,app,diagnose), every tool by area (topic: tools), a search over names and descriptions (search) and one tool's full description and input schema (tool). -
martlet_call: runs any tool by name with itsarguments, so the diagnostic and self-test tools that are not listed stay reachable. It returns that tool's result as is.
A character is a personality (a persona: its name and the instructions that say who it is and how it talks) and its character profile (Companion › Profiles), which adds a look (the built-in character or one of the shared character models) and a voice (one of the speaking voices). The tools change them with the same settings code that Personality and Profiles use. They return names and, when asked, the personality text, because they edit them.
-
characters_list(includeText): every personality with its profile, which one Martlet is now, the looks and voices a profile can use, and the limits (1,000 personalities, 1,000 profiles, 100,000 characters each and 1,000,000 together). -
character_create:nameandpersonality, orcardPath(an absolute path to a SillyTavern, Chub or other Tavern character card: PNG, JSON or CHARX, read like Personality's import; its keyword lorebook entries are kept in a lorebook for the new personality).look(builtinor a look's name or ID) andvoice(a voice's name or ID) go on its profile.profile: falsemakes only the personality. Martlet becomes the new character unlessuseis false. -
character_update(character: a name, ID or profile key):name,personality,lookandvoice(keepkeeps whatever Martlet uses now). A character without a profile gets one when it gets a look or a voice. -
character_use: Martlet talks with that personality from its next reply. -
character_delete: removes the personality and its profiles, or only the profile withprofileOnly. Martlet keeps at least one personality. -
character_find_looks(query,count,sources:vroidhub,osa): looks (VRM models) online for a character you name, as Find a character finds them (see Find a character online): the linked VRoid Hub account's own and hearted models, VRoid Hub models whose creators let anyone use them, and Open Source Avatars' free models. Each has its creator, source, license, every condition of use,usable, a picture and page address, and itslookkey. Give that key aslooktocharacter_createorcharacter_update:vroidhub:<id>is checked on VRoid Hub and its credit kept for the app (the app shows it from VRoid Hub, never saved);osa:<project>/<avatar>is downloaded and joins the owner's characters. Only the query goes to VRoid Hub and GitHub. -
character_find_on_web(query,models,voices): the backup finder. Web pages (from DuckDuckGo) that may have a model of the character or recordings of its voice, and searches on the sites that have them, with the next steps. Martlet downloads nothing from them: the owner does, and adds what they may use in the app (Add a character, Add a voice). -
vroid_hub_status(withmartlet_call): whether this build can link VRoid Hub, whether an account is linked for the account whose settings the data folder holds (its VRoid Hub user name, never a token), the VRoid Hub looks this PC used with their conditions of use, and whether the character shown is one.
A profile's look and voice change on this PC when the profile is used in the
app (they need the character window and the voice hosts). So
character_create, character_update and character_use return followUp
with the steps: Companion › Profiles › Use, or ui_connect, ui_click
NavCompanion, CompanionTab-Profiles and CharacterProfileUse-<key> (with
--allow-ui-effects). New looks (Live2D or VRM models) and new voices (from a
recording) are added in the app: Companion › Character and Companion › Voice.
Companion › Character › Find a character... (CharacterFinderOpen, a safe
click) opens Find a character (CharacterFinderWindow): its status lines
(CharacterFinderStatus, CharacterFinderVRoidHub,
CharacterFinderPersonalityState, CharacterFinderResults,
CharacterFinderWebModels, CharacterFinderWebVoices) and each look's
CharacterFinderAbout-<n>, CharacterFinderConditions-<n> and
CharacterFinderState-<n> and each web page's CharacterFinderWebAbout-<model|voice>-<n>
are safe values (never the typed name, notes or personality). Close
(CharacterFinderClose) and Add a voice clip you downloaded...
(CharacterFinderAddVoice, which only opens Companion › Voice) are safe clicks;
Search, Write again, the web searches, Link VRoid Hub, Open, Add a model and Use
need --allow-ui-effects. Companion › Character's VRoidHubState and the Account
page's AccountVRoidHubState say whether VRoid Hub is linked; the Account page's
AccountVRoidHubLink and AccountVRoidHubUnlink need --allow-ui-effects.
-
settings_get(path, for examplegenerationorcompanion.personas[0].name): settings.json or one part of it, itsrevision, and without a path the parts with what each holds and whether it can change here. Before the first save it shows the defaults (first-run). -
settings_schema(path,depth): the JSON schema of that part (property names, types and allowed values), generated from Martlet's settings types. -
settings_set(path,value, optionalrevision): changescompanion,generation(Companion › Replies),prompts(Companion › Prompts; seeprompts_statusthroughmartlet_callfor the prompt IDs) andmemory.nullremoves a value, which puts an optional value back to its default. The change is checked by Martlet's own settings contract and saved by its settings store (write lock, revision check, atomic write). A changed personality or memory choice gets a fresh configuration revision, as the pages give it. Serializer errors name the part that doesn't fit. -
setup(where Martlet thinks, listens and speaks),thinking_fallback,audio,profileandschema_versionare refused: they hold destinations, the owner's consent and credential references, so they change only in the app, with the owner.
With accounts, settings.json holds the settings of the person signed in on this PC, so changes go to that person.
The desktop watches settings.json. About 0.6 seconds after it changes and Martlet
is not busy with Setup, it reads it again (the desktop log says settings.json changed; Martlet read it again.), so Home, the open Companion page and an open
conversation (before its next reply) use the change without a restart. The
desktop's SettingsChanges knows where each version came from (a page's own
save, a setting taken from another computer, an account switch or the file): a
version Martlet already applied is not read again, and the log line is written
only for a change this Martlet didn't make (its MCP server or an edit by hand).
- Windows only, for the current Windows user.
- The copy that
Register-MartletMcp.ps1makes runs every tool except the developer self-tests that startMartlet.NodeLinkCheckorMartlet.Companionfrom a checkout; run those withscripts\Invoke-MartletMcp.ps1. - The installer does not include
Martlet.Mcpyet; build it from a checkout.
Martlet.Mcp is a local stdio Model Context Protocol server. It does not listen
on a network port, start the desktop, or activate a provider, microphone or
speaker on launch. Configure an MCP client to start the Windows executable
built from src\Martlet.Mcp (scripts\Register-MartletMcp.ps1 does it for
assistants, see Use Martlet from an AI assistant;
for development: src\Martlet.Mcp\bin\Release\net10.0-windows\Martlet.Mcp.exe).
The server speaks newline-delimited JSON-RPC 2.0 on standard input/output;
stderr is for diagnostics. Tool calls run one at a time, in the order they
come, but the server keeps reading while one runs: ping, tools/list and
initialize answer at once, and notifications/cancelled with a call's
requestId stops that call (running or waiting); a cancelled call gets no
response. A tool that fails returns a result with isError: true and a short
message, and the server keeps running. Only a request line that is not JSON
gets -32700 (parse error); an invalid request gets -32600 and any other
server problem -32603. It takes the flags --allow-changes,
--allow-ui-effects and --all-tools in any order. The installer does not
include it yet. Build locally with:
dotnet build src\Martlet.Mcp\Martlet.Mcp.csproj -c ReleaseFor example, a client configuration with an absolute executable path:
{
"mcpServers": {
"martlet": {
"command": "C:\\path\\to\\Martlet.Mcp.exe",
"args": []
}
}
}Every new feature or behavior change is verified on the dev machine through
this server before merge, whenever the machine can exercise it, alongside the
targeted tests (the policy is in AGENTS.md
and the whole flow in Validating changes).
scripts\Invoke-MartletMcp.ps1 runs this checkout's Martlet.Mcp, sends a list
of tool calls in order and prints one JSON array of results; it exits 1 if any
call fails or an until is not met.
# Headless: Doctor against a fresh disposable data directory
.\scripts\Invoke-MartletMcp.ps1 -Build -Calls '[{"name":"doctor_status"}]'
# UI: launch a disposable desktop, connect, navigate and poll until it shows
.\scripts\Invoke-MartletMcp.ps1 -Build -Desktop -Calls '[
{"name":"ui_click","arguments":{"id":"TourSkip"}},
{"name":"ui_click","arguments":{"id":"NavSettings"}},
{"name":"ui_snapshot","until":"AutomaticUpdateCheck"}]'- Each call is
{"name", "arguments"}plus optionalwaitMs(pause after it;ui_click,ui_select,ui_set_text,ui_toggle,ui_moveandui_scrolldefault to-WaitMs, 300 ms) anduntil(repeat the call for up to 20 seconds until its result text contains that string).-Callsalso takes a path to a JSON file. - Calls whose tool takes a
martletDirectory(the voice and listening checks) and give none use this checkout's Desktop build when it is built. - Calls whose tool takes a
dataDirectory(its input schema intools/list, which the script reads from the server with--all-tools) and give none get the script's disposable data directory, so no tool reaches the real profile by default and a new tool is covered without a list in the script.-Desktopalso uses that directory, so Doctor sees the desktop's settings andlogs_tailits logs. The directory and the desktop are removed at the end. -
-KeepDesktopleaves the desktop running and prints its-DesktopProcessIdand-DataDirectoryfor follow-up runs; stop it and delete the directory when done.-DesktopArgumentsadds launch flags after the data directory (for example'--tray'to start in the notification area). -
-DesktopProcessIdconnectsui_*tools to a desktop that is already running (for example one that-KeepDesktopleft); it cannot be used with-Desktop. -
-LabCredentialskeeps pairing secrets in a folder inside the data directory instead of Windows Credential Manager, and keeps finds of hosts on the home network on loopback, for the lab tools such assignin_labandrole_lab. -
-TimeoutSeconds(default 120) is how long the script waits for each MCP response. -
-AllowUiEffectspasses--allow-ui-effects(disposable data and no real credentials only; it never authorizes spending, provider requests, credential handling, audio capture/playback or data disclosure). -
-AllowChangespasses--allow-changes, socharacter_*andsettings_setsave (see Tool permissions for the others),memory_forgetdeletes and the tools that write (asave,forget,requestFrom,outputPathorlogs_export;kept_motions_checkwith the disposabledataDirectory) write; without an explicitdataDirectorythey use the disposable data directory, andmartlet_callpasses it to the tool it runs. -
-BuildbuildsMartlet.Mcp(andMartlet.Desktopwith-Desktop) in-Configuration(default Release) with thedotnetthat has the SDK pinned inglobal.json(found the same way asscripts\Test-Martlet.ps1, including the developer profile'sdotnet).
Check the outcome the change should produce (status values, control states, Doctor probes), not only that calls succeeded. What the machine cannot exercise (locked desktop, missing hardware, credentials, paid services, another OS) is reported as NOT RUN with the reason.
New features extend the server in the same change, so that MCP can reach and observe them:
-
Controls: give every new interactive control and status field a stable,
unique
AutomationProperties.AutomationId(ui_snapshotlists controls by ID; duplicates fail as ambiguous). -
Passive clicks: add navigation, open/close, refresh and expand controls
that start no work to
SafeClicksinsrc\Martlet.Mcp.Protocol\AutomationPolicy.Clicks.cs(orSafeClickPrefixesfor a family of generated IDs such asCompanionTab-andNode-). A passive click may read this PC, ask the local network a discovery question that carries none of your data, and stop what Martlet does at this moment (a reply, a song). Anything that sends, records, plays, spends, writes files, handles credentials, contacts another computer by its address (a host, a ComfyUI server, a cloud provider), cancels a background job or pauses Martlet stays behind--allow-ui-effects.AutomationPolicyTestschecks the effect texts for these words. -
Status: add read-only, non-secret status fields to
SafeValues(orSafeValuePrefixes) inAutomationPolicy.Values.csso snapshots return their text (a value pattern's value, a text block's text, or a status button's accessible name). Never expose editable fields, credentials, personal data or file paths.ui_snapshotalso replaces every e-mail address with[email]and every file path with[path]in the text it returns (AutomationPolicy.Redact). -
One line for each ID: write each entry as
new("<ID>", "<page>", "<what it does or shows>"), for examplenew("CheckInsOpenPool", "Companion › Check-ins", "Only opens Companion › Background thinking."). Say why it is safe ("saves nothing", "never the key"). Name controls that you leave out on purpose in a comment line next to it (// Needs --allow-ui-effects: ...or// Never returned: ...). -
Headless capabilities: add a
Tool(...)registration to the file of the tool'smartlet_guidearea,src\Martlet.Mcp.Protocol\Tools\<Area>Tools.cs(for exampleVoiceTools.csorThinkingTools.cs;McpServer.ToolGroupslists them). A registration is the tool's name, description, input schema (strict, bounded arguments, ID-based results), handler and, when it needs one, itsToolPermission(Changesmakes the server refuse it without--allow-changes). Put code that only that tool uses in the same file, or in a part next to it (<Area>Tools.<Feature>.cs, such asNetworkTools.Labs.cs) when the file grows past about 800 lines. Or add a Doctor probe thatdoctor_runreaches. -
Fixtures: a check that stands in for a model, a web site or a service on
127.0.0.1 uses
LoopbackHttpServerinsrc\Martlet.Mcp.Protocol\Fixtures(it reads Content-Length and chunked requests and answers whole, server-sent events or chunked), withFixtureChatfor Chat Completions answers. Do not write another socket server. -
Errors: throw
ArgumentExceptionfor wrong arguments,InvalidOperationExceptionwhen Martlet is not in a state for it, orMcpToolExceptionfor any other expected failure; the assistant gets the message as the tool's error. An area whose code throws exceptions of its own projects names them inMcpServer.ToolGroups(Expecting). Any other exception comes back with its type name, and the server keeps running. Keep tools local, read-only by default and free of network, audio and credential effects unless gated like--allow-ui-effects(or, for tools that save the owner's settings,--allow-changes). Begin each description with one sentence that says what the tool does:martlet_guideshows it as the tool's summary and searches the description. -
Tools for assistants: a tool that an assistant needs to use or configure
Martlet also goes in
Listedinsrc\Martlet.Mcp.Protocol\McpServer.Discovery.cs(with a title and behavior hints), and in a recipe ofmartlet_guidewhen it starts a common task. Keep the short list small: other tools run throughmartlet_call. -
Docs: update the page of the tool's
martlet_guidearea indocs/mcp/(the index lists them) with the new tools, IDs and status fields. Write each tool's name asname:McpDocsAgreementTests(Martlet.Desktop.Tests) fails when a tool is not named on any of these pages, or when a page names a tool (ui_*,*_status,*_check,*_selftest...) that the server does not have.
Martlet: download · repository · changelog · issues
These pages come from docs/wiki in the repository. To suggest a change, open an issue or a pull request there.
- Home
- Accounts and households
- Accounts and Household
- Android phones and tablets: what it takes, and the plan
- Martlet's API for other apps and scripts
- App Guides
- App Settings and Updates
- App guides: game and app knowledge from the web
- Architecture
- Bounded PCM playback
- Audio dependency inventory and notices
- Avatar guide: Live2D, VRM and speech animation
- V01a explicit microphone capture
- Chatterbox voice engines
- Cleaning up disk space
- One Martlet on all your computers
- Companion controls and behavior requirements
- Components, jobs and placement (design)
- Live conversation
- Creations
- Decision map: which file owns each decision
- Deep research: web search and long research jobs
- The desktop app: updates, notification area, exiting and appearance
- Linux and macOS desktop companion: research, decision and plan
- Developer Guide
- Dia voice engine
- Diagnostics
- Discord
- Architecture and provider contracts
- Discord
- Memory (P03a/P03b/P03c)
- Singing
- Desktop troubleshooting and local support
- Recognizing people by voice, and Parakeet
- Echo cancellation
- ElevenLabs voice: your cloned voice with tones
- F5 worker and reference-voice foundation
- FAQ
- First Steps
- Game state plan: implementation history
- Glossary: one name for each concept
- GPT-SoVITS voice
- Hosted Thinking: cloud models when Thinking can't run on this PC
- Installation and support
- Installing Martlet
- iOS and iPadOS: what it takes, and the plan
- Repository instructions for coding agents
- Repository knowledge base
- Knowledge base maintenance
- GitHub Wiki mirror
- Linux and Mac
- Listening and Voice ID
- Local model apps
- Lorebooks
- macOS: what it takes, and the plan
- Martlet MCP Server
- MCP in Martlet
- MCP: The app's window
- MCP: Apps, home and memory
- MCP: Characters
- MCP: Diagnostics and logs
- MCP: Computers, network and accounts
- MCP: Other
- MCP: Tool permissions
- MCP pages
- MCP: Server and protocol internals
- MCP: Settings
- MCP: Start here
- MCP: Thinking and models
- MCP: Voice and listening
- Memory
- Messaging apps
- Model catalog: sources, conflicts and design
- Motion host role
- Multiple Computers
- Your Martlet network
- OCR host role
- Share your language models: the OpenAI-compatible endpoint
- Packaging
- Perception worker contracts
- Personality and Characters
- Picture making
- Pictures and Creations
- Picture making host role
- Platforms: what each device can do
- Prerequisites: what Martlet bundles, installs for you, or needs from you
- Privacy and Safety
- Reading the text on your screen
- Wiki source
- Recommendation design: ask three questions, plan for three situations
- Recommended setups: one machine to unlimited budget
- Releasing
- Repository Layout
- Research and provenance ledger
- Resource footprints
- Roadmap
- Watch my screen: screen-aware commentary
- Search engine
- Image and audio models: who sees, who hears, who answers
- Setting Up a Host
- Setup, Windows credentials and local audio
- Sharing with Friends
- Singing
- Smart Home
- Smart home and cameras
- Source Projects
- Talking to Martlet
- Telegram and WhatsApp
- The Character
- Thinking
- Tools and MCP
- Troubleshooting
- Martlet desktop UI design
- User stories and target flows
- Voice activity detection
- Validating changes
- Validation and Testing
- Vision
- Voice latency: from you stopping talking to Martlet's voice
- Voice recognition host role
- Multi-engine voice setup and comparison
- Voices
- The welcome wizard
- XTTS-v2 voice engine