MCP File Reader Server

MCP File Reader Server

mcp-file-reader-server-example•byspar65

A simple Model Context Protocol server for reading files, offered in stdio mode managed via Cursor config and in independent SSE mode run with Uvicorn and Starlette.

License: MIT•Runtime: Awaiting documentation review•Category: file systems-docs

WHAT IT DOES

  • •Offers an MCP server that reads files, with a stdio variant and an SSE variant.
  • •Provides a read_file tool that reads a specified file and returns the response.
  • •Mounts the MCP SSE application through Starlette and runs it with Uvicorn, listening on localhost port 8080.
  • •Reads from a default data directory: ~/mcp_data for stdio and ./project_mcp_data_sse for SSE.

BEST FOR

  • •Reading files from a data directory through an MCP-connected client such as Cursor.
  • •Running a standalone SSE file reader server and testing it with a bundled client script.

ABOUT MCP-FILE-READER-SERVER-EXAMPLE

MCP File Reader Server is cataloged as an MCP server attributed to spar65. A simple Model Context Protocol server for reading files, offered in stdio mode managed via Cursor config and in independent SSE mode run with Uvicorn and Starlette. It is categorized under file systems-docs. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: MIT. Check the source repository's current license and terms before using, modifying or distributing this software.

能力检查器

能力定义尚未审核。未核验的采集内容不会作为可信接口展示。

