CursorIntermediate

How to Connect an MCP Server to Cursor

Add a Model Context Protocol server to Cursor so the agent can use external tools like a database or a filesystem.

9 minIntermediate

Model Context Protocol (MCP) lets Cursor's agent call out to external tools: a Postgres database, a browser, a ticketing system, or anything that ships an MCP server. Once a server is connected, its tools show up to the agent automatically, and it can call them while answering you. This guide connects a simple filesystem server end to end.

  • Cursor with agent mode available
  • Node.js and npx installed (verify with node -v)
  • An MCP server you want to add (this guide uses the filesystem server)

Open MCP settings

Go to Cursor Settings, then the MCP section. You can add servers through the UI or by editing the JSON config directly. Editing JSON is more reliable and easy to copy between projects.

Create the config file

Create .cursor/mcp.json in your project root for a project-scoped server, or use the global config in your home directory for a server you want everywhere. Each entry names the command Cursor runs to start the server.

.cursor/mcp.json
{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "/Users/me/projects"
      ]
    }
  }
}
Cursor Settings - MCP
MCP Servers
------------------------------
* filesystem [connected]
tools: read_file, write_file, list_dir
[ + Add new MCP server ]
A connected server shows a green dot and its available tools.

Reload and confirm the connection

Save the file and Cursor picks it up. Return to the MCP settings page and look for a green status dot next to the server name, plus the list of tools it exposes. A red or gray dot means the command failed to start.

zsh - verify npx
$node -v
v20.11.1
$npx -y @modelcontextprotocol/server-filesystem ~/projects
Secure MCP Filesystem Server running on stdio
If this runs, Cursor can launch it too.
$

Use a tool from the agent

Open the agent and ask it to do something only the server can do, such as listing the contents of a directory. The agent will request permission to call the tool, then show you the result inline.

Tools can run real actions
An MCP server can read and write files or hit live services. Only add servers you trust, and scope filesystem servers to a specific folder rather than your whole drive.

Result: the agent can now read and list files through the MCP server, and you can swap in other servers by adding more entries to the same JSON file.

Watch related tutorials

Tags
#cursor#mcp#tools#config