CrabTalkCrabTalk

Build an MCP Server

Build an MCP server as a crabtalk command — start/stop, service management, and auto-discovery.

CrabTalk supports any standard MCP server. But the recommended way to build one is as a crabtalk command — a standalone binary named crabtalk-<name> that gets start/stop, system service management, and discoverability via crabtalk ls for free. That's how crabtalk search works.

1. Start from the template

Clone the crabtalk-mcp template:

gh repo create crabtalk-my-tools --template crabtalk/crabtalk-mcp
cd crabtalk-my-tools

The template gives you a working MCP command with one example tool, service management (start/stop), and the plumbing to connect to the daemon.

2. Define tools

Each tool has a name, description, and JSON schema for its parameters. The MCP protocol handles serialization — your code just implements the logic.

The template shows the pattern. Add your tools, build the binary.

3. Install

cargo install --path .

The binary is named crabtalk-my-tools, so it becomes available as:

crabtalk my-tools start   # install system service and start
crabtalk my-tools stop    # stop the service
crabtalk ls               # shows my-tools in the service list

The daemon discovers the MCP server automatically and registers its tools. No manual config in crab.toml needed.

4. Test

crabtalk attach

Ask the agent to use one of your tools. The daemon routes the tool call to your server and streams the result back.

Why a command, not a raw MCP server

You can always register any MCP server in crab.toml manually:

[mcps.whatever]
command = "some-mcp-server"
args = ["--port", "8080"]

But building as a crabtalk command gives you:

  • crabtalk <name> start/stop — service lifecycle management
  • System service integration — launchd on macOS, systemd on Linux
  • crabtalk ls — shows up in the service list alongside search and telegram
  • Hub distribution — publish to the hub, users install with crabtalk install
  • Convention over configuration — no manual config needed, the daemon discovers it

crabtalk search is built this way. It's just a standard MCP server packaged as a crabtalk command.

What's next

  • Commands — how cargo-style dispatch works
  • MCP Servers — transports and tool discovery
  • Hub — publish your command as a package

On this page