How to add an MCP server to Cursor (mcp.json, examples & fixes)
Cursor’s Agent can integrate external tools via Model Context Protocol (MCP) servers, which extend its capabilities to tasks like browser control or GitHub issue access. The platform supports adding these servers through a one-click process or by configuring an `mcp.json` file. A reported recommendation for developers is to secure sensitive credentials by reading them from environment variables rather than embedding them directly in configuration files.
Model Context Protocol (MCP) servers allow Cursor’s Agent to perform additional functions, such as interacting with web browsers or looking up current library documentation. These servers can be local programs or remote services, and their configuration is managed through user-specific or project-level `mcp.json` files. Cursor merges these configuration files, with project-specific settings taking precedence over user-wide ones.
For remote MCP servers that require authentication, such as with API keys or tokens, the reporting emphasizes secure credential handling. It advises against embedding sensitive information directly into `mcp.json` files. Instead, credentials should be referenced as environment variables using the `${env:NAME}` syntax, which prevents their exposure, particularly in project files that might be committed to version control.
Further security measures include using the `envFile` option for local servers to load variables from a `.env` file, with the explicit instruction to add this file to `.gitignore`. The guidance also suggests granting tokens, like GitHub personal access tokens, only the minimum necessary repositories and permissions that the Agent requires, thereby limiting potential risks associated with excessive access.
Share this article
Related reading
6 stories
Filesystem MCP server setup: config, tools, Docker and fixes (v2.1)
Our earlier guide covers setting up an MCP server with config, tools, Docker, and fixes.

Vietnamese Travellers Can Now Scan NETS QR Codes to Pay in Singapore

Weixin Pay Sees 84% Rise in Overseas E-Wallet Transactions

BPC Pairs SmartVista with Huawei for Payment Modernisation

