Connecting to an MCP Server

Understanding how a client is supposed to connect to a server

Every MCP session starts with a connection. The spec defines how a client and a server agree to talk, and getting that handshake right is the difference between a smooth integration and a debugging session you didn’t plan for.

Transports

The Model Context Protocol defines two transports today:

  • stdio — the client spawns the server as a subprocess and communicates over stdin/stdout. Great for local, agent-local tools where the “server” is just another process on your machine.
  • Streamable HTTP — the client and server talk over HTTP(S), with the server exposing a single endpoint. This is what you reach for when the server lives remotely, or when you need to authenticate.

Choosing between them comes down to where the server lives and what it needs to touch. Local tooling tends to favor stdio; anything multi-tenant or network-reachable ends up on Streamable HTTP.

The initialization handshake

After the transport is up, client and server perform an initialize exchange:

  1. The client sends an initialize request with its protocol version, capabilities, and client info.
  2. The server responds with its own supported version, capabilities, and server info.
  3. Both sides send an initialized notification to signal they’re done negotiating.

Capabilities matter — they’re how the two sides agree on what features are actually usable, instead of assuming a shared baseline. If you ignore them, you’ll ship code that breaks the moment you pair against a differently-capable peer.

Authentication

For HTTP transports, MCP leans on OAuth 2.1 — scopes, token lifetimes, PKCE, and RFC 8707 resource indicators that bind a token to a specific server. That’s the same OAuth world I work in day to day. If you’re standing up a server behind an enterprise IdP, this is exactly where the trust chain gets built: the client authenticates to the IdP, the server validates the token, and everyone agrees on what the client is allowed to do.

Wrap-up

The connection story is: pick a transport, negotiate a protocol version, and sort out auth before anything else. The rest of the protocol builds on that foundation.

I’ll keep expanding these notes as I dig deeper into MCP internals — if there’s a specific piece you’d like me to cover, this is a conversation.