A simple MCP (Model-Control-Protocol) server for Cursor that allows reading files from a dedicated directory.
- Python 3.8 or higher
- Cursor app installed
- pip package manager
- Clone or download this repository
- Create a virtual environment:
python3 -m venv venv
- Activate the virtual environment:
source venv/bin/activate # On macOS/Linux venv\Scripts\activate # On Windows
- Install the required packages:
pip install mcp
The MCP configuration file needs to be placed in your Cursor application settings directory:
- macOS:
~/Library/Application Support/Cursor/cursor_mcp_config.json
- Windows:
%APPDATA%\Cursor\cursor_mcp_config.json
- Linux:
~/.config/Cursor/cursor_mcp_config.json
This repository already includes a cursor_mcp_config.json
file. You may need to update the file paths to match your system.
{
"mcpServers": {
"file-reader": {
"command": "/FULL/PATH/TO/YOUR/PROJECT/venv/bin/python",
"args": [
"/FULL/PATH/TO/YOUR/PROJECT/mcp-file-reader-example/file_reader_server.py"
],
"env": {}
}
}
}
By default, the server uses ~/mcp_data
as the directory for storing files. Make sure this directory exists or the server will create it for you.
-
Use the provided start script:
./start.sh
Or manually run:
source venv/bin/activate python file_reader_server.py
-
The server will start and listen for requests from Cursor.
Once the server is running, you can access it from Cursor by typing:
read test.txt using the file-reader server
or
using mcp file-reader tell me what is in test.txt
- Make sure the server is running when you try to access it from Cursor
- Check the
server.log
file for any error messages - Verify that your configuration file paths are correct
- Restart Cursor after making changes to the configuration files
- The server logs all operations to
server.log
in the server directory - You can modify the
file_reader_server.py
file to add more functionality
This project is licensed under the MIT License - see the LICENSE file for details.