MCP CLI Chat
An MCP filesystem server for reading, creating, editing, deleting, and accessing documents through tools, resources, prompts, and permission controls.
Read document contents by
doc_idCreate a new document with filename and content
Edit a document by replacing exact
old_strwithnew_strDelete a document by
doc_idGrant session access to an absolute file path via
allow_path(per schema)List all known files via
docs://listGet 5 most recently modified files via
docs://recentRead a specific file via
docs://file/{filename}Run document prompts:
/summarize,/format,/rewrite,/convertPrompt the user before accessing paths outside allowed directories
Provides tools for managing filesystem documents via an LLM using OpenAI's API, enabling document reading, creation, editing, deletion, and commands like summarization, formatting, rewriting, and conversion.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP CLI Chat list files in my documents directory"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
File System MCP
A CLI chat app that uses the Model Context Protocol (MCP) to let an LLM manage your filesystem. Ask questions, reference documents with @, and run commands like /summarize — all from your terminal.
How It Works
The app starts an MCP server as a subprocess and connects to it over stdio. When you send a message, it's forwarded to OpenAI with the MCP tools (read, create, edit, delete documents) available as function calls. The LLM decides which tools to invoke, and the results are streamed back to you.
You → CLI → OpenAI (with MCP tools) → MCP Server → FilesystemRelated MCP server: mcp-file-servers
Prerequisites
Python 3.10+
Setup
1. Configure environment variables
Copy or edit .env in the project root:
OPENAI_API_KEY="sk-..."
OPENAI_MODEL="gpt-4o"
USE_UV=1Variable | Description |
| Your OpenAI API key (required) |
| Model to use, e.g. |
| Set to |
2. Install dependencies
With uv (recommended):
pip install uv
uv venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
uv pip install -e .Without uv:
python -m venv .venv
source .venv/bin/activate
pip install -e .3. Run
python main.pyOr with uv:
uv run main.pyUsage
Chatting
Type a message and press Enter:
> What files do I have?Referencing documents
Use @filename to include a document's content in your query. Filenames with spaces work too:
> Summarize @pokemon.md
> What's in @Family Tree.pdfTab completion activates after typing @. The dropdown includes files from the default mcp_documents/ directory and any directories you've granted access to.
Commands
Type / to see available commands. The document commands take a document ID as the first argument:
Command | Syntax | Description |
|
| Summarize a document |
|
| Reformat a document to markdown |
|
| Rewrite in a different tone (formal, casual, concise, technical, persuasive, simple) |
|
| Convert to another format (json, csv, markdown, yaml, xml, html, plain text) |
|
| Exit the application ( |
> /summarize pokemon.md
> /format pokemon.md
> /rewrite pokemon.md formal
> /convert pokemon.csv jsonTab completion works for commands, document names, and tone/format values.
Custom root directories
Point the server at specific directories with --roots:
python main.py --roots ~/my_docs ./dataAdditional MCP servers
Load extra MCP server scripts as positional arguments:
python main.py my_server.py another_server.pyFile access permissions
Whenever anything touches a file outside the allowed directories (--roots or the default mcp_documents/), the server stops and asks you first. That includes files you @mention, /commands, and tool calls the LLM makes on its own:
The MCP server wants to access:
/Users/prem/Desktop/secret.txt
This path is outside the allowed directories.
Allow access? (1=Allow once, 2=Always allow this file, 3=Always allow this folder, 4=Deny): Allow once (1): allows just this one request. The next request for the same file asks again.
Always allow this file (2): allows this file for the rest of the session. It also shows up in
@tab completion.Always allow this folder (3): allows every file in the file's folder for the rest of the session, and adds them to
@tab completion.Deny (4): blocks the request. Pressing Enter without a number, or Ctrl-C, also denies.
How it works: the server asks using MCP elicitation, so the decision always comes from you, never from the LLM. There's no tool the LLM can call to grant itself access. Other MCP clients that support elicitation show their own version of this prompt. If a client can't ask the user, access outside the allowed directories is denied.
You may be asked about a file that doesn't exist. That's deliberate: the server checks permission before it checks whether a file exists, so nothing outside the allowed directories can be probed without your approval.
MCP Server
The built-in server (mcp_server.py) exposes:
Tools
Tool | Description |
| Read a document's contents |
| Create a new document |
| Replace text within a document |
| Delete a document |
Resources
URI | Returns |
| All filenames in the documents directory and any files or folders you've allowed |
| 5 most recently modified files |
| Contents of a specific file |
Prompts
Prompt | Syntax | Description |
|
| Summarize a document and return the result in chat |
|
| Reformat a document to markdown and return the result in chat |
|
| Rewrite in a different tone and return the result in chat |
|
| Convert between formats and return the result in chat |
Project Structure
├── main.py # Entry point — parses args, starts MCP clients and CLI
├── mcp_client.py # MCP client wrapper (connects to servers via stdio)
├── mcp_server.py # MCP server with tools, resources, prompts, and permission checks
├── core/
│ ├── cli.py # Terminal UI (prompt-toolkit, tab completion, key bindings)
│ ├── cli_chat.py # CLI chat logic (@mentions, /commands, access prompts)
│ ├── chat.py # Base chat loop (LLM ↔ tool execution cycle)
│ ├── llm.py # OpenAI API wrapper
│ └── tools.py # Converts MCP tools to OpenAI function-calling format
├── mcp_documents/ # Sample documents directory
├── tests/ # Permission flow tests (run against the real server)
├── pyproject.toml # Project metadata and dependencies
└── .env # API keys and configRunning tests
The tests start the real MCP server and simulate the LLM's tool calls, so they don't need an API key:
uv run pytestAdding documents
Place files in mcp_documents/ (or a custom --roots directory). The server reads from there by default. Supported formats are any text-based file.
To add documents programmatically, use the create_doc tool through the chat interface.
Available Tools
5 toolsallow_pathA
Grant the MCP server access to an absolute file path for this session
Inputs: path (required).
create_docB
Create a new document with the given content
Inputs: doc_id (required), content (required).
delete_docA
Delete a document
Inputs: doc_id (required).
edit_doc_contentsC
Can be used to edit the contents of a doc
Inputs: doc_id (required), new_str (required), old_str (required).
read_doc_contentsA
Can be used to read and return the contents of a doc as a string
Inputs: doc_id (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Each tool targets a distinct action: granting path access, reading, creating, editing, or deleting a document. The shared doc/doc_contents wording does not create real ambiguity because the verbs clearly separate the operations.
Most names follow a clear verb_noun pattern such as create_doc and delete_doc. The minor mismatch between doc and doc_contents for read and edit operations prevents a perfect score.
Five tools is well-scoped for a document management server. Each tool serves a necessary purpose with no redundant or bloated operations.
The core CRUD lifecycle is fully covered: create, read, edit, and delete. A listing or search operation would be useful, but the main workflows are complete enough for agents to operate.
Maintenance
Related MCP Connectors
Convert, create and edit Word, PowerPoint, Excel and PDF documents from any AI agent.
Create and manage documents, spreadsheets, and presentations from your AI assistant.
File tools for your AI chat: PDF tables to Excel, merge PDFs, images to PDF, fill PDF forms.
Hosted document tools for agents: extract, parse, classify, convert, OCR, sign, and redact.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables agents to manage and organize local documents by listing, inspecting, extracting text, searching, and renaming files, with optional Google Drive integration.-
- FlicenseNot gradedqualityCmaintenanceEnables file operations (PDF, Office, images, archives, media) through natural language, with tools for reading, writing, converting, and analyzing files locally.1-
- FlicenseAqualityDmaintenanceEnables local document search and reading across formats like docx, pdf, md, and more, providing tools for listing, searching, and reading documents.3-
- AlicenseAqualityDmaintenanceEnables local file management through natural language interactions using the Gemini API, with tools for listing, reading, writing, deleting, and updating files.51MIT