🎯 SQL Practice

MCP Server Setup

MCP lets Claude access your local machine — files, databases, APIs, and more.

What is MCP?

MCP (Model Context Protocol) is an open standard developed by Anthropic that lets Claude connect to external tools and data sources through a standardized interface. Instead of Claude being limited to what you paste in the chat, MCP lets it:

How MCP works

MCP uses a client-server architecture:

Step 1: Install Claude Desktop

MCP currently works with Claude Desktop (not the web version). Download it from claude.ai/download. Available for macOS and Windows.

Step 2: Install Node.js

Most MCP servers are Node.js packages. Install Node.js 18 or later from nodejs.org.

Step 3: Configure MCP servers

Claude Desktop reads its MCP configuration from a JSON file:

CONFIG — Add the filesystem server
{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "/Users/yourname/projects"
      ]
    }
  }
}

Replace /Users/yourname/projects with the directory you want Claude to access. Restart Claude Desktop. You'll see MCP tools listed when you start a new chat.

Step 4: Useful MCP servers to install

ServerPackageWhat it gives Claude
Filesystem@modelcontextprotocol/server-filesystemRead/write your local files
PostgreSQL@modelcontextprotocol/server-postgresQuery your Postgres databases
SQLite@modelcontextprotocol/server-sqliteQuery local SQLite files
GitHub@modelcontextprotocol/server-githubRead repos, issues, PRs
Brave Search@modelcontextprotocol/server-brave-searchWeb search with Brave API
Puppeteer@modelcontextprotocol/server-puppeteerBrowser automation
Fetch@modelcontextprotocol/server-fetchHTTP requests to any URL

Step 5: Add the Postgres MCP server

CONFIG — Add Postgres alongside filesystem
{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/yourname/projects"]
    },
    "postgres": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-postgres",
               "postgresql://localhost/mydb?user=postgres&password=yourpassword"]
    }
  }
}

Now you can ask Claude: "Look at the orders table in my database and show me the top 5 customers by revenue this month." — and Claude will actually run the SQL against your local database.

SECURITY NOTE MCP servers run with your local user's permissions. The filesystem server can read and write any path you give it access to. Be careful about which directories you expose. Never give Claude access to system directories or directories containing secrets/credentials.

Using Claude Code for MCP

Claude Code (the command-line tool) also supports MCP. Run:

Terminal
npm install -g @anthropic-ai/claude-code
claude mcp add filesystem /path/to/your/project
claude mcp list  # see connected servers