To build an AI-powered integration with an MCP server, you run an AI application as the host, let it open a client for each server connection, and have that server expose the tools, resources, or prompts your model needs. The real work is deciding what the server should expose, choosing local (stdio) or remote (Streamable HTTP) transport, and limiting what the model can see and do.
This tutorial explains the architecture first, then walks through an example built with TypeScript and the official MCP TypeScript SDK v2. The language and host in this example are choices made for illustration. The Model Context Protocol does not require them, and the same design applies to other SDKs and hosts that support MCP.
As an Amazon Associate I earn from qualifying purchases.
How the MCP architecture fits together
MCP is an open standard that connects AI applications to the systems where your data and tools live. That sentence is taken from the MCP TypeScript SDK v2 documentation. The architecture behind it has three roles and two layers, and knowing them makes the code choices easier to reason about.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Host, client, and server
| Role | What it is | What it is responsible for |
|---|---|---|
| Host | The AI application the user interacts with, such as a chat app, an IDE assistant, or your own agent | Coordinates the LLM, the user, and every server connection; decides what context reaches the model; asks the user to approve sensitive actions |
| Client | A component inside the host that maintains one connection to one server | Negotiates capabilities during initialization, sends requests such as listing and calling tools, and returns results to the host |
| Server | The program that exposes capabilities over MCP | Describes its tools, resources, and prompts, and executes requests against the underlying system |
A host typically runs one client per server. MCP standardizes how context and capabilities are exchanged. It does not decide how your host calls the LLM, which model you use, or how the answer is presented.
#1 Best Overall
- Includes Raspberry Pi 5 with 2.4Ghz 64-bit quad-core CPU (8GB RAM)
- Includes 128GB Micro SD Card pre-loaded with 64-bit Raspberry Pi OS, USB MicroSD Card Reader
- CanaKit Turbine Black Case for the Raspberry Pi 5
- CanaKit Low Noise Bearing System Fan
- Mega Heat Sink - Black Anodized
Data layer and transport layer
The official architecture documentation separates a data layer, which uses JSON-RPC-based messages to describe lifecycle, discovery, and invocation, from a transport layer, which carries those messages between client and server. Because the two are separate, the same server logic can run over different transports. Your server code decides what it offers; the transport decides how the bytes travel.
Decide what the server should expose
Before writing any code, identify the operation or context the AI application needs. Then choose the MCP primitive that fits it. The three server primitives are tools, resources, and prompts.
| Primitive | Who initiates it | Use it for | Example |
|---|---|---|---|
| Tool | The model requests it, and the host mediates the call | An operation with inputs and a result, such as a lookup or a calculation | Return the status of one order by ID |
| Resource | The application loads it as context | Read-only data identified by a URI | A description of the order data fields at orders://schema (a hypothetical URI used here for illustration) |
| Prompt | The user selects it | A reusable instruction template with parameters | A “summarize open orders for a customer” template |
The official architecture example describes a domain adapter that combines these primitives: database-query tools, a schema resource, and an example prompt. Discovery happens through list operations (tools/list, resources/list, prompts/list), and invocation of a tool happens through tools/call.
Free tools Windows power users keep installed
One-click scans. No signup required.
Rank #2
- Includes Raspberry Pi 5 16GB with 2.4Ghz 64-bit quad-core CPU (16GB RAM)
- Includes 128GB Micro SD Card pre-loaded with 64-bit Raspberry Pi OS, USB MicroSD Card Reader
- CanaKit Turbine Black Case for the Raspberry Pi 5
- CanaKit Low Noise Bearing System Fan
- Mega Heat Sink - Black Anodized
Design narrow capabilities
The advice in this section is editorial guidance rather than protocol rules. The official documentation defines what the primitives are; how wide each one should be is your decision.
- Write down the question the model must answer and the minimum data needed to answer it.
- Create one tool per operation. A tool called
lookup_order_statusis easier for a model to choose correctly than a genericrun_query. - Give every tool a typed, validated input schema, and keep each parameter’s meaning explicit in its description.
- Return only the fields the model needs. Full database rows, internal IDs, and stack traces expand the attack surface and the context window.
- Prefer read-only resources and tools until you have a clear reason to add a write path.
Choose local or remote transport
The official overview describes two standard transports. The choice determines where the server runs, who it trusts, and how credentials move.
| Aspect | stdio | Streamable HTTP |
|---|---|---|
| Where the server runs | As a local process that the host launches | As a separate service reachable over the network |
| How messages travel | Standard input and output of the launched process | HTTP POST requests, with optional Server-Sent Events for streaming responses |
| Permissions | The server runs with the permissions of the user who started the host | Access is controlled by the server’s own authentication; the overview names standard HTTP methods such as bearer tokens and OAuth |
| Trust boundary | Same machine as the host | Crosses a network, so TLS, token handling, and access policy must be designed explicitly |
| Typical fit | Developer tools, local files, single-user setups | Shared or hosted services used by several users or hosts |
Transport and authorization details depend on your deployment. The overview describes the options; it does not prescribe a configuration for your system.
Rank #3
- CanaKit Raspberry Pi 5 Essentials Starter Kit
Set up the TypeScript project
This example uses the official MCP TypeScript SDK v2. Treat it as one documented route, not the universal choice.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallCrashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteVersion facts to check before you build
- The TypeScript SDK v2 documentation describes its stable release line as implementing the 2026-07-28 version of the MCP specification. Confirm this on the official docs on the day you build, because protocol and package versions change.
- The server package is
@modelcontextprotocol/server. - The v2 documentation lists Node.js, Bun, and Deno as supported runtimes.
- A separate documentation site covers v1. Do not mix v1 imports or patterns with v2 examples.
Setup steps
- Create a project directory and initialize it with
npm init -y. Use a currently supported Node.js LTS release, and confirm the minimum version in the SDK’s setup instructions. - Install the server package:
npm install @modelcontextprotocol/server. - Add a TypeScript configuration. If you use TypeScript 6.0 or later, set
typesexplicitly to["node"]. The v2 documentation notes this is needed for the Buffer type. - Pin the exact SDK version in
package.json, removing the caret range, so your build does not change silently.
{
"compilerOptions": {
"types": ["node"]
}
}
Build the server
The sketch below describes the logic your server needs. It is not a finished program. Confirm the registration method names against the v2 setup guide before you compile, because the SDK’s API surface is what you must match exactly.
Implement the order-status tool
- Name:
lookup_order_status - Input: an object with one required string field,
orderId. Reject anything else before calling downstream systems. - Handler: call your internal order API with a timeout, then map the response to a small object such as
{ status, updatedAt }. - Output: only the fields above. Do not return raw database records.
Expose the schema as a resource
Register a read-only resource at orders://schema that returns a plain-text or JSON description of the order fields the tool can return. This gives the model context it can read without calling a tool, and it lets you update documentation in one place.
Rank #4
- All-in-One Complete Kit: This SANOOV RPi 5 bundle comes with Raspberry Pi 5 4GB RAM single board, active cooler, durable ABS case and screwdriver. No extra parts needed, ready to use right out of the box for beginners and hobbyists
- Powerful Single Board Computer: Equipped with 4GB RAM and high-performance processor, delivers fast running speed for 4K playback, AI projects, programming and daily computing tasks. SANOOV for raspberry pi 5 4GB is equipped with broadcom 64 quad-core Arm Cortex A76 processor with gigabit ethernet and upgraded with IEEE 802.11ac Wi-Fi, Bluetooth 5.0 dual-band 2.4Ghz and 5Ghz and Power Over Ethernet (POE). Upgrading delivers 2-3 x speed vs Pi 4, redefining the experience
- Efficient Active Cooler: Effectively lowers operating temperature and prevents performance throttling. Runs quietly even under long-time heavy load, ensures stable operation all day long. SANOOV RPi 5 4GB kit offer an active cooler, which combines an aluminium heatsink with a high-performance PWM fan. Active cooler is fully compatible with the Pi OS, which can effectively reduce the temperature of RPi5 and ensure its good performance during long-term high load operation
- Sturdy ABS Protective Case: Well-fitted for Raspberry Pi 5 board, can be secured with 4 screws to effectively protect the Pi 5 motherboard from damage, reserves full access to all ports and buttons. SANOOV uses ABS material to produce the case, which has a softer texture and feel. Meanwhile, SANOOV case adopts a layered design for easy disassembly and installation. (Tip: The Case cannot install M.2 HAT Add on Board and Solid State Drive!)
- Wide Application & Full Compatibility: Seamlessly compatible with official OS and mainstream peripheral accessories for Raspberry Pi 5. Whether you are a beginner, student, electronics hobbyist or professional developer, this all-in-one kit meets your diverse needs. It excels in IoT projects, robotics design, retro gaming devices, home media servers and other DIY creations. Backed by a large global community, you can easily find guides, technical support and shared projects online
Make errors understandable
- Invalid input should produce a tool error that names the offending field, for example “orderId is required and must be a string.”
- An unavailable upstream service should produce a tool error such as “Order service did not respond; retry later,” with no internal hostnames or stack traces.
- Log details to your own log destination. In stdio mode, do not write logs to standard output, because that stream carries protocol messages.
Connect the host and validate behavior
Connection details are host-specific. Each host has its own configuration format and file location, so follow its documentation for registering a server. The general sequence is the same across hosts.
- Register the server in the host’s configuration, giving the command to start it (stdio) or the URL to reach it (Streamable HTTP).
- Start the host. It creates a client for the server and performs the initialization handshake, which negotiates capabilities.
- Confirm discovery. The host should list the tool, resource, and prompt you registered, using the list operations described above.
- Make one realistic call. Ask a question that causes the model to call
lookup_order_statuswith a known test order, and inspect the arguments and result the host received.
Then run the following checks. They are the minimum you should perform before relying on the integration.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minute- A valid order ID returns the expected status fields.
- A missing or non-string
orderIdreturns a readable error and makes no downstream request. - When the order API is stopped or slow, the tool returns its error within the timeout you set.
- The resource returns the schema text when read.
- In stdio mode, the server produces no output on standard output except protocol messages.
Troubleshooting
| Symptom | Likely cause | What to check |
|---|---|---|
| The host shows no tools | The server did not start, or initialization failed | Run the server command directly from a terminal, check the path in the host configuration, and read stderr output |
| Protocol parse errors in stdio mode | Log statements writing to standard output | Redirect logging to standard error or a file |
| Build error about Buffer types with TypeScript 6.0 or later | The types setting is missing |
Add "types": ["node"] to compilerOptions |
| The model calls the wrong tool or arguments | Vague tool names or descriptions | Rename the tool, narrow its scope, and rewrite the parameter descriptions |
| Remote requests fail with an authorization error | Missing, expired, or wrongly scoped credentials | Verify the authentication method your deployment uses and the token’s scope and lifetime |
Security and operational limits
Protocol compatibility does not make an integration safe. OpenAI’s guidance on remote MCP servers flags prompt injection as a risk, especially when a connected server can access sensitive data or take actions. Plan for it in the design rather than after deployment.
Best Value
- 【What you Get】You will get 1*Pi 5 8GB Single Board,1*RasTech Case,1*Active Cooler,1*Screwdriver,1*Installation instructions,12-month free warranty, lifetime service, 24-hour prompt and friendly response.
- 【More Connectors】There are two USB 3.0 ports(5Gbps simultaneously) and two USB 2.0 ports, which triple total bandwidth ,support any combination of up to two cameras or displays. Peak SD card performance is doubled through support for the SDR104 high-speed mode. It provides a smooth desktop experience for you. Offer Gigabit Ethernet and a PCIe interface, along with dual-band Wi-Fi and Bluetooth 5.0/BLE wireless capability. The RasTech Pi 5 Kit use the new 27W 5.1V 5A USB-C power connector.
- 【 Support Dual 4Kp60 Display 】Each of the two microHDMI sockets can control a 4K display at 60 Hertz, now support HDR, offering super HD video for media streaming projects. RPi 5 is the first RPi model that comes with a PCI Express port (PCIe 2.0 x1 with 500 MB/s) to attach SSDs (requires separate M.2 HAT).
- 【 Excellent Chips And Applications】Pi 5 is a full-size Pi computer using silicon built in-house at Pi. The RP1 “southbridge” provides the bulk of the I/O capabilities for Pi 5. Pi 5 is more friendly and convenient in the development of Internet of Things, Web development, machine identification, automatic control and other electronic equipment applications and network.
- 【 Faster CPU, Better GPU 】 Pi 5 features a Broadcom BCM2712 64-bit quad-core Arm Cortex-A76 processor running at 2.4GHz, it delivers a 2–3× increase in CPU performance relative to RaspberryPi 4. The 800MHz VideoCore VII GPU is compatible to OpenGL ES 3.1 and Vulkan 1.2, substantial uplift in graphics performance. Pi 5 Offers lightning-fast CPU speed, a PCI Express interface, a Real Time Clock (RTC) and a power button and runs significantly cooler than Pi 4.
- Bound permissions. Give the server’s service account only the access the tools need. A read-only database role is safer than an administrative account.
- Keep people in the loop for consequential actions. Anything that changes data, sends messages, or spends money should require explicit user confirmation in the host.
- Keep credentials out of model-visible content. Store secrets in the server’s environment or a secret manager, and never return them in tool results, resource text, or error messages.
- Treat returned content as untrusted. A tool result or resource can contain text that tries to steer the model. Do not let it trigger further actions without the controls above.
The right level of control depends on the data sensitivity, the impact of each action, the authentication method, and how much oversight the user has. These four factors should drive the decision about how wide each capability can be.
Choosing your options
- Single user, local files or developer tools: stdio, with the server running as the same user as the host.
- Shared or hosted service: Streamable HTTP with authentication, TLS, and token management designed before launch.
- Read-only context: a resource. Model-initiated operation: a tool. Reusable user-selected instructions: a prompt.
- Language and SDK: TypeScript with the v2 SDK is one documented route. Choose the language your team maintains, then confirm that the SDK’s version targets the specification version your host supports.
A working integration rests on three decisions made early: which narrow capabilities the model gets, which transport matches the trust boundary, and which controls stop a compromised input from becoming an action.
Frequently Asked Questions
Can one MCP server serve more than one host?
Yes, provided each host supports MCP and the server’s transport matches how that host connects. A stdio server is started by a host on the same machine, so a remote host generally needs Streamable HTTP instead.
Does MCP choose which model or LLM my application uses?
No. MCP standardizes how context and capabilities are exchanged. Your host still decides which model to call and how to present results.
Quick Recap
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.




