January 15, 2024
8 min read

Getting Started with MCP Servers: A Complete Guide

Learn how to set up and configure your first Model Context Protocol server with practical examples and best practices.

MCPgee Team

MCPgee Team

MCP Expert

BeginnerSetupTutorial

Introduction to Model Context Protocol

The Model Context Protocol (MCP) is an open standard created by Anthropic that lets AI applications connect to external data sources, tools, and services through a unified interface. Instead of building custom integrations for every tool an AI model needs to use, MCP provides a single protocol that any AI client can use to talk to any compatible server. Think of it like USB for AI - one standard connector that works with everything.

MCP follows a client-server architecture. An MCP client is the AI application (like Claude Desktop, Cursor, or VS Code) that needs access to external resources. An MCP server is a lightweight program that exposes specific capabilities - reading files, querying databases, calling APIs - through the standardized protocol. The client discovers what tools the server offers, and the AI model can then use those tools during conversations.

This guide walks you through everything you need to get your first MCP server running, from installation to configuration across multiple clients, with real code examples in both TypeScript and Python.

Why MCP Matters

Before MCP, connecting AI to external tools required building bespoke integrations for each combination of AI client and tool. A GitHub integration for Claude Desktop would not work with Cursor. A database connector for one AI app could not be reused in another. MCP eliminates this fragmentation by providing a universal protocol.

  • Standardization: Build a server once, use it with any MCP-compatible client - Claude Desktop, Cursor, VS Code, Windsurf, Cline, and more
  • Security: Built-in permission controls let you restrict what an AI can access. Servers run locally by default, so your data never leaves your machine unless you explicitly configure remote access
  • Discoverability: Clients automatically discover available tools from connected servers. No manual documentation needed - the AI knows what it can do
  • Composability: Run multiple servers simultaneously. Combine a filesystem server, a database server, and a GitHub server to give your AI a complete development environment
  • Open ecosystem: MIT-licensed SDKs, hundreds of community servers, and growing adoption across the AI industry

MCP vs Traditional Approaches

To understand why MCP is valuable, compare it to the alternatives developers used before:

Feature MCP REST API Integration Custom Plugin System Copy-Paste Context
Tool discovery Automatic Manual (read docs) Varies by platform N/A
Cross-client reuse Yes - works with any client Requires per-client code Locked to one platform N/A
Real-time data Yes - live queries Yes - but requires glue code Yes - platform-dependent No - stale at paste time
Security model Local-first, permissioned API keys over network Varies Manual review
Setup complexity One JSON config block Custom code per integration Platform-specific build None (but limited)

Prerequisites

Before setting up your first MCP server, make sure you have the following installed:

  • Node.js 18 or later: Most MCP servers are distributed as npm packages. Check your version with node --version
  • Python 3.10 or later (optional): Required if you want to use Python-based MCP servers or build your own with FastMCP. Check with python3 --version
  • An MCP client: You need at least one of the following installed: Claude Desktop, Cursor, VS Code with GitHub Copilot, or Claude Code CLI
  • A text editor: For editing JSON config files. Any editor works

You do not need deep TypeScript or Python knowledge to use pre-built MCP servers. You only need programming skills if you want to build your own custom server.

Setting Up MCP in Claude Desktop

Claude Desktop is the most popular MCP client and the easiest place to start. Configuration is done through a single JSON file.

Step 1: Locate the Config File

The config file location depends on your operating system:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

If the file does not exist yet, create it with an empty JSON object: {}

Step 2: Add Your First Server

The Filesystem server is the best starting point. It lets Claude read and search files on your local machine. Add this to your config file:

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "/Users/you/projects"
      ]
    }
  }
}

Replace /Users/you/projects with the actual path to the directory you want Claude to access. The -y flag tells npx to automatically install the package if it is not already present.

Step 3: Add Multiple Servers

A practical setup usually includes 3-5 servers. Here is a recommended starter configuration:

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/you/projects"]
    },
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_your_token_here"
      }
    },
    "memory": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-memory"]
    },
    "brave-search": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-brave-search"],
      "env": {
        "BRAVE_API_KEY": "your_brave_api_key_here"
      }
    }
  }
}

Step 4: Restart and Verify

After saving the config file, fully quit and reopen Claude Desktop. Look for the hammer icon in the chat input area. Click it to see all registered tools from your MCP servers. If the icon does not appear, double-check your JSON syntax - a missing comma or bracket is the most common issue.

Setting Up MCP in Cursor

Cursor has built-in MCP support. Configuration works through either the Cursor settings UI or a JSON file.

Option A: Cursor Settings UI

Go to Settings > MCP Servers, click Add Server, and enter the server details. For example, to add the Filesystem server, set the command to:

npx -y @modelcontextprotocol/server-filesystem /path/to/your/project

