How to Configure DeepSeek-TUI as an MCP Client and Server
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 in the docs/ folder as a comprehensive template showing every supported option. Copy this template to initialize your environment:
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:
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:
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 (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:
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:
{
"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:
- Initialize global configuration – Copy the example template and set your DeepSeek API key:
cp $(deepseek config --example) ~/.deepseek/config.toml
sed -i 's/^#DEEPSEEK_API_KEY.*/DEEPSEEK_API_KEY="your-key"/' ~/.deepseek/config.toml
- Register MCP endpoints – Add any remote servers you need to communicate with:
deepseek mcp add my-remote \
--url http://remote-host:8000/v1/mcp \
--auth-token abcdef123456
- Verify the registry – Inspect
~/.deepseek/mcp.jsonto confirm entries were written correctly:
cat ~/.deepseek/mcp.json
- Start the MCP server (optional) – If other agents need to connect to your TUI:
deepseek mcp serve --host 0.0.0.0 --port 9000
- Launch the TUI – Enter your project directory and run:
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 file that references MCP commands:
// 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.tomland 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 template resides in the repository's documentation folder at 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.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →