DroidCrunch
  • About
  • Blog
  • Categories
    • Automation
    • Tech
    • SEO
    • WordPress
    • Software
    • Hosting
    • Proxy
  • AI
    • AI Writing
    • AI Image
    • AI Tool
    • AI Video
  • Deals
  • Contact
Subscribe
No Result
View All Result
DroidCrunch
  • About
  • Blog
  • Categories
    • Automation
    • Tech
    • SEO
    • WordPress
    • Software
    • Hosting
    • Proxy
  • AI
    • AI Writing
    • AI Image
    • AI Tool
    • AI Video
  • Deals
  • Contact
Subscribe
DroidCrunch

What Is an MCP Server? How It Works, With One We Built 2026

Lokesh Kapoor by Lokesh Kapoor
December 1, 2026
3
0

An MCP server is a small program that gives AI apps such as Claude, ChatGPT and Cursor a standard set of tools and data to use. It speaks the Model Context Protocol, so any MCP client can connect without a custom integration.

To write this, we built a working MCP server in 50 lines of Python, connected to it locally and over HTTP, and timed every call. Below are the code, the real results, and how servers differ from APIs and plugins.

What an MCP server does

MCP, the Model Context Protocol, is an open standard for connecting AI apps to outside systems. Our explainer on what MCP is covers the protocol as a whole. This article is about the server side: the part you install or build.

An MCP server sits between an AI app and something useful, such as a database, a file system, a website or a SaaS product. It tells the AI app what it offers, accepts requests, does the work and returns results in a standard format.

PartWhat it isExample
HostThe AI app you useClaude Desktop, Cursor, ChatGPT
ClientThe connector inside the host that talks to one serverOne per connected server
ServerThe program that offers tools and dataA GitHub, database or WordPress MCP server
ModelThe AI that decides which tool to callClaude, GPT, Gemini
The parts of an MCP setup.

The client and host are often the same app. When you add a server to Claude Desktop, Claude Desktop is the host, it runs an MCP client for each server, and the model decides when to call the tools.

MCP server vs MCP client

The two words get mixed up because they always appear together. The server offers capabilities; the client consumes them on behalf of an AI app.

MCP serverMCP client
RoleOffers tools, resources and promptsConnects to a server and uses them
Lives inIts own process or web serviceThe AI app, one per connected server
Starts the conversationNo; it waits for requestsYes; it sends initialize
Who builds itService owners and developersAI app makers
ExampleOur droidcrunch-posts serverThe connector inside Claude Desktop or Cursor
MCP servers and clients compared.

In our test, the “client” was a 30-line Python script using the SDK’s Client class. It connected, listed tools, called them 20 times and measured the timings. In everyday use, the client is built into the app you already use, and you never see it.

The three things a server can offer

Every MCP server exposes some combination of three building blocks, which the protocol calls primitives.

PrimitiveWhat it isWho decides to use itOur test server
ToolsFunctions the AI can call to do something or fetch dataThe modelsearch_posts, count_posts
ResourcesRead-only data the app can load as contextThe app or userposts://all, the full list
PromptsReusable prompt templates with parametersThe userrelated_reading(topic)
The three MCP primitives, with the ones our test server offers.

Most servers are mostly tools. Our test server offers all three so you can see each one working.

How an MCP server works, step by step

The steps at a glance

  1. 1
    Step 1 of 6

    The client connects

    The AI app launches a local server or opens an HTTP connection to a remote one.

  2. 2
    Step 2 of 6

    They agree on a version

    The client sends initialize; the server replies with its protocol version, name and what it supports.

  3. 3
    Step 3 of 6

    The client asks what's available

    It requests the list of tools, resources and prompts, each with a description and input schema.

  4. 4
    Step 4 of 6

    The model picks a tool

    When your request needs it, the model chooses a tool and fills in the arguments.

  5. 5
    Step 5 of 6

    The server does the work

    It validates the input, runs the function and returns text and structured results, or an error.

  6. 6
    Step 6 of 6

    The model uses the result

    The answer goes back into the conversation, and the model may call more tools before replying.

