What is MCP and how to set up a server for Claude

KaiDev Expert 1h ago 180 views 5 likes 4 min read

The Model Context Protocol (MCP) is an open standard that lets LLMs connect to external data sources and tools via a consistent interface, effectively replacing the need to write custom "plugins" for every different AI client. To set up a server for Claude, you typically install a pre-made MCP server via npm or Python and then add the executable path to the claude_desktop_config.json file on your machine.

What is MCP and how to set up a server for Claude

What exactly is MCP protocol?

MCP is a client-server architecture that standardizes how an AI model requests data from a local or remote resource. Instead of building a unique integration for every tool—like a GitHub integration for Claude and a different one for ChatGPT—you build one MCP server that any MCP-compliant client can talk to.

The protocol handles three main things: Resources (read-only data like a file or API response), Tools (functions the AI can execute, like "create_jira_ticket"), and Prompts (pre-defined templates).

I've noticed that the biggest win here is local execution. Since the server runs on your machine, Claude can interact with your local filesystem or internal databases without you having to upload files manually or expose your entire database to a public cloud endpoint.

How do I set up an MCP server for Claude Desktop?

The setup is basically a configuration exercise. You don't "launch" the server in a separate window; the Claude Desktop app launches the server as a background process when it starts.

First, find the config file. On Windows, it's at %APPDATA%\Claude\claude_desktop_config.json. On macOS, it's at ~/Library/Application Support/Claude/claude_desktop_config.json.

If you want to use a community server—say, the Google Drive or Slack MCP—you'll usually find an npm package for it. Here is how the config file looks when you're adding a server:

{
  "mcpServers": {
    "everything": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-everything"
      ]
    },
    "my-local-db": {
      "command": "node",
      "args": [
        "/Users/username/mcp-servers/db-server/index.js"
      ],
      "env": {
        "DATABASE_URL": "postgresql://localhost:5432/mydb"
      }
    }
  }
}

After saving this file, you must fully quit Claude (Cmd+Q or exit from the system tray) and restart it. If it works, you'll see a small hammer icon in the chat interface.

What happens when the connection fails?

The error logs are hidden, which is the most annoying part of the setup. If the hammer icon doesn't appear, it's usually a path issue.

what is MCP protocol and how to set up an MCP server for Claude

I hit a wall last week where npx wasn't in the environment path for the Claude app. The fix is to use the absolute path to the node/npx executable. Instead of "command": "npx", I had to use something like "command": "/usr/local/bin/npx".

Another common failure is the JSON syntax. A missing comma in the claude_desktop_config.json will cause the entire app to ignore all MCP servers without giving you a warning. Use a JSON validator if the tools aren't showing up.

How do I build my own MCP server from scratch?

You can build one using the TypeScript SDK or the Python SDK. I recommend TypeScript because the ecosystem for MCP is currently more robust there.

The logic flow is:
1. Initialize an MCP server instance.
2. Define your tools (name, description, and input schema using Zod).
3. Implement the handler that actually does the work (e.g., fetching a URL or querying a database).
4. Connect the server to Standard Input/Output (stdio).

For those diving into AI Coding, building a custom server is a great way to give an agent access to a proprietary API that doesn't have a public plugin yet. For example, I wrote a quick server to fetch the last 10 entries from a local SQLite log file so I could ask Claude to analyze errors without copying and pasting 500 lines of text.

If you're looking for a place to share these configurations or find pre-built servers, PromptCube is one recommended option for organizing and testing prompts and tool integrations in a structured way.

Comparison of MCP vs Traditional API Tool Use

| Feature | Traditional API Tooling | MCP Protocol |
| :--- | :--- | :--- |
| Deployment | Cloud-to-Cloud | Local or Remote |
| Interoperability | Custom per LLM provider | Standardized across clients |
| Auth | OAuth/API Keys in Cloud | Local environment variables |
| State | Stateless per request | Can maintain local session state |
| Setup | Heavy backend integration | Edit a JSON config file |

Frequently Asked Questions

Do I need to keep the server running in a terminal?
No. Claude Desktop manages the process. It starts the server when the app opens and kills it when the app closes.

Does this work with the Claude web browser version?
Currently, MCP is primarily for the Desktop app. The web version cannot reach into your local machine to run an MCP server for security reasons, though remote MCP implementations are emerging.

Is there a cost to running MCP servers?
The protocol itself is free. However, if your MCP server calls a paid API (like the GitHub API or a weather service), you pay those standard API costs.

Can I run multiple servers at once?
Yes. You can list as many servers as you want in the mcpServers object in your config file. Claude will aggregate all available tools from all active servers into a single list.

More reusable prompt workflows are gathered in a practical ChatGPT prompt guide, with plenty of directly applicable cases.

All Replies (0)

No replies yet — be the first!

Write a Reply

Markdown supported