Connecting to Cursor & VS Code
Configure your MCP servers to work with Cursor IDE and VS Code. Learn the configuration formats, project-level vs global setup, and how to use MCP tools in your coding workflow.
title: "Connecting to Cursor & VS Code" description: "Configure your MCP servers to work with Cursor IDE and VS Code. Learn the configuration formats, project-level vs global setup, and how to use MCP tools in your coding workflow." order: 8 level: "beginner" duration: "10 min" keywords:
- Cursor MCP setup
- VS Code MCP
- MCP IDE integration
- Cursor MCP configuration
- VS Code MCP server
- MCP code editor
- Cursor AI tools
- mcp.json configuration date: "2026-04-01"
Beyond Claude Desktop, MCP servers work with popular code editors like Cursor and VS Code. Each editor has its own configuration format, but the underlying protocol is the same. This guide covers how to set up your MCP servers in both editors so you can use your tools directly in your coding workflow.
Why Connect MCP Servers to Your Code Editor?
Connecting MCP servers to your code editor brings AI-powered tools directly into your development workflow. Instead of switching between applications, you can:
- Query databases while writing code
- Access internal documentation without leaving the editor
- Run custom analysis tools on your codebase
- Use prompt templates for code review and documentation
- Interact with APIs and external services through natural language
How Do You Configure MCP in Cursor?
Cursor has built-in MCP support. You can configure MCP servers at the project level or globally.
Project-Level Configuration
Create a .cursor/mcp.json file in your project root:
{
"mcpServers": {
"weather-server": {
"command": "node",
"args": ["/absolute/path/to/weather-server/dist/index.js"]
}
}
}
Project-level configuration is ideal when an MCP server is specific to a particular project — for example, a database server configured for that project's database.
Global Configuration
For MCP servers you want available across all projects, add them to Cursor's global settings:
- Open Cursor Settings (Cmd/Ctrl + Shift + J, or via the gear icon)
- Navigate to the MCP section
- Add your server configuration
Alternatively, edit ~/.cursor/mcp.json:
{
"mcpServers": {
"github-tools": {
"command": "node",
"args": ["/path/to/github-tools/dist/index.js"],
"env": {
"GITHUB_TOKEN": "ghp_your_token"
}
},
"general-utils": {
"command": "node",
"args": ["/path/to/general-utils/dist/index.js"]
}
}
}
Put project-specific servers (database access, project APIs) in .cursor/mcp.json at the project root. Put general-purpose servers (GitHub, documentation, utilities) in the global configuration. This keeps each project's configuration focused and avoids exposing unnecessary tools.
Complete Cursor Setup Walkthrough
Build Your MCP Server
Make sure your server is compiled:
cd /path/to/your/mcp-server
npm run build
Create the Configuration File
In your project root, create the .cursor directory and configuration file:
mkdir -p .cursor
Then create .cursor/mcp.json:
{
"mcpServers": {
"my-server": {
"command": "node",
"args": ["/absolute/path/to/my-server/dist/index.js"]
}
}
}
Restart Cursor
Close and reopen Cursor, or reload the window (Cmd/Ctrl + Shift + P, then "Reload Window"). Cursor reads the MCP configuration on startup.
Verify in Settings
Open Cursor Settings and navigate to the MCP section. You should see your server listed with a green status indicator showing it is connected.
Use Your Tools
Open Cursor's AI chat (Cmd/Ctrl + L) or the Composer (Cmd/Ctrl + I) and ask a question that requires your MCP tool:
"What's the weather in San Francisco?"
Cursor will call your MCP server's tool and display the result.
Cursor Configuration Options
Cursor supports the same configuration fields as Claude Desktop:
{
"mcpServers": {
"server-name": {
"command": "node",
"args": ["/path/to/server/dist/index.js"],
"env": {
"API_KEY": "your-key",
"DATABASE_URL": "your-db-url"
}
}
}
}
You can also use npx for published servers:
{
"mcpServers": {
"published-server": {
"command": "npx",
"args": ["-y", "some-mcp-server-package"]
}
}
}
How Do You Configure MCP in VS Code?
VS Code supports MCP servers through its built-in agent mode and GitHub Copilot integration. The configuration uses a slightly different format.
Project-Level Configuration
Create a .vscode/mcp.json file in your project root:
{
"servers": {
"weather-server": {
"type": "stdio",
"command": "node",
"args": ["/absolute/path/to/weather-server/dist/index.js"]
}
}
}
Note the key differences from Cursor's format:
- The top-level key is
servers(notmcpServers) - Each server has a
typefield (typically"stdio")
User-Level (Global) Configuration
For servers available across all VS Code projects, add them to your user settings (settings.json):
{
"mcp": {
"servers": {
"github-tools": {
"type": "stdio",
"command": "node",
"args": ["/path/to/github-tools/dist/index.js"],
"env": {
"GITHUB_TOKEN": "ghp_your_token"
}
}
}
}
}
Access your user settings with Cmd/Ctrl + Shift + P and search for "Preferences: Open User Settings (JSON)".
MCP support in VS Code works through GitHub Copilot's agent mode. Make sure you have the GitHub Copilot extension installed and are using agent mode (@workspace or the chat agent) to access MCP tools.
Complete VS Code Setup Walkthrough
Install GitHub Copilot Extension
Open VS Code and install the GitHub Copilot and GitHub Copilot Chat extensions from the marketplace if you have not already.
Build Your MCP Server
Compile your server:
cd /path/to/your/mcp-server
npm run build
Create the Configuration File
In your project root, create .vscode/mcp.json:
{
"servers": {
"my-server": {
"type": "stdio",
"command": "node",
"args": ["/absolute/path/to/my-server/dist/index.js"]
}
}
}
Reload VS Code
Reload the window: Cmd/Ctrl + Shift + P, then "Developer: Reload Window".
Use MCP in Copilot Chat
Open Copilot Chat and use agent mode. Your MCP tools will be available alongside Copilot's built-in capabilities. Ask questions that trigger your tools:
"Use the weather tool to check conditions in Berlin"
Copilot will discover and use your MCP tools to answer.
Configuration Comparison Across Editors
| Feature | Claude Desktop | Cursor | VS Code |
|---|---|---|---|
| Config file | claude_desktop_config.json | .cursor/mcp.json | .vscode/mcp.json |
| Top-level key | mcpServers | mcpServers | servers |
| Transport type field | Not required | Not required | Required (type: stdio) |
| Project-level | No (global only) | Yes (.cursor/mcp.json) | Yes (.vscode/mcp.json) |
| Global config | Yes | Yes (~/.cursor/mcp.json) | Yes (settings.json) |
| Environment vars | env field | env field | env field |
| Auto-restart on config change | No (manual restart) | No (manual restart) | No (manual restart) |
Setting Up a Server for All Three Clients
If you want your MCP server to work with Claude Desktop, Cursor, and VS Code simultaneously, you need to configure it in each client separately. The server code does not change — only the client configuration differs.
Here is a script to help you set up all three configurations for a given server:
#!/bin/bash
# setup-mcp-server.sh
# Usage: ./setup-mcp-server.sh /path/to/server server-name
SERVER_PATH="$1"
SERVER_NAME="$2"
echo "Server: $SERVER_NAME"
echo "Path: $SERVER_PATH/dist/index.js"
echo ""
echo "=== Claude Desktop ==="
echo "Add to ~/Library/Application Support/Claude/claude_desktop_config.json:"
echo ""
echo "\"$SERVER_NAME\": {"
echo " \"command\": \"node\","
echo " \"args\": [\"$SERVER_PATH/dist/index.js\"]"
echo "}"
echo ""
echo "=== Cursor ==="
echo "Add to .cursor/mcp.json:"
echo ""
echo "\"$SERVER_NAME\": {"
echo " \"command\": \"node\","
echo " \"args\": [\"$SERVER_PATH/dist/index.js\"]"
echo "}"
echo ""
echo "=== VS Code ==="
echo "Add to .vscode/mcp.json:"
echo ""
echo "\"$SERVER_NAME\": {"
echo " \"type\": \"stdio\","
echo " \"command\": \"node\","
echo " \"args\": [\"$SERVER_PATH/dist/index.js\"]"
echo "}"
You do not need separate builds for different clients. The same compiled server works with Claude Desktop, Cursor, VS Code, and any other MCP client. The protocol is standardized — only the client-side configuration differs.
Using MCP Servers Effectively in Code Editors
In Cursor
Cursor provides two main interfaces for using MCP tools:
- Chat (Cmd/Ctrl + L) — Conversational interface where you can ask questions and Cursor will use MCP tools as needed
- Composer (Cmd/Ctrl + I) — Inline editing assistant that can leverage MCP tools while modifying your code
When you ask Cursor a question, it automatically evaluates which MCP tools are relevant and calls them. You can also explicitly request a tool be used.
In VS Code
VS Code's Copilot Chat uses MCP tools in agent mode. Use the chat panel and prefix with @workspace or use the agent mode to access MCP capabilities.
Project-Level Configuration Best Practices
Consider whether to commit your MCP configuration to version control:
- Commit
.cursor/mcp.jsonand.vscode/mcp.jsonif the server paths are consistent across your team (e.g., using npx with published packages) - Add to .gitignore if configurations contain local paths or secrets
- Use environment variables in server configurations to avoid hardcoding sensitive values
Example .gitignore Entry
# Ignore MCP configs with local paths
.cursor/mcp.json
.vscode/mcp.json
Example Shareable Configuration (Using npx)
If your MCP server is published to npm, you can share the configuration:
{
"mcpServers": {
"team-tools": {
"command": "npx",
"args": ["-y", "@your-org/team-mcp-tools"],
"env": {
"API_KEY": "${TEAM_API_KEY}"
}
}
}
}
Not all clients support environment variable substitution in config files. If your client does not, you will need to set the actual values directly. Check your editor's MCP documentation for specifics.
Troubleshooting Editor Connections
Server Not Appearing
- Verify the path — Use absolute paths, not relative
- Check file location —
.cursor/mcp.jsonmust be in the project root - Validate JSON — Even a single missing comma breaks the config
- Reload the editor — Configuration changes require a reload
- Check the server builds — Run
node /path/to/dist/index.jsdirectly to verify it starts
Tools Not Being Called
- The AI may not always choose to use your tools — be explicit in your requests
- Check that tool names and descriptions are clear
- Verify the server is showing as connected in the editor's MCP settings
- Try asking specifically: "Use the get_weather tool to check Tokyo"
Slow Response Times
- Check if your tool's execute method has long-running operations
- Add timeouts to external API calls
- Consider caching results for frequently accessed data
- Monitor the server process for memory leaks
What You Have Learned in the Beginner Path
Congratulations on completing the beginner learning path. Here is a recap of everything you have covered:
MCP Fundamentals
You learned what the Model Context Protocol is, how it works, and why it matters for AI development. MCP provides a standard way for AI models to interact with external tools, data, and templates.
Development Environment
You set up mcp-framework, created a project with the CLI, and understood the project structure with auto-discovery of tools, resources, and prompts.
Building Servers
You built a complete MCP server from scratch with custom tools, including input validation and error handling.
Tools
You mastered the most-used MCP primitive — tools that let AI perform actions with validated inputs and structured outputs.
Resources
You learned to expose data through resources with URIs, covering both static and dynamic patterns.
Prompts
You created reusable prompt templates that standardize how AI approaches specific tasks.
Claude Desktop
You connected your server to Claude Desktop and tested it in a real AI conversation.
Code Editor Integration
You configured Cursor and VS Code to use MCP servers directly in your development workflow.
What Comes Next?
You now have the foundation to build real MCP servers. Here are some paths to explore:
- Intermediate Path — Dive deeper into advanced tool patterns, dynamic resources, transport protocols, and testing
- Build a Real Server — Pick an API or service you use daily and build an MCP server for it
- Explore the Ecosystem — Browse existing MCP servers for inspiration and to learn patterns from other developers
- Publish Your Server — Share your MCP server on npm so others can use it with a simple npx command
Frequently Asked Questions
You have completed the beginner learning path. You now have the skills to build, configure, and deploy MCP servers with any major AI client. Start building something real — the best way to learn is by doing.