Repository navigation
mcp server protocol
Status: Implemented
Last Updated: 2026-11-13
Audience: Developers and coding agents
Last verified: 2026-11-13 against b1688a8de (flags, error codes, limits and the tool registry; the list of check classes is by file name only)
Code: src/Martlet.Mcp/Program.cs, src/Martlet.Mcp.Protocol/McpServer.cs, src/Martlet.Mcp.Protocol/McpServer.Discovery.cs, src/Martlet.Mcp.Protocol/Tools/McpTool.cs, src/Martlet.Mcp.Protocol/Tools/StartTools.cs, src/Martlet.Mcp.Protocol/Fixtures, tests/Martlet.Desktop.Tests/McpDocsAgreementTests.cs
Part of MCP in Martlet. This page answers: how does the server read requests, how are tools registered, and where does a new tool go?
src/Martlet.Mcp/Program.cs starts the server on standard input and
output. It accepts --allow-ui-effects, --allow-changes and
--all-tools. Any other argument prints a usage line and exits with code 2.
Tool permissions tells what the first two flags allow.
- The server reads one JSON-RPC message for each line. A line over 1 MiB is refused.
- It answers
initializewith protocol version2025-06-18andserverInfo{name: "martlet", title: "Martlet", version}. - Error codes:
-32700bad JSON,-32600bad request,-32601unknown method,-32603internal error. An error text is cut to 2000 characters. - Tool calls run in the order they came. The server keeps reading while one
runs:
pingand the other methods answer at once.notifications/cancelledstops a running or waiting call, and a cancelled call gets no response.
- Each area has a file
Tools/<Area>Tools[.Feature].csinsrc/Martlet.Mcp.Protocol. It registers tools withMcpServer.Tool(name, description, props, [required], handler, permission). -
McpServer.ToolGroups()sets the order of the areas, and so the order of the ten area pages in this folder. -
tools/listreturns only the 24 tools inListed(with titles and hints) unless the server runs with--all-tools. Every other tool runs throughmartlet_call, which refuses to call itself. -
martlet_guideexplains each area (seeTools/StartTools.cs).
A check class (for example CheckInsCheck.cs or HelperJobsCheck.cs) runs a
Martlet feature headless on a disposable data directory and returns each
step with passed. Fixtures holds FixtureChat and LoopbackHttpServer. They stand in
for a model and for a web server on this computer, so a check does not need
real credentials.
McpDocsAgreementTests reads docs/MCP.md and every page in this folder. It
fails when a registered tool is not named in them, or when they name a tool
the server does not have. Add a tool and its page entry in one change.
None.
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