MCP Sample Server
April 6, 2025 · View on GitHub
This is a simple MCP (Model Context Protocol) server implementation that provides a file listing functionality.
Setup
- Install dependencies:
npm install
- Build the TypeScript code:
npm run build
- Start the server:
npm start
Configuring in Cursor
To use this MCP server in Cursor:
- Open Cursor settings (⚙️ icon or Ctrl + ,)
- Find the MCP section
- Add a new MCP server configuration:
{
"mcpServers": {
"file-lister": {
"command": "node",
"args": ["PATH_TO_YOUR_PROJECT/build/mcp-server.js"],
"cwd": "PATH_TO_YOUR_PROJECT"
}
}
}
Replace PATH_TO_YOUR_PROJECT with the absolute path to your project directory.
Available Tools
listFiles
Lists all files in a specified directory.
Parameters:
path: The directory path to list files from
Returns:
- Array of file objects containing:
name: File namepath: Full file path