MCP server for searching .doc/.docx files on remote FTP/FTPS servers
Project description
FTP Doc Reader MCP Server
An MCP (Model Context Protocol) server that recursively searches .doc and .docx files in a specified directory on a remote FTP/FTPS server, matches document content by keyword, and returns relevant files with context snippets.
Features
- Recursive directory scanning: Automatically scans all Word documents in FTP directories and subdirectories (max depth 10, max 200 files)
- Content keyword matching: Case-insensitive full-text search, returns context snippets (100 characters before and after each match)
- Supports .doc and .docx: Handles both legacy binary format and modern XML format
- FTP/FTPS dual protocol: Supports plain FTP and TLS-encrypted FTPS
- Local file caching: Size-based cache invalidation strategy to avoid redundant downloads
- Auto retry: Transient network errors are automatically retried 3 times (2-second intervals)
- Deploy via uvx: No manual dependency management required
Installation
Via uvx (Recommended)
uvx ftp-doc-reader
From source
git clone https://github.com/hackerpl/doc-mcp-server.git
cd doc-mcp-server
pip install -e .
MCP Configuration
Claude Desktop
Edit claude_desktop_config.json:
{
"mcpServers": {
"ftp-doc-reader": {
"command": "uvx",
"args": ["ftp-doc-reader"],
"env": {
"FTP_HOST": "ftp.example.com",
"FTP_USERNAME": "your_username",
"FTP_PASSWORD": "your_password",
"FTP_PROTOCOL": "FTP",
"FTP_PORT": "21",
"CACHE_DIR": ".cache"
}
}
}
}
Kiro
Edit .kiro/settings/mcp.json:
{
"mcpServers": {
"ftp-doc-reader": {
"command": "uvx",
"args": ["ftp-doc-reader"],
"env": {
"FTP_HOST": "ftp.example.com",
"FTP_USERNAME": "your_username",
"FTP_PASSWORD": "your_password"
},
"disabled": false,
"autoApprove": ["search_docs"]
}
}
}
Cursor
Edit ~/.cursor/mcp.json:
{
"mcpServers": {
"ftp-doc-reader": {
"command": "uvx",
"args": ["ftp-doc-reader"],
"env": {
"FTP_HOST": "ftp.example.com",
"FTP_USERNAME": "your_username",
"FTP_PASSWORD": "your_password"
}
}
}
}
From GitHub source (development)
{
"mcpServers": {
"ftp-doc-reader": {
"command": "uvx",
"args": ["--from", "git+https://github.com/hackerpl/doc-mcp-server.git", "ftp-doc-reader"],
"env": {
"FTP_HOST": "ftp.example.com",
"FTP_USERNAME": "your_username",
"FTP_PASSWORD": "your_password"
}
}
}
}
Environment Variables
| Variable | Required | Default | Description |
|---|---|---|---|
FTP_HOST |
✅ | — | FTP server hostname or IP |
FTP_USERNAME |
✅ | — | FTP login username |
FTP_PASSWORD |
✅ | — | FTP login password |
FTP_PORT |
❌ | 21 |
FTP server port |
FTP_PROTOCOL |
❌ | FTP |
Connection protocol: FTP or FTPS |
CACHE_DIR |
❌ | .cache |
Local cache directory path |
Environment variables can be set via the env field in MCP configuration, or by placing a .env file in the project directory.
MCP Tool
search_docs
Search Word document content in a remote FTP directory.
Parameters:
| Parameter | Type | Description |
|---|---|---|
query |
string (1-500 chars) | Search keyword or phrase |
directory_path |
string (1-1024 chars) | Remote FTP directory path |
Returns:
A list of matching results (sorted by match count descending), each containing:
file_path— Full remote path of the filefile_name— File namesnippets— List of matched context snippets (max 5 per file)
Usage example:
Search for documents containing "installation guide" in the /products/docs directory on the FTP server
The AI assistant will call:
{
"tool": "search_docs",
"arguments": {
"query": "installation guide",
"directory_path": "/products/docs"
}
}
Development
# Install development dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Run tests with coverage
pytest --cov
# Start server directly (requires .env file)
python -m ftp_doc_reader
Tech Stack
- Python 3.10+
- MCP Python SDK (FastMCP)
- python-docx (.docx parsing)
- olefile (.doc parsing)
- python-dotenv (environment variable management)
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ftp_doc_reader-0.1.1.tar.gz.
File metadata
- Download URL: ftp_doc_reader-0.1.1.tar.gz
- Upload date:
- Size: 36.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ff68eed1112aef673e0c7b0db86ad568a4de1705b89f268bf422d71cfc35a8b
|
|
| MD5 |
d4c325bed308c819c22e4cfbbdc67fae
|
|
| BLAKE2b-256 |
fc203ebe11c8a361c099c58ad2505944fd83b7f6c5e53113939fa43a33b10a75
|
File details
Details for the file ftp_doc_reader-0.1.1-py3-none-any.whl.
File metadata
- Download URL: ftp_doc_reader-0.1.1-py3-none-any.whl
- Upload date:
- Size: 20.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4d56d17e86200353979ae51548fa5772b8a3287a2ec5073725e29ee2db1b725e
|
|
| MD5 |
34298ab1788d75de19fc08759e6831f1
|
|
| BLAKE2b-256 |
9129794c691212649e27cbc1def6c6d31ebad3f6b477084d83bb0cac7a37cc5a
|