Option B: JSON Configuration

Create or edit .cursor/mcp.json in your project root:

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "."]
    },
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_your_token_here"
      }
    }
  }
}

Cursor will automatically detect and start the configured servers when you open a chat session.

Setting Up MCP in VS Code

VS Code supports MCP servers through the GitHub Copilot extension. Add server configurations to your .vscode/settings.json or the global VS Code settings:

{
  "github.copilot.chat.mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "${workspaceFolder}"]
    },
    "memory": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-memory"]
    }
  }
}

After adding the configuration, reload VS Code. The MCP tools become available in GitHub Copilot Chat.

Setting Up MCP in Claude Code CLI

Claude Code provides the simplest setup experience with a dedicated CLI command:

# Add the Filesystem server
claude mcp add filesystem npx -y @modelcontextprotocol/server-filesystem /path/to/project

# Add GitHub server with an environment variable
claude mcp add github npx -y @modelcontextprotocol/server-github \
  --env GITHUB_PERSONAL_ACCESS_TOKEN=ghp_your_token

# Add a server globally (available in all projects)
claude mcp add --scope global memory npx -y @modelcontextprotocol/server-memory

# List all configured servers
claude mcp list

# Remove a server
claude mcp remove github

No manual JSON editing required. Claude Code stores project-level configs in .claude/mcp.json and global configs in ~/.claude/mcp.json.

Understanding MCP Architecture

Before building anything, it helps to understand how MCP works under the hood. The architecture has three layers:

Transport Layer

The transport layer handles communication between client and server. MCP supports two transport types:

  • stdio (Standard I/O): The client launches the server as a child process and communicates through stdin/stdout. This is the default for local servers and the simplest to configure. The server starts when the client starts and stops when the client stops. No network configuration needed.
  • Streamable HTTP: The client connects to a remote server over HTTP. This is used for hosted/shared servers that run independently of any specific client. It replaced the older SSE transport in 2026. Use this when you need a server that is always running or shared across a team.

Protocol Layer

The protocol layer defines how clients and servers exchange messages. MCP uses JSON-RPC 2.0 as its message format. When a client connects, it sends an initialize request, the server responds with its capabilities (what tools, resources, and prompts it offers), and then the client can start making requests. All messages are strongly typed, which means both sides know exactly what to expect.

Capability Layer

MCP servers can expose three types of capabilities:

  • Tools: Functions the AI can call - like querying a database, searching the web, or creating a file. Tools are the most common capability and what most servers provide.
  • Resources: Data the AI can read - like file contents, database schemas, or API documentation. Resources are read-only and typically used for providing context.
  • Prompts: Pre-defined prompt templates that guide the AI for specific tasks. Less common but useful for standardizing how the AI interacts with your tools.

Most beginner-friendly servers only use tools. Resources and prompts are more advanced features covered in our advanced server development guide.

How a Typical MCP Interaction Flows

Here is what happens when you ask Claude a question that requires an MCP tool:

  1. You type a message in Claude Desktop (or another MCP client)
  2. Claude reads the available tools from all connected MCP servers
  3. Claude decides which tool(s) to use based on your question
  4. The client sends a tool call request to the appropriate MCP server
  5. The server executes the tool (reads a file, queries a database, etc.)
  6. The server returns the result to the client
  7. Claude uses the result to formulate its response to you

This entire flow happens automatically. You do not need to tell Claude which tools to use - it figures that out from the tool descriptions. You just ask your question naturally, and Claude decides whether and how to use the available tools.

Building Your First MCP Server in TypeScript

Pre-built servers cover many common use cases, but you may need a custom server for your specific workflow. Here is a complete working example of an MCP server that provides weather data:

Step 1: Initialize the Project

mkdir my-weather-server
cd my-weather-server
npm init -y
npm install @modelcontextprotocol/sdk zod
npm install -D typescript @types/node
npx tsc --init

Step 2: Write the Server

import { Server } from '@modelcontextprotocol/sdk/server/index.js';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
import {
  CallToolRequestSchema,
  ListToolsRequestSchema,
} from '@modelcontextprotocol/sdk/types.js';
import { z } from 'zod';

const server = new Server(
  { name: 'weather-server', version: '1.0.0' },
  { capabilities: { tools: {} } }
);

// Define available tools
server.setRequestHandler(ListToolsRequestSchema, async () => ({
  tools: [
    {
      name: 'get_weather',
      description: 'Get current weather for a city',
      inputSchema: {
        type: 'object',
        properties: {
          city: { type: 'string', description: 'City name' },
          units: { type: 'string', enum: ['celsius', 'fahrenheit'], default: 'celsius' }
        },
        required: ['city']
      }
    }
  ]
}));

