MCP Servers

MoMCP-TUI uses the Model Context Protocol (MCP) to connect to tool servers that provide capabilities like file operations, code editing, and web search.

Built-in MCP Server

MoMCP-TUI ships with a local MCP server (momcp) that provides:

ToolDescription
fs_listList directory contents
fs_readRead file content (UTF-8)
fs_writeWrite file content
fs_mkdirCreate directories
fs_deleteDelete files or directories
code_replaceFind and replace text in files
code_writeWrite complete file content
run_commandExecute shell commands

This server is enabled by default and runs as a stdio process.

Server Types

stdio (Local Process)

Runs a local command as a subprocess. Configured via the [mcp.servers.<name>] section in the configuration file with type = "stdio", a command, and optional args and env.

streamableHttp (Remote)

Connects to a remote MCP server via HTTP. Configured with type = "streamableHttp", a url, and optional headers.

Managing Servers

You can add, modify, or delete MCP servers by simply telling the AI assistant what you need — it will handle the configuration automatically.

For your Agent
Example: Add an MCP Server

Copy this prompt and send it to your AI assistant.

Note

The built-in momcp server is essential and cannot be deleted.

File Access Security

The built-in file tools only allow access to:

  1. The startup root directory
  2. Paths listed in allowed_paths

Configure additional allowed paths using the /allow command:

/allow              # Open whitelist manager
/allow list         # View current whitelist
/allow add PATH     # Add a path to whitelist

Viewing Available Tools

Use the /tool list command to see all registered MCP tools:

/tool list

Tool Calling Flow

sequenceDiagram
    participant User
    participant TUI
    participant LLM
    participant MCP

    User->>TUI: "List files in current dir"
    TUI->>LLM: Send message + tool definitions
    LLM->>TUI: Tool call: fs_list(path=".")
    TUI->>MCP: Execute fs_list
    MCP-->>TUI: ["file1.txt", "src/"]
    TUI->>LLM: Tool result
    LLM-->>TUI: "Here are the files: file1.txt, src/"
    TUI-->>User: Display response