Under the hood, every message is JSON-RPC 2.0: a small JSON object with a method name, parameters and an ID. Here’s the real initialize response our test server sent back when we connected with curl:

initialize response (from our server) JSON
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "protocolVersion": "2025-11-25",
    "capabilities": {
      "prompts": { "listChanged": false },
      "resources": { "listChanged": false, "subscribe": false },
      "tools": { "listChanged": false }
    },
    "instructions": "Search DroidCrunch article titles.",
    "serverInfo": { "name": "droidcrunch-posts", "version": "" }
  }
}

And here’s a real tool call and its result. The server returns both plain text, which any model can read, and structured content, which code can use directly:

tools/call count_posts (request and response) JSON
// request
{ "jsonrpc": "2.0", "id": 2, "method": "tools/call",
  "params": { "name": "count_posts", "arguments": {} } }

// response
{ "jsonrpc": "2.0", "id": 2,
  "result": {
    "content": [ { "type": "text", "text": "300" } ],
    "isError": false,
    "structuredContent": { "result": 300 }
  } }

We built an MCP server in 50 lines

The plan for this article asked for a small server built from scratch. Ours searches a list of 300 DroidCrunch article titles. It uses the official Python SDK, version 2.3.0, installed with pip install "mcp[cli]".

server.py Python
"""A small MCP server: searches a list of DroidCrunch posts."""
import sys
from pathlib import Path
from mcp.server.mcpserver import MCPServer

POSTS = Path(__file__).with_name("posts.txt")
server = MCPServer("droidcrunch-posts", instructions="Search DroidCrunch article titles.")


def load_posts() -> list[tuple[str, str]]:
    rows = []
    for line in POSTS.read_text().splitlines():
        slug, _, title = line.partition("|")
        rows.append((slug, title))
    return rows


@server.tool()
def search_posts(query: str, limit: int = 5) -> list[dict]:
    """Find articles whose title contains every word in the query."""
    words = query.lower().split()
    hits = [
        {"slug": s, "title": t, "url": f"https://droidcrunch.com/{s}/"}
        for s, t in load_posts()
        if all(w in t.lower() for w in words)
    ]
    return hits[:limit]


@server.tool()
def count_posts() -> int:
    """Return how many articles are in the list."""
    return len(load_posts())


@server.resource("posts://all")
def all_posts() -> str:
    """The full list of slugs and titles, one per line."""
    return POSTS.read_text()


@server.prompt()
def related_reading(topic: str) -> str:
    """A prompt template that asks for related DroidCrunch reading."""
    return f"Use search_posts to find three DroidCrunch articles about {topic}, then explain why each is relevant."


if __name__ == "__main__":
    transport = sys.argv[1] if len(sys.argv) > 1 else "stdio"
    server.run(transport)

A few details are worth pointing out:

  • The decorators do the protocol work. @server.tool() reads the function’s name, type hints and docstring and turns them into a tool definition with a JSON schema. We never wrote a schema by hand.
  • Docstrings matter. The model only sees the tool name, description and input schema. “Find articles whose title contains every word in the query” tells it when and how to use the tool.
  • One file, two transports. The same code runs over STDIO for local apps or Streamable HTTP for remote clients, chosen by one argument.

A version gotcha we hit

Most tutorials still import FastMCP from mcp.server.fastmcp. In version 2 of the Python SDK, that import fails with a clear error: FastMCP was renamed to MCPServer and moved to mcp.server.mcpserver. If you follow an older guide, either change the import or pin mcp<2.

What the client saw

We connected with the SDK’s own client, listed the tools and called them. The search for “vpn” with a limit of 3 returned three real articles, including our guide to how a VPN works, as both text and structured JSON.

We also sent bad input on purpose: a call missing the required query field, with limit set to the word “five”. The server didn’t crash. It returned a result flagged isError: true with a validation message the model can read and correct.

How an MCP server works: client, server, tools, resources and prompts
The server tells the AI app what it offers, then does the work when a tool is called.