// Handle tool calls
server.setRequestHandler(CallToolRequestSchema, async (request) => {
  if (request.params.name === 'get_weather') {
    const { city, units = 'celsius' } = request.params.arguments as {
      city: string;
      units?: string;
    };

    // In production, call a real weather API here
    const response = await fetch(
      `https://api.open-meteo.com/v1/forecast?latitude=40.71&longitude=-74.01¤t_weather=true`
    );
    const data = await response.json();

    return {
      content: [
        {
          type: 'text',
          text: `Weather in ${city}: ${data.current_weather.temperature} degrees, wind speed ${data.current_weather.windspeed} km/h`
        }
      ]
    };
  }

  throw new Error(`Unknown tool: ${request.params.name}`);
});

async function main() {
  const transport = new StdioServerTransport();
  await server.connect(transport);
  console.error('Weather MCP server running on stdio');
}

main().catch(console.error);

Step 3: Build and Test

npx tsc
node dist/index.js

Then add it to your Claude Desktop config:

{
  "mcpServers": {
    "weather": {
      "command": "node",
      "args": ["/absolute/path/to/my-weather-server/dist/index.js"]
    }
  }
}

Building Your First MCP Server in Python

Python developers can use FastMCP, which provides a decorator-based API similar to FastAPI:

# Install FastMCP
pip install fastmcp
from fastmcp import FastMCP
import httpx

mcp = FastMCP("Weather Server")

@mcp.tool()
async def get_weather(city: str, units: str = "celsius") -> str:
    """Get current weather for a city."""
    async with httpx.AsyncClient() as client:
        response = await client.get(
            "https://api.open-meteo.com/v1/forecast",
            params={
                "latitude": 40.71,
                "longitude": -74.01,
                "current_weather": "true"
            }
        )
        data = response.json()
        temp = data["current_weather"]["temperature"]
        wind = data["current_weather"]["windspeed"]
        return f"Weather in {city}: {temp} degrees, wind speed {wind} km/h"

@mcp.tool()
def convert_temperature(value: float, from_unit: str, to_unit: str) -> str:
    """Convert temperature between Celsius and Fahrenheit."""
    if from_unit == "celsius" and to_unit == "fahrenheit":
        result = (value * 9/5) + 32
    elif from_unit == "fahrenheit" and to_unit == "celsius":
        result = (value - 32) * 5/9
    else:
        return f"Unsupported conversion: {from_unit} to {to_unit}"
    return f"{value} {from_unit} = {result:.1f} {to_unit}"

if __name__ == "__main__":
    mcp.run()

Add it to Claude Desktop:

{
  "mcpServers": {
    "weather-python": {
      "command": "python3",
      "args": ["/absolute/path/to/weather_server.py"]
    }
  }
}

What Can You Build with MCP? 5 Real Use Cases

MCP servers unlock capabilities that transform how you work with AI. Here are five practical use cases that developers are using in production today:

1. Codebase-Aware AI Assistant

Combine the Filesystem server with the GitHub server to give your AI full context about your project. Claude can read your source code, understand your project structure, check recent commits, and review pull requests - all within the same conversation.

# Example prompt after setup:
"Read the src/api/auth.ts file and compare it to the last 3 commits
on the auth-refactor branch. Are there any security regressions?"

2. Database Query Assistant

The PostgreSQL server lets Claude query your database directly. Instead of writing SQL yourself and pasting results, Claude can explore schemas, run queries, and analyze results in real time.

# Example prompt:
"Show me which customers signed up in the last 30 days but haven't
made a purchase. Group them by referral source."

3. Research and Content Creation

Use the Brave Search server alongside the Memory server for research workflows. Claude can search the web for current information, save key findings to memory, and reference them across multiple conversations.

# Example prompt:
"Search for the latest benchmarks on Bun vs Node.js performance in 2026.
Save the key findings to memory so we can reference them later."

4. DevOps and Infrastructure Management

Connect Claude to your infrastructure with cloud-specific MCP servers. Monitor deployments, check logs, and troubleshoot issues without leaving your AI conversation.

# Example prompt:
"Check the CloudWatch logs for the production API in the last hour.
Are there any error spikes that correlate with the deploy at 2:30 PM?"

5. Team Communication Automation

The Slack server and Notion server let Claude interact with your team's communication and documentation tools. Summarize threads, draft responses, or update project documentation based on conversation context.

# Example prompt:
"Summarize the key decisions from the #architecture channel in Slack
this week and update our Architecture Decisions page in Notion."

Security Best Practices

MCP servers run with real access to your systems, so security matters. Follow these practices to keep your setup safe:

