Let's walk through each Server Feature, its control model, and how it fits into the 2026-07-28 stateless runtime.
To make these concepts concrete, I put together a companion repository. Rather than dumping a massive server all at once, the repo is structured into incremental branches (step-1-tools, step-2-resources, step-3-prompts) so you can check out each commit stage and see how an MCP server evolves as you layer on capabilities.
Before diving into the three primitives, notice how the server is wired up at the transport boundary. Under the stateless runtime model, createMcpHandler(createMcpServer) constructs a clean McpServer instance per request lifecycle and mounts it onto an Express endpoint (/mcp):
import "dotenv/config";
import { createMcpExpressApp } from "@modelcontextprotocol/express";
import { toNodeHandler } from "@modelcontextprotocol/node";
import { createMcpHandler } from "@modelcontextprotocol/server";
import { createMcpServer } from "./server/createMcpServer.js";
const handler = createMcpHandler(createMcpServer);
const app = createMcpExpressApp();
const nodeHandler = toNodeHandler(handler);
app.all("/mcp", (request, response) => {
void nodeHandler(request, response, request.body);
});
And each capability module registers itself onto the McpServer instance:
export function createMcpServer(): McpServer {
const server = new McpServer({
name: "devops-mcp-starter",
version: "1.0.0",
});
registerRollbackDeploymentTool(server);
registerDevopsResources(server);
registerDemoPrompts(server);
return server;
}
Let's examine each layer in the order a developer typically introduces them.
Tools: Model-Controlled Execution
Tools represent active operations—anything that validates an action, mutates external state, or executes a workflow step based on parameters synthesized by the model at runtime.
How rollback_deployment Works
In our DevOps starter, the first capability we expose is rollback_deployment. Notice two important design details:
Strict inputSchema & outputSchema Contracts: Using zod/v4, we enforce input constraints (serviceName, a 7+ character commit sha, and a reason of at least 10 characters) alongside a typed outputSchema.
Dual Response Payloads (structuredContent + content): Modern MCP tools return both machine-readable structuredContent matching outputSchema and human-readable content blocks for the model's context stream.
import { McpServer } from "@modelcontextprotocol/server";
import * as z from "zod/v4";
const outputSchema = z.object({
status: z.literal("not_executed"),
serviceName: z.string(),
sha: z.string(),
reason: z.string(),
message: z.string(),
});
export function registerRollbackDeploymentTool(server: McpServer): void {
server.registerTool(
"rollback_deployment",
{
title: "Rollback Deployment",
description:
"Prepare a deployment rollback request. This starter tool does not execute a rollback.",
inputSchema: z.object({
serviceName: z.string().trim().min(3).describe("Name of the service to roll back"),
sha: z.string().trim().min(7).describe("Commit SHA to roll back to"),
reason: z.string().trim().min(10).describe("Reason for the rollback"),
}),
outputSchema,
},
async ({ serviceName, sha, reason }) => {
const message =
"Rollback request validated, but no deployment action was taken. Connect a deployment provider to execute rollbacks.";
const result = { status: "not_executed" as const, serviceName, sha, reason, message };
return {
isError: false,
structuredContent: result,
content: [{ type: "text", text: message }],
};
},
);
}
Design Takeaway: Even in a safe demo scaffold where no real infrastructure is mutated, rollback_deployment is modeled as a Tool because it accepts runtime arguments (sha, reason) and represents an action boundary where a host application would enforce user confirmation.
Resources: Application-Controlled Context
Control Model: The Host application or user decides when to fetch and attach them.
Once a server has a rollback tool, the model immediately needs context to use it safely: Which services are currently degraded? What is the team's rollback checklist?
If we exposed get_cluster_overview or get_rollback_runbook as Tools, the LLM would have to waste extra round trips discovering and calling them—or worse, attempt a rollback without ever reading the runbook. Instead, we expose read-only operational state as Resources under a custom devops:// URI scheme.
Static Resources vs. Resource Templates
Our server demonstrates both resource patterns:
- Direct (Static) Resources:
devops://cluster/overview (application/json)— Returns a point-in-time snapshot of cluster health (checkout-api, inventory-worker, payments-api).devops://runbooks/rollback (text/markdown)— Returns the step-by-step rollback checklist. - Parameterized ResourceTemplate with list and complete:
devops://services/{serviceName}/status— Uses a URI template to expose per-service telemetry (environment, status, version, and replicas). By providing both list and complete callbacks inside ResourceTemplate, MCP hosts can enumerate valid service URIs upfront and offer autocomplete suggestions as a user types a serviceName.
import { McpServer, ResourceTemplate } from "@modelcontextprotocol/server";
// 1. Direct static resource with audience & priority hints
server.registerResource(
"rollback-runbook",
"devops://runbooks/rollback",
{
title: "Rollback Runbook",
description: "A fictional, read-only rollback checklist for demos.",
mimeType: "text/markdown",
annotations: { audience: ["user"], priority: 0.7 },
},
async (uri) => ({
contents: [
{
uri: uri.href,
mimeType: "text/markdown",
text: [
"# Demo deployment rollback",
"",
"1. Read the service status and identify the affected deployment.",
"2. Confirm the target commit SHA and the reason for rollback.",
"3. Ask the service owner to approve the change.",
"4. Use the deployment platform to roll back, then verify health.",
"5. Record the outcome and notify the on-call channel.",
].join("\n"),
},
],
}),
);
// 2. Parameterized ResourceTemplate with discovery (`list`) and argument autocompletion (`complete`)
const serviceStatusTemplate = new ResourceTemplate(
"devops://services/{serviceName}/status",
{
list: async () => ({
resources: serviceNames.map((serviceName) => ({
uri: `devops://services/${serviceName}/status`,
name: `${serviceName} status`,
title: `${serviceName} status`,
description: `Current fictional status for ${serviceName}.`,
mimeType: "application/json",
})),
}),
complete: {
serviceName: async (value) =>
serviceNames.filter((serviceName) => serviceName.startsWith(value.toLowerCase())),
},
},
);
Design Takeaway: Notice the annotations: { audience: ["user"], priority: 0.9 } metadata and the complete handler on ResourceTemplate. Resources aren't just passive files—they power host UI pickers, @-mentions, and deterministic context injection.
Prompts: User-Controlled Workflows
Control Model: The End User explicitly triggers them (e.g., via slash commands).
With Tools and Resources in place, Prompts act as the orchestration layer for human operators. Rather than expecting an on-call engineer to manually attach two resources and write out safety guardrails every time an alert fires, the server packages repeatable workflows that return structured messages containing resource_link blocks.
Our DevOps server defines three progressive prompts:
-
cluster_health_briefing(Zero-argument): Attachesdevops://cluster/overviewvia aresource_linkand instructs the model to separate observed facts from interpretation. -
investigate_service(Single argument): Dynamically links bothdevops://cluster/overviewanddevops://services/${encodedServiceName}/status, guiding the LLM through a read-only diagnostic check. -
prepare_deployment_rollback(Multi-argument): Combines the target service's status resource,devops://runbooks/rollback, and explicit instructions requiring user confirmation before invoking therollback_deploymenttool.
server.registerPrompt(
"prepare_deployment_rollback",
{
title: "Prepare Deployment Rollback",
description: "Review the runbook and service status before a confirmed rollback tool call.",
argsSchema: z.object({
serviceName: z.string().trim().min(1).describe("Service to roll back"),
sha: z.string().trim().min(7).describe("Target commit SHA"),
reason: z.string().trim().min(10).describe("Reason for the rollback"),
}),
},
({ serviceName, sha, reason }) => {
const encodedServiceName = encodeURIComponent(serviceName);
return {
messages: [
{
role: "user" as const,
content: {
type: "text" as const,
text: `Review the linked status and rollback runbook for ${serviceName}. Summarize the current status and the requested target (${sha}) and reason (${reason}).
Ask for explicit user confirmation before calling rollback_deployment with exactly serviceName="${serviceName}", sha="${sha}", and reason="${reason}".
The tool is a demo scaffold: it validates the request but does not execute a deployment change. Make that limitation clear.`,
},
},
{
role: "user" as const,
content: {
type: "resource_link" as const,
uri: `devops://services/${encodedServiceName}/status`,
name: `${serviceName} status`,
title: "Service Status",
description: "A fictional status record for the selected service.",
mimeType: "application/json",
},
},
{
role: "user" as const,
content: {
type: "resource_link" as const,
uri: "devops://runbooks/rollback",
name: "rollback-runbook",
title: "Rollback Runbook",
description: "A fictional, read-only rollback checklist.",
mimeType: "text/markdown",
},
},
],
};
},
);
Look at how cleanly all three primitives converge in prepare_deployment_rollback:
The User triggers the Prompt with explicit arguments (checkout-api, a1b2c3d, "High 5xx error rate after deploy").
The Prompt injects resource_link references so the Host resolves the service status and Markdown runbook.
The Model reviews the runbook, summarizes the current degraded replica state (2/3 ready), asks for confirmation, and only then invokes the rollback_deployment Tool with validated arguments.
In the next post in the series, we'll look at Client Features—exploring how completions, logging, sampling, and elicitation round out production MCP integrations.
Top comments (2)
The confirmation step lives only in the prompt text, so it holds only when the user starts from prepare_deployment_rollback. Any client can call rollback_deployment directly over tools/call, the tool carries no destructiveHint annotation and the /mcp route as shown has no auth, so once a real provider is wired in the only gate is the model choosing to ask. Worth moving the check into the handler, for example an elicitation step or an approval token, before this starter gets copied into production
All excellent points @sergeevdms , this is an iterative series and we'll be making the repo better with every commit