Local vs remote MCP servers: our test results

MCP servers run in one of two ways. A local server runs on your computer as a child process of the AI app and talks over standard input and output (STDIO). A remote server runs on a web server and talks over Streamable HTTP. We ran the same server both ways on one machine and timed it.

MeasureLocal (STDIO)Remote style (Streamable HTTP)
Connect and handshake516 ms34 ms
List tools3 ms3 ms
First tool call41 ms37 ms
Median of 20 calls1.6 ms2.4 ms
95th percentile of 20 calls2.5 ms3.0 ms
Bad inputReturned isError with a validation messageSame
Our MCP server timed over both transports on one machine, 24 November. HTTP ran on localhost, so network latency isn’t included.

Three findings stood out:

  • Starting a local server is the slow part. The STDIO connection took about half a second because the client had to launch a new Python process. After that, calls were faster than over HTTP.
  • Individual calls are tiny. Both transports answered simple calls in a few milliseconds. In real use, the tool’s own work, such as a database query or an API call, takes far longer than the protocol.
  • HTTP needs a session. A raw request without a session ID got 400 Bad Request: Missing session ID. Clients handle this automatically; it only matters if you’re testing with curl.

Our HTTP test ran on the same machine as the client, so it shows protocol overhead, not internet latency. On a real remote server, add your network round trip to every call.

Local server (STDIO)Remote server (HTTP)
Where it runsOn your computer, launched by the AI appOn a web server
Who can use itOnly you, on that computerAnyone you give access to
Sign-inUsually none; it runs as youOAuth, API keys or application passwords
Good forFiles, local tools, developmentSaaS products, shared team tools, websites
Setup on the clientCommand and arguments in a config fileA URL and a sign-in
Main riskRuns with your user’s permissionsExposed to the internet
Local and remote MCP servers compared.

MCP server examples

Thousands of MCP servers exist. These are the kinds most people use, with examples:

TypeWhat it lets an AI doExamples
FilesRead and write files in folders you allowFilesystem server
Code hostingRead issues, open pull requests, search codeGitHub MCP server
DatabasesQuery tables and inspect schemasPostgres and Supabase servers
BrowsersOpen pages, click and take screenshotsPlaywright MCP server
WebsitesManage posts, SEO and mediaWordPress MCP servers
Business appsRead and update recordsNotion, Slack and CRM servers
Web dataSearch and scrape the webFirecrawl and Apify servers
Common kinds of MCP server.

A big server next to our small one

We use a remote WordPress MCP server every day to stage DroidCrunch drafts, and its shape is very different from our 50-line test.

Our test serverDroidCrunch’s WordPress server
RunsLocally or on localhost HTTPRemote, on the live site
Tools shown to the client23 meta tools
Actions behind them2 tools, 1 resource, 1 prompt132 abilities from three plugins
Sign-inNoneA dedicated WordPress user
Can change thingsNoYes, so we use strict rules
Our 50-line test server next to the WordPress MCP server we use daily.

The WordPress server shows a pattern you’ll see in large servers: instead of listing 132 tools to the model, it exposes three meta tools (discover, get info, execute) and lets the agent look up what it needs. That keeps the tool list short, at the cost of an extra lookup step. Our Novamira review covers that setup in detail.

How to connect an MCP server to Claude, Cursor or ChatGPT

For a local server like ours, most desktop clients use a JSON config file that tells them how to launch it:

client config (local server) JSON
{
  "mcpServers": {
    "droidcrunch-posts": {
      "command": "/path/to/venv/bin/python",
      "args": ["/path/to/server.py", "stdio"]
    }
  }
}

Remote servers are simpler on the client side: you paste a URL and sign in, usually with OAuth. Our guide to connecting an MCP server to Claude, Cursor and ChatGPT shows where each app keeps its settings. We didn’t test the config above in Claude Desktop for this article, because our test machine has no desktop client; we tested with the official SDK client and raw HTTP requests.

How to build your own MCP server

The fastest path for most people is the one we took.

