What is an MCP server?
An MCP server is a program that exposes tools, data and prompt templates to AI applications through the Model Context Protocol (MCP). Anthropic released MCP as an open standard on 25 November 2024, and it is now supported by Claude, ChatGPT, Visual Studio Code and many other AI tools. Instead of every AI app writing its own plug-in for GitHub, a database or your company's API, the service is wrapped once as an MCP server and any MCP-compatible app can use it.
The MCP documentation splits every setup into three roles:
- MCP host: the AI application you use, such as Claude Desktop, ChatGPT or VS Code.
- MCP client: a connection object the host creates for each server. One host can hold many clients, one per server.
- MCP server: the program that provides the context, whether it runs on your laptop or on a server across the internet.
An MCP server is not an AI model. It does not think or generate text. It lists what it can do, the AI model decides when to use it, and the host sends the request and returns the result to the model.
What an MCP server provides: tools, resources and prompts
| Primitive | What it is | Example | Main methods |
|---|---|---|---|
| Tools | Functions the AI model can call to take an action | Run a database query, create a GitHub issue, fetch a weather report | tools/list, tools/call |
| Resources | Data sources that give the model context (read by the client with resources/read) | A file's contents, a database schema, an API response | resources/list, resources/read |
| Prompts | Reusable templates for a task | A "review this pull request" template with few-shot examples | prompts/list, prompts/get |
Messages between client and server use JSON-RPC 2.0. The client asks tools/list what tools exist, passes their names, descriptions and input schemas to the model, and calls tools/call when the model picks one.
What is an MCP server in AI?
A large language model on its own only knows its training data and what you type. To read your files, query your sales figures or open a ticket, it needs tools. Before MCP, every AI product had its own plug-in format, so a company that wanted its service available in three AI apps had to build three integrations. MCP replaces that with one protocol: build the server once, and every host that speaks MCP can connect to it.
The MCP documentation is explicit that MCP only covers the exchange of context. It does not decide which model you use or how the app uses what the server returns.
How does an MCP server work?
In protocol version 2026-07-28, MCP is stateless: every request carries the protocol version and the client's capabilities in its _meta field, so the server can handle each request on its own. A typical exchange looks like this:
- Discovery (optional). The client sends
server/discover, which every server must implement, and gets back the protocol versions, capabilities and identity the server supports. - Listing. The client calls
tools/list(andresources/listorprompts/listif the server offers them) and hands the tool names, descriptions and input schemas to the model. - Calling. When the model decides a tool is needed, the host sends
tools/callwith the arguments, usually after showing it to you for approval. - Result. The server runs the action, for example a database query or an API request, and returns text, images or structured JSON, which the host passes back to the model.
If the server needs more input during a call, such as a confirmation from you, it returns an "input required" result and the client retries the call with the answer. Servers built for the older handshake-based versions (2025-11-25 and earlier) start with an initialize request instead; the specification describes how newer clients detect them and fall back.
MCP server vs API
| Ordinary REST API | MCP server | |
|---|---|---|
| Written for | Developers writing code against documented endpoints | AI applications that discover tools at run time |
| Discovery | Read the docs, then code each call | tools/list returns names, descriptions and JSON Schemas the model reads |
| Message format | Any (usually JSON over HTTP verbs) | JSON-RPC 2.0 over stdio or Streamable HTTP |
| Who decides the call | Your code | The AI model, usually with the user approving it |
| Relationship | Many MCP servers are thin wrappers that call an existing API on the model's behalf | |
MCP transports: stdio vs Streamable HTTP
The specification defines two standard transports. The messages are the same on both; only the way they are carried changes.
| stdio (local) | Streamable HTTP (remote) | |
|---|---|---|
| Where the server runs | On the same machine, launched by the client as a subprocess | As an independent web service, anywhere on a network |
| How messages travel | Newline-delimited JSON-RPC on stdin and stdout | Each message is an HTTP POST to one MCP endpoint, such as https://example.com/mcp |
| Responses | On stdout, one message per line | A single JSON object, or a Server-Sent Events (SSE) stream for that request |
| Clients served | Typically one | Typically many |
| Authentication | Credentials come from environment variables | HTTP authentication; the spec's authorization section is based on OAuth 2.1 |
| Logging | stderr only; anything else on stdout breaks the protocol | Normal server logs |
| Good for | Desktop tools, file access, developer tools on your own machine | Shared team tools, SaaS integrations, servers that ChatGPT or Claude on the web must reach |
Two details trip people up. First, a stdio server must never print to stdout: the official build guide warns that a stray print() or console.log() corrupts the JSON-RPC stream. Log to stderr instead. Second, Streamable HTTP has changed between versions. It replaced the older HTTP+SSE transport in protocol version 2025-03-26, and version 2026-07-28 removed protocol-level sessions (the Mcp-Session-Id header) and the separate GET stream. Every request now carries its protocol version, and the client sends an MCP-Protocol-Version header with each POST. If a tutorial shows session IDs, it was written for an earlier revision; the specification describes how clients and servers fall back to talk to older versions.
How Claude, ChatGPT and VS Code connect to an MCP server
| Client | Local (stdio) servers | Remote servers | Remote authentication |
|---|---|---|---|
| Claude Desktop | Yes, listed in claude_desktop_config.json under mcpServers with a command and args | Yes, as a custom connector | OAuth, no sign-in, or fixed request headers such as an API key or bearer token |
| Claude on the web | No | Yes: Customize > Connectors, then + Add > Add custom connector (on Team and Enterprise, an owner adds it first) | As above |
| ChatGPT (custom MCP servers, on the web) | No local command servers; a private or local server can be reached through a Secure MCP Tunnel linked to the ChatGPT workspace | Yes, by server URL; SSE and streaming HTTP | OAuth, no authentication, or mixed (OAuth or no authentication) |
| VS Code | Yes, as a command (stdio) server | Yes, as an HTTP server (HTTP or SSE) | As the server publisher documents; review any trust request before accepting it |
The point that matters most for hosting: Claude's custom connectors reach your server from Anthropic's cloud, not from your laptop. Anthropic's help article says this applies even in Claude Desktop: the server must be reachable over the public internet from Anthropic's IP ranges, on the standard HTTPS port, and Claude cannot connect to a URL that names another port. A server that listens only on localhost cannot be used as a custom connector. A server behind a firewall can be, if you allowlist the outbound IP ranges Anthropic publishes for MCP tool calls (the "Outbound IP addresses" section of platform.claude.com/docs/en/api/ip-addresses). For a Claude custom connector you therefore need a public HTTPS endpoint, which is what the VPS section below sets up.
ChatGPT works differently. Its custom MCP server setup takes either a server URL or a Secure MCP Tunnel: a tunnel-client inside your network long-polls OpenAI and forwards each request to the private server, so OpenAI's documentation says the server does not need a public listener or an open inbound firewall port. Creating a tunnel and selecting it need tunnel permissions in your OpenAI organisation, and the tunnel must be linked to the ChatGPT workspace you use. A public HTTPS endpoint on a VPS is still the simpler option when you want the server online all the time or shared with clients outside your workspace.
On Claude Desktop, the config file is at %APPDATA%\Claude\claude_desktop_config.json on Windows, ~/Library/Application Support/Claude/claude_desktop_config.json on macOS and ~/.config/Claude/claude_desktop_config.json on Linux. Restart the app after editing it.
MCP server security: authentication, least privilege and prompt injection
An MCP server lets an AI model act with real permissions, so it deserves the same care as any other public API, plus a few risks that are specific to AI.
Authentication
- Authorization is optional in the specification, but any remote server holding private data needs it. For HTTP servers the spec builds on OAuth 2.1: the server publishes OAuth 2.0 Protected Resource Metadata (RFC 9728), and clients must use Resource Indicators (RFC 8707) so each token names the server it is for.
- Servers must check that every token was issued for them and reject anything else. Passing a client's token straight through to another API ("token passthrough") is explicitly forbidden.
- Tokens go in the
Authorization: Bearerheader on every request, never in the URL query string. - A static bearer token is simpler and works with Claude's request headers, but ChatGPT's documentation lists only OAuth or no authentication. Choose based on the clients you need.
Least privilege
- Give the server its own API key or database user with only the rights its tools need: read-only where possible, one schema, one repository.
- Expose few, narrow tools. A
run_sqltool that accepts any query is far riskier thanget_order_status(order_id). - If you use OAuth scopes, the security best-practices page recommends a small starting scope set and asking for more only when a privileged tool is first used. Wildcard or omnibus scopes such as
*,allorfull-accessare listed as a common mistake. - Mark read-only tools with the
readOnlyHintannotation. ChatGPT treats tools without it as write actions and asks the user to confirm them.
Prompt injection and untrusted servers
Prompt injection is text that changes what the model does. The indirect kind arrives through content the model reads, such as a web page, an email or a file returned by a tool. Through MCP, a poisoned document can tell the model to call another tool and send data somewhere it should not go. The tools specification asks for a human in the loop who can deny tool calls, and says clients must treat tool annotations as untrusted unless they come from a trusted server. In practice:
- Keep approval prompts on for any tool that writes, deletes, pays or sends.
- Do not connect servers from unknown publishers. A local stdio server runs with your user account's permissions, and a malicious one can run any command you could.
- Validate all tool inputs on the server, rate-limit tool calls and sanitise outputs. The specification lists all of these as server MUSTs.
- Avoid connecting a tool that reads untrusted content and a tool that can send data out in the same session unless a person reviews each call.
How to self-host a remote MCP server on a VPS in India
A remote MCP server is just a small web service. A Linux VPS with a public IP, a domain name and a TLS certificate gives Claude's custom connectors the public HTTPS endpoint they need, and lets ChatGPT connect by URL without a tunnel. Running it on a server in Mumbai or Delhi NCR keeps the MCP server and any database it uses in India, close to Indian users. Tool results are still sent to the AI provider you connect, and tools that call outside services such as GitHub handle data wherever those services run.
- Set up the server. Start with a fresh Ubuntu VPS, create a non-root user, use SSH keys and turn on a firewall that allows only SSH, 80 and 443. Our Ubuntu VPS initial setup guide covers each step.
- Point a subdomain at it. Create an A record such as
mcp.example.inpointing to the VPS IP. See how to point a domain to a VPS. - Run your MCP server on localhost only. Build it with an official MCP SDK in its Streamable HTTP mode and bind it to
127.0.0.1on a high port such as 8000, so only the reverse proxy can reach it. The specification recommends binding to localhost rather than all interfaces. Run it under systemd or in Docker (install Docker on Ubuntu) so it restarts after a reboot. - Put a reverse proxy with TLS in front. The proxy terminates HTTPS on port 443 and forwards to the server. Caddy is the shortest route because it gets and renews Let's Encrypt certificates on its own once DNS points to the server and ports 80 and 443 are open:
Caddy replacesmcp.example.in { @noauth not header Authorization "Bearer {$MCP_TOKEN}" respond @noauth 401 reverse_proxy 127.0.0.1:8000 }{$MCP_TOKEN}with the environment variable when it loads the config, and it flushestext/event-streamresponses immediately, so SSE replies are not held back. The token check is a simple gate for clients that send a fixed header; for ChatGPT, or for many users, implement OAuth in the server itself. - Or use nginx. If nginx already serves your sites, add a location block and get a certificate with Certbot:
nginx buffers proxied responses by default, which delays SSE events. The spec asks servers to sendlocation /mcp { proxy_pass http://127.0.0.1:8000; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto $scheme; proxy_buffering off; proxy_read_timeout 3600s; }X-Accel-Buffering: no, andproxy_buffering offcovers servers that do not. The defaultproxy_read_timeoutis 60 seconds between two reads, so a quietsubscriptions/listenstream can be cut unless you raise it or the server sends SSE keep-alive comments, which the spec encourages. - Check the server's own protections. It must validate the
Originheader and return 403 for an invalid one, and it should authenticate every request. - Connect a client. In Claude, add a custom connector with
https://mcp.example.in/mcpand the authentication you chose. In ChatGPT on the web, add it as a custom MCP server with the same URL. Test it first with the official MCP Inspector to see the tool list and try calls.
What size VPS does an MCP server need?
Most MCP servers are small processes that wait for a request, call an API or database, and return the result, so their own CPU and memory use is usually low. What sets the size is what runs beside them: a database, a headless browser for a scraping tool, or an automation tool such as n8n. Measure the memory of your server under real use rather than guessing, and use our guide on how much RAM a VPS needs to size the rest. We have not benchmarked specific MCP servers, so we do not quote RAM figures for them here.
Our KVM VPS starts at ₹674 (US$7.66) per 30 days plus 18% GST for 2 vCPU, 4 GB RAM, 40 GB NVMe and 5 TB of transfer, with full root access, in Mumbai (BOM-1) or Delhi NCR (DEL-1). Each 30-day period is paid in advance, Linux servers are usually ready in under 60 seconds, and you can move up a plan later. See KVM VPS plans.
This guide was written by the Bigdomainhost team with AI assistance; Bigdomainhost sells the VPS plans mentioned. Protocol details were checked against the MCP specification, version 2026-07-28, and client details against each vendor's documentation on 25 November 2026. MCP changes quickly, so check the linked pages before you build.
Sources (checked )
- Model Context Protocol: Architecture overview (hosts, clients, servers, primitives)
- Model Context Protocol: Specification 2026-07-28: Transports
- Model Context Protocol: Specification 2026-07-28: stdio transport
- Model Context Protocol: Specification 2026-07-28: Streamable HTTP transport
- Model Context Protocol: Specification 2026-07-28: Authorization
- Model Context Protocol: Specification 2026-07-28: Tools (security considerations)
- Model Context Protocol: Security best practices
- Model Context Protocol: Versioning (current version 2026-07-28)
- Model Context Protocol: Connect to local MCP servers (Claude Desktop config)
- Model Context Protocol: Build an MCP server (stdout logging warning)
- Anthropic: Introducing the Model Context Protocol (25 November 2024)
- Claude Help Center: Getting started with custom connectors using remote MCP
- Anthropic: IP addresses (outbound ranges used for MCP tool calls)
- OpenAI: Add custom MCP server (ChatGPT)
- OpenAI: Secure MCP Tunnel (private MCP servers)
- Visual Studio Code: Add and manage MCP servers in VS Code
- OWASP GenAI Security Project: LLM01: Prompt Injection
- Caddy: Automatic HTTPS
- Caddy: reverse_proxy directive (flush_interval, text/event-stream)
- Caddy: Request matchers
- Caddy: Caddyfile concepts: environment variables
- nginx: ngx_http_proxy_module (proxy_buffering, proxy_read_timeout)