MCP lets the agent act on systems beyond your files, which is powerful and also a new path for risk.
The Model Context Protocol (MCP) is an open standard for connecting tools to AI apps. An MCP server is a program or web service offering tools ("search Jira", "query the database"); once configured, Agent can call them like its built-in tools.
Configuration is JSON in one of two files:
.cursor/mcp.jsonin a project: tools for that project, shareable with the team through git,~/.cursor/mcp.jsonin your home folder: tools available everywhere.
There are two shapes. A local (stdio) server is a command Cursor starts on your machine, given as command, args and env; it talks over standard input/output. A remote server is reached at a url over HTTP (Streamable HTTP or SSE), often with OAuth sign-in (a browser login that grants a token) or headers.
Don't hard-code secrets: Cursor substitutes ${env:NAME} with an environment variable, and also understands ${userHome} and ${workspaceFolder}. Enable or disable servers with the toggle in Customize; disabled servers don't load.
By default Cursor asks before running an MCP tool, and you can expand the call to see its arguments. MCP calls follow the same run modes as terminal commands: in Auto-review, allowlisted MCP tools run directly and others go through the classifier.
Security: an MCP server can reach external services and execute code for you. Install servers only from trusted sources, give them API keys with the minimum permissions, and be especially careful with servers that fetch outside content (web pages, tickets, emails): that content can contain instructions aimed at the agent. Every connected server's tool list also uses context, so disable what you don't need.
Example
{
"mcpServers": {
"postgres-readonly": {
"command": "npx",
"args": ["-y", "some-postgres-mcp-server"],
"env": {
"DATABASE_URL": "${env:READONLY_DATABASE_URL}"
}
},
"internal-docs": {
"url": "https://mcp.example.com/mcp",
"headers": {
"Authorization": "Bearer ${env:DOCS_MCP_TOKEN}"
}
}
}
}Remember
- MCP servers live in .cursor/mcp.json (project) or ~/.cursor/mcp.json (global)
- Local servers use command/args/env; remote ones use url (+ headers or OAuth)
- Use ${env:NAME} for secrets; tools follow your run mode; trust servers carefully
Watch out for
- Committing an API token in .cursor/mcp.json instead of referencing ${env:...}.