October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk8 min

How to Build Your First MCP Server: A Step-by-Step Guide for Developers (2026)

Create a minimal MCP server with a testable tool, choose the right transport, and verify discovery and invocation before exposing an endpoint remotely.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Build a small MCP server by registering one useful capability, connecting it to a transport, then checking that an MCP client can discover and invoke it. For a first project, use stdio when a local client will launch your server as a process; choose Streamable HTTP when clients must reach it remotely. The examples below start with a deterministic add tool so you can test the whole loop before connecting real services.

MCP, or the Model Context Protocol, is an open standard for connecting AI applications to external systems. A server can expose tools, resources and prompts to hosts such as Claude Code, VS Code, Cursor or your own application. The official TypeScript and Python SDKs are Tier 1 choices; pick the language you already use, and keep the SDK major version consistent across your imports and setup.

As an Amazon Associate I earn from qualifying purchases.

Choose a language and pin the SDK version

For a first server, language familiarity matters more than choosing a supposedly superior SDK. Both official SDKs support MCP’s core server capabilities and standard transports.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Choice Use it when Version and setup
TypeScript Your project already uses Node.js and you want typed schemas alongside the rest of your application. The TypeScript SDK v2 is the stable line identified by its documentation for the 2026-07-28 specification. Its server package is @modelcontextprotocol/server. The v1 documentation uses the older monolithic @modelcontextprotocol/sdk package, so do not mix v1 imports with v2 setup.
Python You prefer Python tooling or want to implement the server in the same language as your existing scripts and services. The Python SDK documentation identifies v2 as current stable and requires Python 3.10 or later. Install it with uv add "mcp[cli]" or pip install "mcp[cli]".

The SDK catalog also lists C# and Go as Tier 1, Java and Rust as Tier 2, Ruby as Tier 2, and Swift, PHP and Kotlin as Tier 3. For a first implementation, TypeScript or Python is a practical choice because both are Tier 1 and have official SDKs.

Start with one tool you can verify

A tool is an action a connected model can ask the host to invoke. Keep the first one deterministic and independent of external credentials: adding two numbers is easier to inspect than a tool that calls a database or web API.

TypeScript v2 example using stdio

Create a Node project and install the v2 server package and schema library:

npm init -y
npm install @modelcontextprotocol/server zod

Save the following as src/index.ts. It creates an MCP server, registers one tool with a numeric input schema, creates a stdio transport and connects the server to it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
import { McpServer } from "@modelcontextprotocol/server";
import { StdioServerTransport } from "@modelcontextprotocol/server/stdio.js";
import { z } from "zod";

const server = new McpServer({
  name: "first-mcp-server",
  version: "1.0.0",
});

server.registerTool(
  "add",
  {
    description: "Add two numbers and return their sum.",
    inputSchema: {
      a: z.number(),
      b: z.number(),
    },
  },
  async ({ a, b }) => ({
    content: [{ type: "text", text: String(a + b) }],
  }),
);

const transport = new StdioServerTransport();
await server.connect(transport);

Run the file using a TypeScript runner or compile it to JavaScript first. The exact run command depends on your project’s chosen TypeScript setup; whichever route you use, make sure the MCP client launches the resulting process and that normal diagnostic output goes to stderr, not stdout. With stdio, stdout carries protocol messages.

Python example using stdio

Install the Python SDK with one of the documented commands above, then save this as server.py. The high-level FastMCP helper derives the tool’s argument schema from the function signature.

from mcp.server.fastmcp import FastMCP

mcp = FastMCP("first-mcp-server")

@mcp.tool()
def add(a: int, b: int) -> int:
    """Add two integers and return their sum."""
    return a + b

if __name__ == "__main__":
    mcp.run(transport="stdio")

Run it with python server.py from the environment where the SDK is installed. As with TypeScript stdio servers, keep logs off stdout so they cannot be mistaken for protocol traffic.

When a resource or prompt is a better fit

  • Use a tool for an action or computation, such as adding numbers, searching records or creating an item. Define the inputs the client may provide and validate them before doing work.
  • Use a resource for addressable context that a client can read, such as a document or a known configuration record. It is a better fit than a tool when the primary need is to expose read-only information rather than perform an action.
  • Use a prompt for a reusable prompt template that a client can retrieve and fill with arguments. It is not a substitute for a tool that needs to execute an operation.

Begin with one primitive that directly serves your use case. Add the others only when they represent distinct, useful capabilities.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose the transport for how clients will connect

Transport Topology What to plan for
stdio A local MCP host starts the server as a child process and exchanges protocol messages through standard input and output. Simple for local integrations; the host manages process startup and lifetime. Keep stdout reserved for the protocol and configure the client with the executable, arguments and any needed environment variables.
Streamable HTTP A client connects to a remotely reachable server over HTTP. The modern, fully featured transport for remote servers. Plan for authentication, network exposure, request handling and the deployment’s state model.
HTTP plus SSE An older HTTP/SSE transport used by clients that require the earlier protocol version. The TypeScript server documentation describes this as supported for backwards compatibility. Prefer Streamable HTTP for a new remote deployment unless a compatibility requirement dictates otherwise.

