Skip to main content

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

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 file
  • file_name — File name
  • snippets — 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

Metadata

Release files for ftp-doc-reader 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ftp-doc-reader 0.1.1
File Size Uploaded Provenance Actions
ftp_doc_reader-0.1.1.tar.gz 36.4 kB Without provenance Details for ftp_doc_reader-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ftp-doc-reader 0.1.1
File Interpreter ABI Platform Actions
ftp_doc_reader-0.1.1-py3-none-any.whl Python 3 none any Details for ftp_doc_reader-0.1.1-py3-none-any.whl

Total release size: 57.3 kB

Release files / ftp_doc_reader-0.1.1.tar.gz

Download URL ftp_doc_reader-0.1.1.tar.gz
Size 36.4 kB
Tags Source
SHA-256 checksum
How to use checksums
0ff68eed1112aef673e0c7b0db86ad568a4de1705b89f268bf422d71cfc35a8b
BLAKE2b-256 checksum
How to use checksums
fc203ebe11c8a361c099c58ad2505944fd83b7f6c5e53113939fa43a33b10a75
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Release files / ftp_doc_reader-0.1.1-py3-none-any.whl

Download URL ftp_doc_reader-0.1.1-py3-none-any.whl
Size 20.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4d56d17e86200353979ae51548fa5772b8a3287a2ec5073725e29ee2db1b725e
BLAKE2b-256 checksum
How to use checksums
9129794c691212649e27cbc1def6c6d31ebad3f6b477084d83bb0cac7a37cc5a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Security for ftp-doc-reader 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page