Tools (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Resources (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Prompts (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for MCP File Reader Server are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

What are the two modes in which the server can run?

It runs as a stdio server managed by Cursor via global config, or as an SSE server started manually.

What data directory does each server mode use by default?

The stdio server uses ~/mcp_data, while the SSE server uses ./project_mcp_data_sse within the project directory.

上游原版 README

在 GitHub 查看同一版本原文

README.md · 1fb7a69c24a2 · 采集于 2026-11-13 11:07:12 UTC

保留上游原文,不做 AI 改写。为安全起见过滤脚本、表单和不安全链接。

当前显示最后一次成功采集的文档快照,请以来源页面为准。

MCP File Reader Server

This project provides a simple MCP (Model-Control-Protocol) server for reading files, runnable in two modes:

  1. Stdio Mode (file-reader): Managed by Cursor via global config.
  2. SSE Mode (file-reader-sse): Runs independently via manual start.

Setup Instructions

1. Prerequisites

  • Python 3.8 or higher
  • Cursor app installed
  • pip package manager

2. Installation

  1. Clone or download this repository
  2. Create a virtual environment:
    python3 -m venv venv
    
  3. Activate the virtual environment:
    source venv/bin/activate  # On macOS/Linux
    venv\Scripts\activate  # On Windows
    
  4. Install the required packages:
    pip install mcp
    # Uvicorn & Starlette are needed for running the SSE server
    # httpx is needed for the SSE client
    pip install "uvicorn[standard]" starlette httpx
    

3. Configuration

Option 1: Configure Cursor for Stdio Mode (file-reader)

To let Cursor manage the stdio server:

  1. Edit your global MCP config file:
    • macOS: ~/Library/Application Support/Cursor/cursor_mcp_config.json
    • Windows: %APPDATA%\Cursor\cursor_mcp_config.json
    • Linux: ~/.config/Cursor/cursor_mcp_config.json
  2. Ensure an entry exists for file-reader, pointing to the correct venv Python and the main file_reader_server.py script:
    {
      "mcpServers": {
        "file-reader": {
          // Server name for stdio mode
          "command": "/FULL/PATH/TO/YOUR/PROJECT/venv/bin/python",
          "args": [
            "/FULL/PATH/TO/YOUR/PROJECT/mcp-file-reader-example/file_reader_server.py"
          ],
          "enabled": true,
          "env": {}
        }
        // ... other servers ...
      }
    }
    
  3. (See cursor_mcp_config.json in this repo for a template)

Option 2: Configure Project for SSE Discovery (file-reader-sse)

The project-local .mcp.json file is already configured to describe the SSE server (file-reader-sse) running at http://127.0.0.1:8080. Note that the client will likely need to connect to the /sse subpath (http://127.0.0.1:8080/sse).

Data Directory

  • The stdio server (file-reader) uses ~/mcp_data by default (in your home directory).
  • The SSE server (file-reader-sse) uses ./project_mcp_data_sse by default (within this project directory).

Make sure these directories exist before running the respective servers. The ./start_sse.sh script will create ./project_mcp_data_sse if it's missing.

4. Running the Server

Choose one method:

Method A: Stdio Mode (file-reader via Cursor)

  1. Complete the global configuration (Option 1 above).
  2. Restart Cursor.
  3. Go to Cursor Settings -> MCP.
  4. Find file-reader and toggle it ON.

Method B: SSE Mode (file-reader-sse Manually)

Use the provided start script. In your terminal:

./start_sse.sh

This script ensures dependencies (including uvicorn, starlette) are installed and runs the Uvicorn ASGI server, loading the Starlette app defined in file_reader_server_sse.py. The Starlette app mounts the MCP server's SSE handler (mcp.sse_app()) at the root path.

The server will start listening on http://127.0.0.1:8080.

5. Using the Server in Cursor

  • If using Stdio Mode (Method A): Reads from ~/mcp_data:
    read test.txt using the file-reader server
    
  • If using SSE Mode (Method B): Assuming Cursor discovers the server via .mcp.json. Reads from ./project_mcp_data_sse:
    read sse_test.txt using the file-reader-sse server
    
    (Note: Use the specific server name file-reader-sse and a filename expected in ./project_mcp_data_sse)

6. Using the SSE Client Script (Manual Testing)

This project includes a Python client script (file_reader_sse_client.py) and a wrapper shell script (run_sse_client.sh) to test the SSE server independently using the mcp library's SSE client capabilities.

  1. Ensure the SSE server is running (use ./start_sse.sh).

  2. Run the client wrapper script in your terminal:

    # Connects, initializes, lists tools, and calls read_file for sse_test.txt
    ./run_sse_client.sh
    
    # Tries to read a different file (e.g., another_sse.txt)
    ./run_sse_client.sh another_sse.txt
    

    (The wrapper script ensures dependencies like httpx are installed and uses the correct Python.)

  3. The client will connect to http://127.0.0.1:8080/sse, initialize the MCP session, call the read_file tool by name, and print the response or any errors.

Troubleshooting

  • Stdio: Check Cursor Settings -> MCP for status (green dot), verify global config paths, check stderr via Cursor logs if startup fails.
  • SSE: Ensure the server is running manually (use ./start_sse.sh), check its terminal output (stderr) for errors, verify the client can reach http://127.0.0.1:8080/sse.
  • Restart Cursor after config changes.

Advanced Usage

  • The stdio server uses file_reader_server.py.
  • The sse server uses file_reader_server_sse.py.
  • Logging is to stderr for both.
  • A basic client for the SSE server is provided in file_reader_sse_client.py.
  • A startup script for the SSE server is provided: start_sse.sh.
  • The SSE server uses Starlette to mount the MCP SSE application (mcp.sse_app()) which is then run by Uvicorn via start_sse.sh.
  • A wrapper script for the SSE client is provided: run_sse_client.sh.
  • The SSE client script uses mcp.client.sse.sse_client and mcp.ClientSession to interact with the server.

License

MIT

Server Details

  • file-reader (Stdio):
    • Script: file_reader_server.py
    • Transport: Stdio
    • Management: Via Cursor global config (~/.cursor/mcp.json) & Settings toggle.
    • Rules: 00-MCP-Server-Rules.txt, 00-MCP-Client-Rules.txt
    • Data Dir: ~/mcp_data
  • file-reader-sse (SSE):
    • Script: file_reader_server_sse.py (defines FastMCP instance and Starlette app)
    • Transport: SSE via Starlette/Uvicorn (listens on http://127.0.0.1:8080, client connects to /sse path)
    • Management: Manual start/stop via start_sse.sh (runs uvicorn ...:app).
    • Discovery: Via project .mcp.json.
    • Rules: 00-MCP-SSE-Server-Rule.txt, 00-MCP-SSE-Client-Rule.txt
    • Data Dir: ./project_mcp_data_sse (relative to project root)

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for MCP File Reader Server from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/mcp-file-reader-server-example)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

下载与拉取统计

来源、范围和时段分别列出;不相加,不代表安装人数、活跃用户或安全审核。

尚无已审核的包 / 镜像标识,暂不展示下载统计。

Related file systems-docs MCP Servers

Alternative and complementary servers in the same category

View all in file systems-docs →

A Model Context Protocol server for global law with read-only tools to find and read provisions by date, trace the law behind each word, search text and changes, and check cases or briefs against law in force.

Repository stats unavailable
Files & Documentation
LoreKeeper MCP server
lorekeeper-rpg-lorekeeper-com•lore-keeper

Hosted MCP server for tabletop RPG worlds that organizes messy notes and documents into a private store and lets MCP apps search lore, read documents, find characters, and optionally generate character or world pictures.

Repository stats unavailable
Files & Documentation

An MCP server that gives AI assistants scoped file system operations inside a project directory, with read-only reference projects plus git and GitHub tools.

Repository stats unavailable
Files & Documentation