# MCP Servers

Connect external tool servers to CrabTalk — stdio or HTTP, auto-discovered, hot-reloadable.

MCP (Model Context Protocol) servers expose tools that agents can call. Register a server in your config, and the daemon discovers its tools automatically. Add a filesystem server, a database client, a code interpreter — any MCP-compatible server works.

## Configuration

MCP servers are configured in `~/.crabtalk/local/CrabTalk.toml` (or in package manifests installed via the hub).

### Stdio transport

The daemon spawns the server as a child process:

```
[mcps.filesystem]
command = "npx"
args = ["-y", "@modelcontextprotocol/server-filesystem", "/home/user/docs"]
env = { NODE_ENV = "production" }
auto_restart = true
```

### HTTP transport

The server runs independently, daemon connects to it:

```
[mcps.my-api]
url = "http://localhost:8080/mcp"
auth = true  # enable OAuth authentication
```

Use stdio for local tools. Use HTTP when the server runs on a different machine or needs to persist across daemon restarts.

## Tool discovery

When the daemon starts (or when config changes are hot-reloaded), it connects to each MCP server, queries its tool schemas, and registers them in the tool registry. Agents can then call these tools like any built-in tool.

If a server is unavailable, its tools are still registered but return errors when called. The daemon doesn't crash — it degrades gracefully.

## Scoping

Restrict which agents can use which MCP servers:

```
[agents.researcher]
mcps = ["search"]          # only search tools

[agents.writer]
mcps = ["filesystem"]      # only filesystem tools
```

Empty list means access to all MCP servers.

## MCP servers vs. commands

These are related but different:

- **MCP servers** are tool providers. The daemon connects _to_ them and calls their tools.
- **Commands** (like `crabtalk search`) are standalone binaries. They can _be_ MCP servers (search is), or they can be clients that connect _to_ the daemon (telegram is).

A command that runs as an MCP server is just a convenient way to install and manage the server binary. The MCP protocol is the same either way.

## Hot-reload

Add, remove, or modify MCP server configs without restarting the daemon. After saving your changes, run `crabtalk --reload` to apply them.

## What's next

- [Build an MCP Server](/content/blog/build-mcp-server/index.html) — create your own tool server
- [Commands](/content/docs/crabtalk/commands/index.html) — cargo-style dispatch and service management
- [Configuration](/content/docs/crabtalk/config/index.html) — full config reference

### Additional Info

- Memory: Local-only agent memory — remember, recall, and forget, all on your machine.
- Protocol: The wire protocol between CrabTalk clients and the daemon — protobuf over UDS or TCP.