Principle of Least Privilege

  • Filesystem: Only expose the specific directories the AI needs. Never give access to your entire home directory or root filesystem
  • Databases: Use read-only database users for MCP connections. Create a dedicated user with SELECT-only permissions
  • API tokens: Generate tokens with the minimum required scopes. For GitHub, use fine-grained personal access tokens scoped to specific repositories

Environment Variable Management

Never hardcode secrets in your config files, especially if you commit them to version control:

{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "${GITHUB_TOKEN}"
      }
    }
  }
}

Set the actual value in your shell profile (~/.zshrc or ~/.bashrc):

export GITHUB_TOKEN="ghp_your_actual_token_here"

Network Isolation

  • Run MCP servers locally using stdio transport whenever possible. This keeps all communication on your machine
  • If you must use remote servers, ensure they are behind authentication and use HTTPS
  • Review server source code before running unfamiliar community servers. The MCPgee directory verifies all listed servers

Regular Updates

Keep your MCP server packages updated. Security patches are released regularly:

# Update all MCP servers to latest versions
npm update -g @modelcontextprotocol/server-filesystem
npm update -g @modelcontextprotocol/server-github

# Or let npx always fetch the latest (recommended)
# Using npx -y in your config always gets the latest version

Troubleshooting Common Issues

Server Does Not Start

  • Check Node.js version: Run node --version. Most MCP servers require Node.js 18 or later
  • Check npx availability: Run which npx. If it is not found, reinstall Node.js
  • Validate JSON syntax: A single missing comma will prevent all servers from loading. Use jsonlint or paste your config into a JSON validator
  • Check file permissions: The config file must be readable by your user account

Tools Not Appearing

  • Restart the client: Most MCP clients only read the config file on startup. Fully quit and reopen after config changes
  • Check server logs: In Claude Desktop, logs are at ~/Library/Logs/Claude/mcp*.log on macOS. Look for error messages during server initialization
  • Missing environment variables: If a server requires an API key and you have not set it, the server may start but fail to register its tools

Slow Startup

The first time you use npx to run a server, it downloads the package, which can take several seconds. To speed this up:

# Pre-install servers globally
npm install -g @modelcontextprotocol/server-filesystem
npm install -g @modelcontextprotocol/server-github

# Then reference the global install in your config
{
  "mcpServers": {
    "filesystem": {
      "command": "mcp-server-filesystem",
      "args": ["/Users/you/projects"]
    }
  }
}

Server Crashes Mid-Conversation

  • Check for memory leaks in custom servers - use --max-old-space-size=512 for Node.js servers
  • Ensure external services (databases, APIs) are reachable and not rate-limiting
  • Most clients will automatically restart crashed servers, but you may need to retry your last request

Frequently Asked Questions About Getting Started

Do I need to know how to code to use MCP servers?

No. Using pre-built MCP servers only requires editing a JSON configuration file. You do not need to write any code. You only need programming skills if you want to build your own custom server. The vast majority of users never need to build a custom server - the pre-built options in the MCPgee directory cover most use cases.

Can I use MCP servers with ChatGPT or other AI models?

MCP is an open protocol, so any AI client can implement it. Currently, the best MCP support is in Claude Desktop, Cursor, VS Code (via GitHub Copilot), and Claude Code CLI. ChatGPT has limited MCP support through plugins. Other AI tools like Windsurf, Cline, and Continue also support MCP servers. Check our client directory for the latest compatibility information.

How much does it cost to use MCP servers?

The MCP protocol and all SDKs are free and open source (MIT license). Pre-built servers are also free. The only costs are: (1) API keys for services your servers connect to (like a Brave Search API key or GitHub token), and (2) the AI service itself (Claude Pro subscription, API credits, etc.). The MCP servers themselves add zero cost beyond the compute resources they use on your machine, which is typically 50-80 MB of RAM per server.

Is my data safe with MCP servers?

Local MCP servers (stdio transport) run entirely on your machine. Your data never leaves your computer unless you explicitly configure a remote server or connect to an external API. The AI client sends queries to the MCP server locally, gets results locally, and only sends the conversation content to the AI service. You control exactly which directories, databases, and APIs the servers can access through the configuration.

Next Steps

You now have everything you need to start using MCP servers. Here is where to go from here:

The MCP ecosystem is growing rapidly, with new servers being published every week. Whether you use pre-built servers or build your own, MCP provides a reliable, secure, and standardized way to give AI access to the tools and data it needs to be truly useful in your workflow.

Was this helpful?

Share article:

Stay Updated with MCP Insights

Join 5,000+ developers and get weekly insights on MCP development, new server releases, and implementation strategies delivered to your inbox.

We respect your privacy. Unsubscribe at any time.

MCPgee Team

MCPgee Team

We're pioneering the future of Model Context Protocol development with comprehensive guides and tools. Our mission is to make MCP accessible to developers of all skill levels.

Frequently Asked Questions

Related Articles