Getting Started with Model Context Protocol (MCP)
This guide will walk you through installing, configuring, and using MCP servers with Claude Code to extend its capabilities with external data sources and tools.
Time: 30-45 minutes Prerequisites: Claude Code installed, basic command line knowledge
What You'll Learn
- Install your first MCP server
- Configure Claude Code to use MCP
- Access databases via MCP
- Use GitHub integration via MCP
- Create your own custom MCP server
- Troubleshoot common issues
Installation
Prerequisites
Ensure Claude Code is Installed:
Install Node.js (for MCP servers):
Your First MCP Server: Filesystem
Let's start with the filesystem MCP server to give Claude Code access to your files.
Step 1: Install the Filesystem MCP Server
The filesystem server is pre-installed with Claude Code, we just need to configure it.
Step 2: Configure in Claude Code
Edit your Claude Code settings file:
Location:
- User-level:
~/.claude/settings.json - Project-level:
.claude/settings.json(in your project directory)
Add MCP Configuration:
Important: Replace paths with directories you want Claude to access.
Step 3: Test the Connection
Install GitHub MCP Server
Connect Claude Code to your GitHub repositories.
Step 1: Create a GitHub Personal Access Token
- Go to https://github.com/settings/tokens
- Click "Generate new token" → "Generate new token (classic)"
- Give it a name: "Claude Code MCP"
- Select scopes:
repo(full control of private repositories)read:org(read org data)
- Click "Generate token"
- Copy the token (you won't see it again!)
Step 2: Install and Configure GitHub MCP Server
Option A: Using CLI
Option B: Manual Configuration
Edit ~/.claude/settings.local.json (for sensitive credentials):
Step 3: Use GitHub Integration
Install Database MCP Server (PostgreSQL)
Connect Claude Code to your PostgreSQL database.
Step 1: Install PostgreSQL MCP Server
Step 2: Configure Database Access
Edit ~/.claude/settings.local.json:
Security Note: Use settings.local.json (not tracked in git) for credentials.
Step 3: Query Your Database
Install SQLite MCP Server
For local database files.
Configuration
Install Slack MCP Server
Send messages and interact with Slack.
Step 1: Create Slack App
- Go to https://api.slack.com/apps
- Click "Create New App" → "From scratch"
- Name it "Claude Code MCP"
- Select your workspace
- Add OAuth Scopes:
chat:write- Send messageschannels:read- List channelsusers:read- List users
- Install to workspace
- Copy the "Bot User OAuth Token"
Step 2: Configure Slack MCP
Step 3: Use Slack
Managing MCP Servers
List Configured Servers
Output:
Test a Specific Server
Disable a Server Temporarily
Edit settings.json and comment out or remove the server configuration.
Debug MCP Connection Issues
Configuration Scopes
User-Level (~/.claude/settings.json)
- Global settings for all projects
- Non-sensitive configuration
User-Local (~/.claude/settings.local.json)
- Global settings with secrets (API keys, passwords)
- Not committed to version control
Project-Level (.claude/settings.json)
- Project-specific MCP servers
- Shared with team via git
Project-Local (.claude/settings.local.json)
- Project-specific secrets
- Not committed to version control
- Overrides project settings
Priority: Project-Local > Project > User-Local > User
Security Best Practices
Never Commit Secrets
Use Environment Variables
Then set in your shell:
Principle of Least Privilege
- Only grant necessary permissions to MCP servers
- Use read-only tokens when possible
- Limit filesystem access to specific directories
Use Project-Specific Credentials
For team projects, each developer should use their own credentials in .claude/settings.local.json.
Common MCP Servers Reference
Development Tools
Git:
GitLab:
Search & Web
Brave Search:
Web Fetch:
Troubleshooting
Issue: "MCP server not found"
Solution:
Issue: "Connection refused"
Solution: Check your configuration:
Issue: "Authentication failed"
Solution:
- Verify API token is correct
- Check token permissions/scopes
- Ensure token hasn't expired
- Test token outside of Claude Code
Issue: "Server crashes immediately"
Solution:
Next Steps
Immediate (Today)
- ✅ Configure filesystem MCP server
- ✅ Install one database MCP server
- ✅ Test GitHub integration
- ✅ Explore available MCP servers
Short-term (This Week)
- Best Practices - Secure configuration patterns
- Use Cases - Real-world MCP applications
- Tutorial 1 - Build your own MCP server
Medium-term (This Month)
- Build a custom MCP server for your internal tools
- Share MCP configuration with your team
- Integrate multiple MCP servers into workflows
- Contribute to MCP ecosystem
Quick Reference
Essential Commands
Configuration Template
Resources
Ready to build your own MCP server? → Tutorial 1: Build a Custom MCP Server
Want to see real-world examples? → MCP Use Cases
Need advanced patterns? → MCP Best Practices