StepWhat we did
Pick an SDKOfficial Python SDK; TypeScript, Java, C#, Go and others also exist
Install itpip install “mcp[cli]” in a virtual environment
Write toolsPlain functions with type hints and docstrings, decorated with @server.tool()
Add resources and prompts if usefulOne of each in our server
Run itSTDIO for local use, streamable-http for remote
Test itSDK client, the MCP Inspector or raw HTTP requests
Connect a real clientAdd it to your AI app’s config or paste the URL
How we built our test server.

Adding a write tool safely

Read-only tools are easy. The moment a tool changes something, two details matter: telling clients what kind of change it makes, and returning errors the model can act on. We added a second server with one write tool to test both.

server_write.py Python
from pathlib import Path
from mcp.server.mcpserver import MCPServer
from mcp.types import ToolAnnotations
from mcp.server.mcpserver.exceptions import ToolError

NOTES = Path(__file__).with_name("notes-out.txt")
server = MCPServer("droidcrunch-notes")


@server.tool(annotations=ToolAnnotations(read_only_hint=False, destructive_hint=False, idempotent_hint=False))
def add_note(slug: str, note: str) -> str:
    """Append an editing note for one article. Does not change the article."""
    if len(note) > 500:
        raise ToolError("Keep notes under 500 characters.")
    with NOTES.open("a") as f:
        f.write(f"{slug}\t{note}\n")
    return f"Saved a note for {slug}."


if __name__ == "__main__":
    server.run("stdio")

The ToolAnnotations showed up in the tool list as readOnlyHint: false, destructiveHint: false and idempotentHint: false, which clients can use to decide when to ask you before running it.

The error handling taught us something. Our first version raised a normal Python ValueError for notes over 500 characters. The client got back only “Error executing tool add_note”, with our message hidden. Switching to the SDK’s ToolError passed the real message through: “Keep notes under 500 characters.” If you want the model to fix its own mistakes, raise ToolError with a clear instruction.

Testing with the MCP Inspector

Before connecting a real AI app, test your server with the official MCP Inspector, a browser-based tool that lists tools and lets you call them by hand. Run npx @modelcontextprotocol/inspector and point it at your server’s command or URL. It’s the quickest way to check schemas and error messages, because you see exactly what the model will see.

Design tips from building ours

  • Write tool descriptions for the model. Say what the tool does, when to use it and what each parameter means. Vague descriptions cause wrong calls.
  • Keep tools small and specific. “search_posts” beats “do_anything”. Agents choose better between a few clear tools than between many overlapping ones.
  • Return structured results. Return lists and objects, not prose. The SDK converts them into both text and structured content.
  • Limit output size. Add a limit parameter, like our limit, so a broad query doesn’t flood the model’s context.
  • Validate inputs. Type hints give you validation for free. Bad calls come back as readable errors instead of crashes.
  • Make write tools explicit. Name them clearly, such as delete_draft, and mark them as destructive so clients can ask the user first.

Running a remote MCP server

A local server is enough for personal use. To share a server with a team or connect it to web-based AI apps, it needs to run on a server with HTTPS and sign-in.

OptionGood forWatch out for
Small VPS with a reverse proxyFull control, low costYou handle updates, HTTPS and sign-in
Serverless platformsSpiky, light trafficCold starts and session handling
Container platformsTeams already using DockerMore setup than a single VPS
Inside an existing web appAdding MCP to a product you runKeep MCP permissions separate from admin rights
Where to host a remote MCP server.

Three things trip people up when they move from local to remote:

  • HTTPS is required in practice. Most clients refuse plain HTTP for remote servers. Put the server behind a reverse proxy such as Caddy or Nginx that handles certificates.
  • Sign-in is your job. The SDK supports OAuth, but you still decide who can connect and what each user can do. Never expose a remote server with no authentication.
  • Sessions need sticky routing. Streamable HTTP uses a session ID. If you run several copies behind a load balancer, send each session to the same copy or use a stateless setup.

For a small team, a single cheap VPS is plenty. Our protocol overhead was a few milliseconds per call, so the server’s real work and your network decide the speed, not MCP.

