Skip to content
Ai Agents

Model Context Protocol (MCP): A Practical Integration Guide (2026)

Understand MCP hosts, clients, servers, tools, and transports. Build a small local server, then plan permissions, testing, and a safe rollout for a real integration.

Published December 1, 2025Updated October 25, 202616 min read
Share:

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.
CapabilityWhat it offersTypical use
ToolA callable operation with an input schema and resultLook up an order, create a draft ticket.
ResourceContext the client can readA document or structured record.
PromptA reusable message templateA 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:

  1. Who will run the host, and which client features and protocol revisions does it support?
  2. Which exact data and actions does the task require? Separate read operations from writes.
  3. Is there a trusted server already available? Who maintains it, and what access would it receive?
  4. Where will identity and authorization be enforced: in the host, MCP endpoint, business API, or all three?
  5. 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.
typescript
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;
});
Run the server with the TypeScript runner, then use the MCP Inspector to call get-demo-order. Confirm that A100 and A101 return the intended status and an invalid ID is rejected by the input schema. Check stderr for diagnostics; stdout is reserved for MCP messages. This exercises discovery, input validation, and a tool response without granting access to a real system.

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.
If those answers are uncertain, keep the pilot read-only and investigate the gaps. For help designing a bounded integration, see AI agent solutions or contact PxlPeak. The AI agent implementation guide covers the wider workflow from pilot to production.

Sources and scope#

Protocol behavior and SDK patterns were checked on October 25, 2026 against the MCP specification, the official TypeScript SDK first-server guide, its stdio and HTTP guides, and the OWASP MCP Security Cheat Sheet. The demonstration is illustrative and was not connected to a business system. Deployment, authorization, and operating recommendations are PxlPeak's planning guidance.

Frequently Asked Questions

What does MCP standardize?

Model Context Protocol defines how an AI application can discover and use capabilities exposed by a compatible server. Those capabilities include tools, resources, and prompts. It does not make every client support every feature or make an integration secure without application controls.

Is MCP the same as model function calling?

No. Function or tool calling is how a model may request an action inside an application. MCP standardizes how an application communicates with a separate server that exposes tools and context. A host can translate MCP tools into the format its model uses; the model itself need not implement the MCP transport.

Do we need a custom MCP server?

Only when an existing trusted server does not meet the workflow's needs. Review any candidate server's owner, source, permissions, update history, and data flow. A direct API integration or ordinary automation may be simpler for one fixed task.

Which transport should we use?

Use stdio when a host launches a local server process. Use Streamable HTTP for a remote service reached over the network. Choose based on deployment, client support, authentication, and operational needs; moving from local to remote is an architecture change, not a one-line switch.

Does MCP include authentication?

MCP specifies authorization patterns for protected HTTP resources, but publishing an MCP endpoint does not authenticate callers automatically. A production service must enforce identity, scopes, and per-tool authorization at its boundary and in the underlying business API. Local stdio servers depend on the host and local process trust model.

How much does an MCP integration cost?

There is no meaningful universal price. Estimate the specific data source, client compatibility, auth, tool permissions, deployment, monitoring, review, and maintenance. Compare a working pilot with the current process before claiming a return on the investment.

Can a server work with every AI client?

A compatible client can communicate through the protocol, but available features, authentication flows, user approval, and supported protocol revisions differ. Test the actual client and server combination, including error and permission paths, before treating an integration as portable.

Ready?

Put AI to Work for You.

Tell us what your team wants to improve. We will review your request and suggest a useful next step.