Do not choose a remote transport merely because the server might be useful later. A local process-spawned integration avoids making a service reachable over a network; a remote endpoint is appropriate when clients need to connect across machines or through a hosted application.

Connect the server and run it

The TypeScript SDK’s server flow is deliberately small:

  1. Create the server: instantiate McpServer with its name and version.
  2. Register capabilities: add tools, resources or prompts, including their descriptions and input definitions.
  3. Create the transport: use stdio for a local process or the SDK’s Streamable HTTP transport for a remote service.
  4. Connect: call server.connect(transport) so the server can handle protocol messages on that transport.

The Python SDK offers equivalent high-level server helpers and standard transports. In the Python example, FastMCP provides the server setup and the run call starts it with stdio. For a remote Python server, select the SDK’s Streamable HTTP mode and configure its ASGI or other supported deployment entry point according to the SDK version you installed; do not expose the local stdio example as though it were an HTTP endpoint.

Test discovery before testing behavior

A server that starts without crashing is not necessarily a working MCP server. Verify first that the client can complete the connection and discover the capability, then invoke it and inspect the result.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Start the server in the same environment the client will use. For stdio, confirm the executable path, working directory, runtime and environment variables in the client configuration.
  2. Connect an MCP client or MCP Inspector. For a stdio server, configure the inspector or host to launch the process. For a remote server, connect to its Streamable HTTP address.
  3. List capabilities. Confirm that add appears among the tools. If you later add resources or prompts, check their respective discovery lists too.
  4. Invoke the tool with known inputs. Send a = 2 and b = 3; the returned text should be 5.
  5. Check invalid inputs and failures. Try a missing or nonnumeric value and verify that validation or a useful error response prevents an unsafe or confusing operation.

If discovery fails, check that the host is starting the expected file, that the process speaks MCP on the selected transport, and that no debug output has polluted stdio. If discovery works but invocation fails, check the registered tool name, input schema, handler’s expected types and error handling.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Expose a remote server at a /mcp endpoint

An OpenAI-style integration that expects an endpoint such as /mcp needs an HTTP server route backed by an MCP Streamable HTTP transport. The path is part of your deployment’s URL design; it is not created by the stdio examples above, and registering a tool alone does not make a network endpoint available.

  1. Switch to the SDK’s Streamable HTTP server transport. Create the MCP server and register capabilities as before, then connect it to the HTTP transport using the SDK’s documented server integration.
  2. Mount the transport at /mcp. Configure the web framework or deployment adapter so MCP requests reach that transport at the desired route. Use the transport’s required request and response handling rather than implementing a generic REST handler for tool calls.
  3. Make the endpoint reachable only as intended. Configure TLS and an authentication and authorization boundary appropriate to the clients and data. Do not treat an obscure URL path as access control.
  4. Test the deployed route as an MCP endpoint. Connect with an MCP client or Inspector, confirm discovery, invoke the deterministic tool, and verify that the response reaches the client. Then test unauthorized access and a failed invocation.

The exact framework wiring depends on the SDK version and hosting stack; the essential distinction is that /mcp is an HTTP route connected to the Streamable HTTP transport, whereas stdio is a process connection with no URL.

Set production boundaries before adding real tools

A calculator is low-risk; a tool that reads private records, sends messages or changes production data is not. Before a remote server is exposed, make the permission model and failure behavior explicit.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Authentication and authorization: authenticate clients and authorize each operation for the specific identity and data scope. A valid connection should not automatically imply permission to call every tool.
  • Least-privilege design: expose narrow operations instead of a general-purpose shell, broad database access or unrestricted network client. Separate read and write capabilities where that makes permissions easier to control.
  • Input schemas: define required fields, types and acceptable ranges. Validate inputs in the server even if the client also presents a schema.
  • Timeouts and failure handling: set sensible limits for external calls, return useful errors without leaking secrets, and avoid reporting success when a downstream operation failed.
  • Logging: record operational events needed to debug and audit the service while avoiding credentials, tokens and unnecessary sensitive payloads.
  • State and scaling: decide whether requests depend on in-memory session state. The MCP maintainers’ 2026-07-28 release announcement highlights a stateless protocol core and authorization hardening; that does not by itself make every application stateless. Keep request data in an appropriate external store or design for per-process state only if your deployment topology can reliably preserve it.
  • Transport exposure: stdio is typically scoped to a host-managed local process. A remote HTTP server adds network, identity and deployment concerns that must be addressed before it is reachable.

The same 2026-07-28 announcement from the Model Context Protocol maintainers reported close to half-a-billion downloads a month across Tier 1 SDKs and said the TypeScript and Python SDKs had each passed one billion total downloads. Those are the maintainers’ announcement figures, not an independently audited measurement; for choosing a server design, the more practical takeaway is that both official SDKs are active Tier 1 options.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

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

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.