MCP server vs API vs plugin

People often ask whether MCP replaces APIs. It doesn’t; most MCP servers call an API behind the scenes. The difference is the audience.

APIMCP serverPlugin
Built forDevelopers writing codeAI apps discovering toolsOne specific app
DiscoveryRead the docsAsk the server for its tool listInstall from an app store
Works withAny code that can make requestsAny MCP-compatible AI appOnly its own host app
InputsEndpoint-specificTyped JSON schema per toolApp-specific
Typical relationshipThe underlying serviceA wrapper that often calls an APIA wrapper tied to one platform
MCP servers compared with APIs and plugins.

We built the same tool as both an API and an MCP server in our MCP vs API comparison if you want to see the trade-off in code. For the bigger picture of APIs themselves, see what an API is.

Local vs remote MCP server: a laptop process and a cloud server
Local servers run on your computer; remote servers run on the web.

When an MCP server is the wrong tool

MCP is useful, but it isn’t always the answer:

  • Fixed, repeated jobs. If the same steps run every day with no decisions, a script or an automation tool such as n8n is cheaper and more predictable than an AI choosing tools.
  • One app only. If only your own code will ever call a function, a normal API or library call is simpler.
  • Huge data transfers. Models read everything a tool returns. Returning thousands of rows wastes tokens; query and summarise on the server first.
  • High-risk actions with no review. Payments, deletions and account changes need human confirmation, however good the server is.

Are MCP servers safe?

An MCP server can do whatever its code allows, using whatever credentials you give it. That makes security a real concern, especially for servers you didn’t write.

RiskWhat it looks likeWhat to do
Too much accessA server with your admin token can delete thingsUse scoped tokens and low-privilege accounts
Untrusted codeA local server runs as you on your computerUse well-known publishers or read the code
Prompt injectionText inside a web page or file tells the model to misuse a toolKeep write tools behind confirmation
Leaked credentialsTokens pasted into shared config filesUse environment variables and never commit configs
Exposed remote serversAn HTTP server with no sign-inRequire OAuth or keys; restrict who can connect
The main MCP server risks and how to reduce them.

Our rules for any server we install: read the code or use a well-known publisher, give it the lowest permissions that work, prefer read-only tools until you trust it, and never paste production passwords into a config file you’ll share.

Troubleshooting

ProblemLikely causeFix
ImportError for FastMCPPython SDK version 2 renamed itImport MCPServer from mcp.server.mcpserver, or pin mcp<2
Client shows no toolsServer failed to startRun the server command in a terminal and read the error
400 Missing session IDRaw HTTP request without initializing firstSend initialize first and reuse the mcp-session-id header
Tool never gets calledVague name or descriptionDescribe what the tool does and when to use it
Model passes wrong argumentsUnclear parameter namesUse descriptive names, types and defaults
Huge responsesNo limit on resultsAdd a limit parameter and trim output
Common MCP server problems and fixes.

Should you build one?

If you want an AI app to use your own data or tools, yes. A useful read-only server takes an afternoon, and once it exists, every MCP client can use it. If a well-maintained server already exists for the service, such as GitHub, a database or WordPress, install that instead and spend the time on permissions.

For AI agents in general, our explainer on what an AI agent is covers where MCP servers fit into the bigger picture.

Heads-up: this article has no affiliate links. We use MCP servers to run parts of DroidCrunch, and we built the test server ourselves.

Can an MCP server work without the internet?

Yes. A local server that talks over STDIO needs no network at all, and it can work with local files and tools. The AI model itself may still need the internet unless you run a local model, such as one served through Ollama.

Do I need to know how to code to use an MCP server?

Not to use one. Many servers install with a few clicks or a URL and a sign-in. Building your own takes basic programming; our working example is 50 lines of Python using the official SDK.

Are MCP servers free?

The protocol and the official SDKs are free and open source, and many servers are free. Some remote servers belong to paid products, and the AI app you connect may need a paid plan. Hosting your own remote server costs whatever your server costs.

Can one AI app use several MCP servers at once?

