MCP and Cursor Integration
Extend Claude Code with Model Context Protocol servers and Cursor IDE
MCP and Cursor Integration
Out of the box, Claude Code is powerful. With MCP servers and Cursor, it becomes unstoppable. These tools give Claude access to databases, APIs, and external services—transforming it from assistant to integrated development partner.
Why This Matters
MCPs are like plugins. Without them, Claude can only see what you show it. With them, Claude can query your database, search the web, access APIs—all automatically.
Part 1: Model Context Protocol (MCP)
What is MCP?
MCP is Anthropic's open standard for connecting Claude to external data sources and tools. Think of each MCP server as a plugin that grants Claude new capabilities.
What MCPs Enable
| MCP Server | What Claude Can Do |
|---|---|
| Filesystem | Read/write any files you authorize |
| PostgreSQL | Query databases, analyze schemas |
| GitHub | Create PRs, read issues, analyze repos |
| Web Search | Search the internet in real-time |
| Slack | Read/send messages, search history |
| Google Drive | Access documents, spreadsheets |
Installing MCP Servers
Method 1: Official MCPs
# Filesystem MCPnpx @modelcontextprotocol/server-filesystem /path/to/allow # PostgreSQL MCPnpm install -g @modelcontextprotocol/server-postgresConfigure in Claude Code:
claude config editAdd to config:
{ "mcpServers": { "filesystem": { "command": "npx", "args": [ "@modelcontextprotocol/server-filesystem", "/Users/you/projects" ] }, "postgres": { "command": "mcp-server-postgres", "env": { "DATABASE_URL": "postgresql://user:pass@localhost/mydb" } } }}Method 2: Community MCPs
Browse available MCPs:
Using MCPs
Once configured, just ask Claude naturally:
Filesystem MCP:
List all Python files modified this week in my project.Database MCP:
Show the schema for the users table.Count how many users signed up this month.GitHub MCP:
List open issues labeled "bug" in our repo.Create a PR for my current branch.Part 2: Cursor IDE
What is Cursor?
Cursor is an AI-first code editor built on VS Code. It has Claude deeply integrated—not as an add-on, but as a core feature.
Key Features
| Feature | Shortcut | What It Does |
|---|---|---|
| Inline Edit | Cmd+K | Edit selected code with AI |
| Chat | Cmd+L | Ask questions, get explanations |
| Composer | Cmd+Shift+L | Multi-file editing |
| Tab Complete | Tab | Accept AI suggestions |
Installing Cursor
Cursor Workflows
Workflow 1: Inline Editing (Cmd+K)
- Select code
- Press
Cmd+K - Type what you want: "Add error handling"
- Accept or refine
// Before: Select this functionfunction fetchUser(id: string) { return fetch(`/api/users/${id}`)} // After Cmd+K: "Add TypeScript types and error handling"async function fetchUser(id: string): Promise<User | null> { try { const response = await fetch(`/api/users/${id}`) if (!response.ok) { throw new Error(`HTTP ${response.status}`) } return await response.json() } catch (error) { console.error('Failed to fetch user:', error) return null }}Workflow 2: Chat (Cmd+L)
Ask questions about your codebase:
How does authentication work in this project?Explain what this regex does.What's the best way to add caching here?Claude analyzes your code and explains.
Workflow 3: Multi-File Composer (Cmd+Shift+L)
For changes across multiple files:
Refactor all React components to use TypeScript.Add proper prop types to each one.Cursor shows diffs for all affected files. Review and apply.
Part 3: Combined Workflows
The Ultimate Stack
Use all three together:
Example: Building a Dashboard
Step 1: Explore Data (Claude Code + MCP)
Connect to the production database.Show me the schema for the metrics table.What data do we have for the last 30 days?Claude queries the database and explains what's available.
Step 2: Plan (Claude Code)
I want to build a dashboard showing:1. Daily active users2. Revenue by product3. Top converting pages Think through how to implement this.Step 3: Implement (Cursor)
Open Cursor, press Cmd+L:
Create a Next.js dashboard with three cards:1. Daily Active Users - line chart2. Revenue - bar chart by product3. Top Pages - table with conversion rates Use the metrics schema you saw earlier.Use Tailwind and Recharts.Step 4: Refine (Cursor)
Select a component, Cmd+K:
Add loading state and error handlingStep 5: Deploy (Claude Code)
Create a commit for the dashboard feature.Push and create a PR.Building Custom MCPs
For advanced users: create your own MCP servers.
Basic Structure
// my-mcp/src/index.tsimport { Server } from '@modelcontextprotocol/sdk/server/index.js'import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js' const server = new Server({ name: 'my-custom-mcp', version: '1.0.0',}) // Define toolsserver.setRequestHandler('tools/call', async (request) => { if (request.params.name === 'my_tool') { const { input } = request.params.arguments // Your logic here const result = await processInput(input) return { content: [{ type: 'text', text: JSON.stringify(result) }] } }}) // Start serverconst transport = new StdioServerTransport()await server.connect(transport)Example: Weather MCP
server.setRequestHandler('tools/call', async (request) => { if (request.params.name === 'get_weather') { const { city } = request.params.arguments const response = await fetch( `https://api.weather.com/v1?q=${city}&key=${API_KEY}` ) const data = await response.json() return { content: [{ type: 'text', text: `Weather in ${city}: ${data.temp}°F, ${data.conditions}` }] } }})Register Your MCP
{ "mcpServers": { "weather": { "command": "node", "args": ["/path/to/my-mcp/build/index.js"], "env": { "API_KEY": "your-key" } } }}Now Claude can check the weather:
What's the weather in San Francisco?Best Practices
Security
- Limit MCP access — Only grant necessary permissions
- Use environment variables — Never hardcode secrets
- Review MCP code — Before installing third-party MCPs
- Audit regularly — Check what MCPs are accessing
Performance
- Cache results — Expensive queries should cache
- Limit scope — Don't give MCPs access to everything
- Monitor usage — Track API calls and costs
Troubleshooting
MCP not connecting:
# Check MCP statusclaude mcp list # View logsclaude mcp logs <server-name> # Restartclaude mcp restart <server-name>Cursor not responding:
- Restart Cursor
- Check Claude API key in settings
- Clear cache:
Cmd+Shift+P→ "Clear Editor History"
Quick Reference
MCP Configuration
{ "mcpServers": { "name": { "command": "executable", "args": ["arg1", "arg2"], "env": { "KEY": "value" } } }}Cursor Shortcuts
| Shortcut | Action |
|---|---|
| Cmd+K | Inline edit |
| Cmd+L | Open chat |
| Cmd+Shift+L | Composer mode |
| Tab | Accept suggestion |
| Escape | Dismiss |
Popular MCPs
| MCP | Use Case |
|---|---|
| server-filesystem | File access |
| server-postgres | PostgreSQL queries |
| server-github | GitHub operations |
| server-brave-search | Web search |
| server-slack | Slack integration |
Resources
Next Steps
- Install one MCP — Start with filesystem or database
- Try Cursor — Use
Cmd+Kon your next task - Combine them — Use MCP to explore, Cursor to implement
- Build custom — Create an MCP for your team's tools
Related Topics:
- Best Practices — Optimize workflows
- Claude Skills — Custom commands
- Automation Track — Automate tasks
Extend Your Capabilities!
Start with one MCP that solves a real problem—maybe database access or GitHub integration. Use it for a week. Then add another. Combined with Cursor, you'll have an AI-powered development environment that feels like the future.