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.
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.
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"/Users/me/projects"
]
}
}
}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.
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.
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
33:42
41:18
28:05
3:12
26:54
39:10