Yes. Clients such as Claude Desktop and Cursor can connect to many servers, and the model chooses tools from all of them. Too many overlapping tools can confuse it, so connect the servers you actually need.

What languages can I build an MCP server in?

Official SDKs exist for Python, TypeScript, Java, Kotlin, C#, Go, Ruby, Rust, Swift and PHP, among others. Python and TypeScript have the most examples. Any language works if it implements the protocol’s JSON-RPC messages correctly.

Where can I find MCP servers to install?

Start with the official MCP servers repository and registry, then the integrations listed by the apps you use. Many companies now publish their own official servers. Prefer those over unofficial copies when the server will hold your credentials.

Can an MCP server run on my phone?

Not usually as a local server, because mobile apps can’t launch background processes the way desktop apps do. Mobile AI apps that support MCP connect to remote servers over HTTP instead.

Summarize this article with AI

Get the key points in seconds. Pick an assistant and it opens in a new tab, ready to go.

ChatGPTClaudePerplexityGoogle AIGrokMistral

Opens in a new tab. Nothing is shared until you pick an assistant.

Share4Tweet2Share1Share
Previous Post

What Is an LLM? How Large Language Models Work 2026

Lokesh Kapoor

Lokesh Kapoor

I am Lokesh Kapoor who loves to write blogs, create videos and watch sci-fi movies on Netflix and Jio Cinema. DroidCrunch is my first love and a crucial part of my life.

Related Posts

What is an LLM: title card showing a chat reply being built one predicted word at a time

What Is an LLM? How Large Language Models Work 2026

December 1, 2026
297
WordPress.com vs WordPress.org: title card showing self-hosted server and hosted cloud options

WordPress.com vs WordPress.org: The Real Difference 2026

November 30, 2026
298
Is WordPress free: title card with a website window and a cost receipt

Is WordPress Free? What It Really Costs to Run a Site 2026

November 30, 2026
298
How much does web hosting cost: title card with a hosting price card showing a renewal increase

How Much Does Web Hosting Cost? Real Prices and Renewals 2026

November 29, 2026
301
Load More

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

I agree to the Terms & Conditions and Privacy Policy.

DroidCrunch

Tested first. Then written.

Independent software reviews since 2016. Search the archive, or start with a topic.

WordPressAI toolsHostingVPNSEO
  • 650+reviews, comparisons and guides
  • 243product reviews
  • 36topics covered
  • 2016publishing since
home

An independent tech blog and YouTube channel. We use every tool before we rate it, and we always tell you the catch.

Topics

  • WordPress
  • AI tools
  • Hosting
  • SEO
  • VPN
  • Proxies
  • Automation

Company

  • About DroidCrunch
  • Editorial policy
  • Affiliate disclaimer
  • Write for us
  • Contact

Explore

  • All articles
  • Reviews
  • Deals and coupons
  • Black FridayLive
  • Facebook group
  • Help and support

Recently scored

  • miniOrange Secure MCP Server75%
  • Royal MCP80%
  • WPVibe76%
  • Zapier82%
All reviews

Reader-supportedWhen you buy through our links, we may earn a commission at no extra cost to you. It never changes our verdicts. Read our affiliate disclaimer.

© 2026 DroidCrunch. Independent since 2016.

  • Privacy policy
  • Terms
  • Cookie policy
  • Your GDPR rights
  • RSS
Back to top

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In

Add New Playlist

No Result
View All Result
Subscribe
  • About
  • Blog
  • Categories
    • Automation
    • Tech
    • SEO
    • WordPress
    • Software
    • Hosting
    • Proxy
  • AI
    • AI Writing
    • AI Image
    • AI Tool
    • AI Video
  • Deals
  • Contact

© 2026 DroidCrunch - Best Place for Tech NomadPrivacy PolicyTerms & ConditionsCookie PolicyGDPR RightsAffiliate Disclosure

DroidCrunch Giveaway

Amazon Gift Card worth $15

Participate now and get a chance to become a lucky winner to receive the reward.​

Join Giveaway