txt-mcp-server-http

kilgor/txt-mcp-server-http

3.2

If you are the rightful owner of txt-mcp-server-http and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

A simple Model Context Protocol (MCP) server for safe and guided file operations via LLMs, with HTTP/SSE/WS transport support.

Tools
3
Resources
0
Prompts
0

txt-mcp-server-http

A simple Model Context Protocol (MCP) server for safe and guided file operations via LLMs, with HTTP/SSE/WS transport support.


Author: kilgor


Features

  • Prompts for confirmation and safe file operation guidance
  • Tools for reading, writing, and editing text files (with confirmation workflow for dangerous actions)
  • Multiple transport options: WebSocket (default), SSE, HTTP streaming, stdio
  • Clear separation of safe and dangerous operations

Requirements

  • Python 3.9+
  • mcp-server (install with pip install mcp-server)

Usage

  1. Clone the repository:

    git clone https://github.com/kilgor/txt-mcp-server-http.git
    cd txt-mcp-server-http
    
  2. Install dependencies:

    pip install mcp-server
    
  3. Run the server:

    • Default (WebSocket):
      python txt_mcp.py
      
    • Or with SSE (enabled by default in the script):
      python txt_mcp.py
      
    • Or with HTTP streaming:
      # Uncomment the relevant line in txt_mcp.py:
      # mcp.run(transport="streamable-http")
      python txt_mcp.py
      
  4. Connect with MCP Inspector or your own client:

    • Example URL for Inspector: http://localhost:3169/mcp

Prompts

  • Confirmation Before Action:
    Guides the LLM to explain the action, ask for user confirmation, and only proceed if confirmed.

  • File Operations Guidance:
    Instructs the LLM on how to use the provided tools for file operations, emphasizing confirmation for dangerous actions.

Tools

  • read_file(file_path):
    Read any UTF-8 text file (safe, no confirmation needed).

  • write_file(file_path, content, confirmed=False):
    Write or overwrite a file. Requires explicit user confirmation.

  • edit_text(file_path, search, replace, confirmed=False):
    Search and replace text in a file. Requires explicit user confirmation.

Confirmation Workflow

  • For write_file and edit_text, the LLM must:

    1. Explain the action and preview changes.
    2. Ask the user for confirmation.
    3. Only proceed if the user confirms (by calling the tool again with confirmed=True).
  • For read_file, no confirmation is needed.

Example: Writing a File

  1. LLM calls write_file("example.txt", "Hello!", confirmed=False)
    → User is shown a confirmation prompt.
  2. If user confirms, LLM calls write_file("example.txt", "Hello!", confirmed=True)
    → File is written.

License

MIT


Maintained by kilgor
Questions or suggestions? Open an issue