# How to Configure DeepSeek-TUI as an MCP Client and Server

> Set up DeepSeek-TUI as an MCP client and server by configuring JSON and TOML files. Learn how to launch the server and TUI for seamless bidirectional agent messaging.

- Repository: [DeepSeek/awesome-deepseek-agent](https://github.com/deepseek-ai/awesome-deepseek-agent)
- Tags: how-to-guide
- Published: 2026-08-15

---

**Configure DeepSeek-TUI for Multi-Client-Protocol (MCP) communication by editing `~/.deepseek/mcp.json` for endpoint definitions and `~/.deepseek/config.toml` for global settings, then launch the server with `deepseek mcp serve` and run the TUI to enable bidirectional agent messaging.**

The `deepseek-ai/awesome-deepseek-agent` repository provides DeepSeek-TUI, a terminal interface that functions as both an **MCP client** and **MCP server**. This dual capability allows the TUI to expose its own tools to external processes while simultaneously invoking remote MCP services, creating a unified JSON-based protocol layer for multi-agent collaboration directly in your terminal.

## Understanding MCP Architecture in DeepSeek-TUI

DeepSeek-TUI implements the **Multi-Client-Protocol (MCP)** specification to standardize how AI agents exchange messages with external tools and services. When operating as a **server**, the TUI exposes its capabilities through a local HTTP endpoint that other agents can query. As a **client**, it maintains connections to remote MCP endpoints defined in your configuration, allowing the underlying model to invoke distributed tools during conversations.

Both modes rely on the same configuration infrastructure located in the `~/.deepseek/` directory, ensuring consistent authentication and endpoint management across client and server operations.

## Essential Configuration Files

DeepSeek-TUI uses two primary files to govern MCP behavior, both stored in your home directory under `~/.deepseek/`.

### Global TUI Configuration (`~/.deepseek/config.toml`)

This file contains API keys, model selection, logging levels, and MCP-related global flags. The repository provides [`config.example.toml`](https://github.com/deepseek-ai/awesome-deepseek-agent/blob/main/config.example.toml) in the `docs/` folder as a comprehensive template showing every supported option. Copy this template to initialize your environment:

```bash
cp $(deepseek config --example) ~/.deepseek/config.toml

```

### MCP Endpoint Registry (`~/.deepseek/mcp.json`)

This JSON file maintains the list of remote servers the TUI connects to as a client, as well as metadata for when the TUI acts as a server. The structure defines server names, URLs, and authentication tokens in a machine-readable format that the TUI parses at startup.

## Configuring the MCP Server

To expose DeepSeek-TUI as an MCP server that other processes can discover, you must populate the endpoint registry and start the server daemon.

### Step 1: Define Server Metadata

Edit `~/.deepseek/mcp.json` to include your server's exposure settings, or use the CLI convenience command to append remote servers that this instance will connect to:

```bash
deepseek mcp add my-remote \
    --url http://remote-host:8000/v1/mcp \
    --auth-token abcdef123456

```

### Step 2: Launch the Server Process

Start the local MCP endpoint with the `serve` subcommand. Specify `--host` and `--port` to control network accessibility:

```bash
deepseek mcp serve --host 0.0.0.0 --port 9000

```

This command initializes the server using definitions from `~/.deepseek/mcp.json`, as referenced in the documentation at [`docs/deepseek-tui.md`](https://github.com/deepseek-ai/awesome-deepseek-agent/blob/main/docs/deepseek-tui.md) (line 78). Once running, other MCP-compliant agents can connect to `http://your-host:9000` to interact with your TUI instance.

## Configuring the MCP Client

The client configuration enables the TUI to reach out to external MCP services during model execution. This is driven entirely by the same `~/.deepseek/mcp.json` file used for server operations.

### Adding Remote Endpoints

Use the `deepseek mcp add` command to register external servers without manually editing JSON:

```bash
deepseek mcp add production-api \
    --url https://api.production.internal/v1/mcp \
    --auth-token $PROD_MCP_TOKEN

```

The CLI automatically appends this entry to `~/.deepseek/mcp.json` with the following structure:

```json
{
  "servers": [
    {
      "name": "production-api",
      "url": "https://api.production.internal/v1/mcp",
      "auth_token": "your-token-here"
    }
  ]
}

```

When you launch `deepseek` in a project folder, the TUI loads these entries and makes the connections available to the model for tool invocation.

## Complete Configuration Workflow

Follow this sequence to activate full MCP functionality in DeepSeek-TUI:

1. **Initialize global configuration** – Copy the example template and set your DeepSeek API key:

```bash
cp $(deepseek config --example) ~/.deepseek/config.toml
sed -i 's/^#DEEPSEEK_API_KEY.*/DEEPSEEK_API_KEY="your-key"/' ~/.deepseek/config.toml

```

2. **Register MCP endpoints** – Add any remote servers you need to communicate with:

```bash
deepseek mcp add my-remote \
    --url http://remote-host:8000/v1/mcp \
    --auth-token abcdef123456

```

3. **Verify the registry** – Inspect `~/.deepseek/mcp.json` to confirm entries were written correctly:

```bash
cat ~/.deepseek/mcp.json

```

4. **Start the MCP server** (optional) – If other agents need to connect to your TUI:

```bash
deepseek mcp serve --host 0.0.0.0 --port 9000

```

5. **Launch the TUI** – Enter your project directory and run:

```bash
deepseek

```

The model can now execute `deepseek mcp list` to view available servers or `deepseek mcp send <server> <payload>` to dispatch JSON messages to configured endpoints.

## Integrating MCP with TUI Skills

You can encapsulate MCP calls within reusable TUI skills stored in `~/.deepseek/skills/`. Create a directory for your skill and include a [`SKILL.md`](https://github.com/deepseek-ai/awesome-deepseek-agent/blob/main/SKILL.md) file that references MCP commands:

```rust
// File: ~/.deepseek/skills/echo/SKILL.md
{
  "description": "Echo payload via MCP to remote server",
  "command": [
    "deepseek mcp send my-remote {\"msg\": \"{{input}}\"}"
  ]
}

```

When the model invokes this skill, it executes the MCP client command, serializes the payload, and transmits it to the `my-remote` endpoint defined in your `~/.deepseek/mcp.json` configuration.

## Summary

- DeepSeek-TUI functions as both an **MCP client** and **MCP server**, enabling bidirectional agent communication through a unified JSON protocol.
- Store global settings in **`~/.deepseek/config.toml`** and endpoint definitions in **`~/.deepseek/mcp.json`**.
- Start the MCP server using **`deepseek mcp serve --host <ip> --port <port>`**.
- Register client connections with **`deepseek mcp add <name> --url <endpoint>`**.
- The TUI automatically loads MCP configurations at startup, making remote tools available to the model without additional runtime flags.

## Frequently Asked Questions

### What file format does DeepSeek-TUI use for MCP configuration?

DeepSeek-TUI uses JSON for MCP endpoint definitions in `~/.deepseek/mcp.json` and TOML for global application settings in `~/.deepseek/config.toml`. This separation allows the TUI to parse server lists efficiently while maintaining human-readable global preferences.

### Can DeepSeek-TUI act as both client and server simultaneously?

Yes. You can run `deepseek mcp serve` in one terminal to expose the server endpoint while running `deepseek` in another session to utilize client connections. Both processes read from the same `~/.deepseek/mcp.json` file, though the server primarily uses it for metadata while the client uses it for connection routing.

### Where is the configuration template located in the repository?

The [`config.example.toml`](https://github.com/deepseek-ai/awesome-deepseek-agent/blob/main/config.example.toml) template resides in the repository's documentation folder at [`docs/deepseek-tui.md`](https://github.com/deepseek-ai/awesome-deepseek-agent/blob/main/docs/deepseek-tui.md) (line 66). Generate a copy using `deepseek config --example` to ensure you have the latest schema, then move it to `~/.deepseek/config.toml` to activate your settings.

### How do I authenticate with remote MCP servers?

Include authentication tokens using the `--auth-token` flag when running `deepseek mcp add`, or manually add an `auth_token` field to the server object in `~/.deepseek/mcp.json`. The TUI includes this token in the Authorization header when establishing client connections to the specified endpoint.