kilgor/txt-mcp-server-http
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.
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 withpip install mcp-server)
Usage
-
Clone the repository:
git clone https://github.com/kilgor/txt-mcp-server-http.git cd txt-mcp-server-http -
Install dependencies:
pip install mcp-server -
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
- Default (WebSocket):
-
Connect with MCP Inspector or your own client:
- Example URL for Inspector:
http://localhost:3169/mcp
- Example URL for Inspector:
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_fileandedit_text, the LLM must:- Explain the action and preview changes.
- Ask the user for confirmation.
- 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
- LLM calls
write_file("example.txt", "Hello!", confirmed=False)
→ User is shown a confirmation prompt. - 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