Tutorial

This tutorial walks you through the most common things you'll do with mcp. By the end, you'll know how to configure servers, authenticate, explore tools, call them, and use mcp in scripts.

Prerequisites: You've completed the Getting started guide and have mcp installed.

Part 1: Understanding servers

MCP servers come in two flavors:

Stdio servers

These run as a local process. The CLI spawns them, sends JSON-RPC messages to their stdin, and reads responses from their stdout. Most community servers work this way.

{
  "mcpServers": {
    "slack": {
      "command": "npx",
      "args": ["-y", "slack-mcp-server@latest", "--transport", "stdio"],
      "env": {
        "SLACK_MCP_XOXP_TOKEN": "${SLACK_TOKEN}"
      }
    }
  }
}

HTTP servers

These are remote services. The CLI sends HTTP POST requests with JSON-RPC payloads. Some services like Sentry and Honeycomb offer hosted MCP servers.

Part 2: Configuring servers manually

The config file lives at ~/.config/mcp/servers.json. You can edit it directly.

Let's add Sentry manually:

Edit ~/.config/mcp/servers.json:

Verify it's configured:

Part 3: Authentication

When you first connect to an HTTP server that requires authentication, mcp handles it automatically.

If the server supports OAuth 2.0, your browser opens to authorize the app. After you approve, the token is saved to ~/.config/mcp/auth.json and reused automatically.

If OAuth isn't supported, mcp recognizes popular services and shows you where to get a token:

You paste the token, it's saved, and you're in.

Using environment variables for tokens

For servers that need a token in headers, use env vars instead of hardcoding secrets:

Then set the env var in your shell:

Part 4: Exploring tools

Every server exposes different tools. Use --list to see what's available:

To see the full input schema (what arguments each tool accepts):

This tells you exactly what JSON to pass.

Part 5: Calling tools

Pass the tool name and a JSON object:

The response is always a JSON object with a content array:

Reading arguments from stdin

Instead of passing JSON on the command line, you can pipe it:

This is useful when arguments are complex or come from another command:

Parsing output with jq

Since output is JSON, pipe to jq for filtering:

Part 6: Managing servers

Search the registry

Find servers from the official MCP registry:

Add from registry

The CLI fetches the server metadata, writes the config entry, and tells you which env vars to set.

Add HTTP server manually

Remove a server

Part 7: Real-world example

Let's put it together. You want to find unresolved Sentry errors, check Grafana dashboards for related metrics, and post a summary to Slack.

Each service is just another command. No SDKs, no client libraries, no boilerplate.

What's next?

Last updated

Was this helpful?