MCP is a way for an AI application to use capabilities supplied by another program. A server may offer a search tool, a document resource, or a reusable prompt. A compatible host discovers those capabilities through an MCP client and decides which to present to its model or user. This reduces the need to invent a new connector format for every pair of applications, but the business workflow, data permissions, and user experience still need to be designed.
The current MCP specification defines the protocol. This guide focuses on deciding when to use it, building a small local example, and reviewing the controls needed before connecting a real system. The example is a demo, not a production customer-data integration.What MCP connects#
An MCP host is the application the user works in. It can manage one or more MCP clients, each of which communicates with an MCP server. The server exposes capabilities. A server is not the model, and the model does not acquire credentials simply because a tool appears in its context.| Capability | What it offers | Typical use |
|---|---|---|
| Tool | A callable operation with an input schema and result | Look up an order, create a draft ticket. |
| Resource | Context the client can read | A document or structured record. |
| Prompt | A reusable message template | A guided review or summary task. |
The host chooses what to make available to the model and may ask the user before a tool call. The server must still validate and authorize the call when it receives it. A tool description is a hint to the model, not a security policy. A model may request a function in the host's format; the host can use MCP to call the separate server that implements it. Adopting MCP does not eliminate application code or guarantee identical behavior in every host.
Decide whether MCP is the right boundary#
Start with one task and one data source. If an existing application already calls a single API in a fixed sequence, a direct integration may be easier to operate. MCP is more useful when several compatible hosts need the same approved capability, or when a team wants a server interface that can be discovered and tested independently.
Before building, answer these questions:
- Who will run the host, and which client features and protocol revisions does it support?
- Which exact data and actions does the task require? Separate read operations from writes.
- Is there a trusted server already available? Who maintains it, and what access would it receive?
- Where will identity and authorization be enforced: in the host, MCP endpoint, business API, or all three?
- How will a user review a proposed action and understand a failed or incomplete result?
A useful first capability is read-only and narrow, such as looking up the status of an order the caller is allowed to see. Avoid a generic database query tool when a purpose-specific operation will do.
Choose a transport and deployment shape#
The specification supports stdio for a host that starts a local subprocess and Streamable HTTP for a remote endpoint. A local server exchanges protocol messages over standard input and output. Write diagnostics to standard error; ordinary console output can corrupt the protocol stream. A remote server needs normal HTTP operations such as protected access, network policy, availability, and monitoring. The TypeScript SDK's stdio guide and HTTP guide show the current server setup.Do not expose a local demo on the public internet by changing its URL. The HTTP implementation needs a deployment-specific handler, authentication, host and origin checks where applicable, and a plan for state or retries. The SDK's current HTTP guide uses a request-scoped server factory; older examples built around a shared server and a fictional handleRequest method should not be copied into a new project.
Protocol revisions also change. The July 2026 specification uses stateless, self-contained requests, while older revisions opened with an initialize handshake. Use the official SDK's compatibility guidance rather than assuming every installed client implements the newest revision. Verify the combination you plan to support.
Build one local demonstration tool#
The following example uses the current MCP TypeScript SDK first-server pattern. It returns a fixed demonstration status and reads no customer data. In a separate demo project, install the server package, Zod, and a TypeScript runner as shown in that official guide, then place the code in src/index.ts.import { McpServer } from '@modelcontextprotocol/server';
import { serveStdio } from '@modelcontextprotocol/server/stdio';
import * as z from 'zod/v4';
void serveStdio(() => {
const server = new McpServer({ name: 'order-demo', version: '1.0.0' });
server.registerTool(
'get-demo-order',
{
description: 'Read the status of one demonstration order',
inputSchema: z.object({ orderId: z.enum(['A100', 'A101']) }),
},
async ({ orderId }) => ({
content: [{
type: 'text',
text: orderId === 'A100' ? 'Processing' : 'Shipped',
}],
}),
);
return server;
});A real order lookup would need a caller identity, server-side authorization for that order, a supported business API, bounded results, and a clear error when the record is missing or access is denied. Schema validation alone cannot answer whether the caller may read a particular record.
Design a real tool around permissions#
For each tool, write a contract: its purpose, input schema, allowed caller, data source, result shape, error shape, and audit event. Keep names and descriptions specific enough that a user or model can distinguish them. Limit returned fields to what the task needs. Never pass a database credential or unrestricted access token to the model.
For a protected remote server, verify the caller at the HTTP boundary and apply authorization again where the tool reaches the business data. The MCP authorization documentation describes protected resource discovery and token requirements. Use the SDK or a reviewed identity integration for the actual flow; an auth object in a server constructor is not a complete OAuth implementation. For local stdio, understand which user starts the process, what its filesystem and environment access include, and how the host asks for consent. Treat retrieved text and tool output as untrusted content. It can contain instructions meant to redirect an assistant. Keep tool results separate from higher-priority application instructions, restrict the agent's available actions, and require approval for consequential writes. OWASP's MCP security guidance covers token handling, tool permissions, and malicious tool output. No tool description or prompt alone prevents misuse.Test the client and server together#
A valid server is only one part of the experience. Test it with the actual host and account types you expect to support. A short acceptance set should include:
- Discovery: the intended tools are visible, and unrelated capabilities are absent.
- Authorized read: an allowed caller gets the right record and no extra fields.
- Denied read: another caller cannot get that record, even by changing an ID.
- Bad input: malformed or overlong arguments fail without reaching the business API.
- Untrusted content: a malicious instruction in a record does not trigger a privileged action.
- Failure: timeout, rate limit, missing record, and unavailable server produce clear results.
- Write review: a proposed change shows its target and effect before required approval.
- Retry: a repeated request cannot duplicate a consequential action.
Inspect the tool call, the server's authorization decision, and the final answer. An assistant can provide a plausible summary even when it called the wrong tool or skipped an important error. Keep logs useful for investigation but avoid storing unnecessary personal data or tokens.
Plan the rollout and cost#
Move from the local demo to a real read-only pilot with a small authorized group. Record request volume, successful tasks, corrections, latency, denied calls, and support work. Add write tools only when the task requires them and when review, rollback, and duplicate-action controls have been tested. Assign an owner to update the server when the underlying API or SDK changes.
MCP itself is an open protocol; the integration still has implementation and operating costs. Scope the data API, identity system, client support, hosting, testing, monitoring, review, and maintenance before estimating a project. Compare the pilot with the existing workflow. There is no credible universal per-server price or guaranteed return.
A practical decision checklist#
Before production use, confirm that you can answer yes to each point:
- The server exposes only the capabilities this workflow needs.
- A real identity is checked before protected data or actions are reached.
- Each tool validates arguments and enforces record-level permissions in application code.
- Tool output contains only necessary fields and does not become trusted instruction text.
- Consequential writes need the right approval and are safe to retry.
- The intended host and server work together on the supported protocol revision.
- Operators can find failures, revoke access, pause the integration, and update it.
