How do you create an MCP server for your website?
To create an MCP server for your website, pick the three to eight tasks agents most need (search, get details, check availability, place or track an order), expose each as a tool with a clear name, description and input schema, serve them over Streamable HTTP at a public URL, protect anything account-specific with OAuth, and publish the server so clients can find it.
By the Axidort team · Updated
What MCP is
The Model Context Protocol (MCP) is an open standard that lets AI applications call tools and read data from outside systems through one interface. A server offers tools (functions the model can call), resources (data it can read) and prompts (reusable templates). The current specification is dated 2026-07-28. It made the protocol stateless, so each request stands alone, and it keeps Streamable HTTP as the transport for remote servers (MCP blog).
Do you need one?
| Situation | Recommendation |
|---|---|
| Agents only need to read public pages | Not yet. Fix the pages first: server-rendered facts and structured data. |
| You already have a public API | Yes, as a thin layer over it. This is the cheapest and most useful case. |
| Tasks need the user’s account: orders, quotes, contract prices | Yes. Authorised tools are far more reliable than an agent logging in through the interface. |
| B2B catalog with customer-specific pricing and approvals | Yes. These rules are hard for a browsing agent to discover and easy to return from a tool. |
| The task happens in the page, in the user’s own session | Consider WebMCP instead of, or alongside, a server. |
Step 1: choose the tools
Design tools around what a user asks for, not around your database tables. A store usually needs search_products, get_product, check_availability, create_cart and get_order_status. Keep the list short: every tool description is read by the model on every request, and overlapping tools cause wrong calls.
- Name tools with a verb and a noun.
- Describe when to use the tool and what it returns, in one or two sentences.
- Constrain inputs with a JSON Schema: enums, formats, required fields.
- Return compact, structured results with identifiers the next call can use. Do not return HTML.
- Mark tools that change something and require confirmation for purchases.
Step 2: write the server
Official SDKs exist for TypeScript, Python and other languages. The example below uses the TypeScript SDK. SDK APIs changed with the 2026-07-28 specification, so check the SDK documentation for the version you install.
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import { z } from 'zod';
const server = new McpServer({ name: 'example-store', version: '1.0.0' });
server.registerTool(
'search_products',
{
title: 'Search products',
description: 'Search the catalog by keyword. Returns up to 10 products with id, name, price, currency and availability.',
inputSchema: { query: z.string().min(2), inStockOnly: z.boolean().optional() },
},
async ({ query, inStockOnly }) => {
const items = await catalog.search(query, { inStockOnly }); // your existing search
return { content: [{ type: 'text', text: JSON.stringify(items.slice(0, 10)) }] };
},
);
server.registerTool(
'get_product',
{
title: 'Get product',
description: 'Get full details for one product id: price, unit, minimum order quantity, stock and lead time.',
inputSchema: { id: z.string() },
},
async ({ id }) => ({ content: [{ type: 'text', text: JSON.stringify(await catalog.get(id)) }] }),
);Step 3: serve it over HTTP
Mount the server on a public HTTPS endpoint, commonly /mcp on your own domain or an mcp. subdomain, using the SDK’s Streamable HTTP transport. Design it to be stateless: do not depend on a session living on one machine. The older HTTP+SSE transport is deprecated.
Step 4: add authorization
Read-only catalog tools can be public. Anything tied to an account needs OAuth: the MCP server acts as a protected resource, points clients to your authorization server through published metadata, and validates the access token on every request. Give tokens narrow scopes such as orders:read, and never accept a token that was issued for a different service. The current specification tightened these rules, so read its authorization section before you ship.
Step 5: make it discoverable
- Document it on your site: the endpoint URL, the tools and how to connect.
- List it in the MCP Registry (registry.modelcontextprotocol.io), which stores metadata about public servers.
- Mention it in `llms.txt` and in your developer documentation.
- Consider a server card. A discovery file under
/.well-known/is proposed and some scanners already look for it, but the path is not final. Treat it as optional.
Step 6: test it
Use the MCP Inspector to call each tool by hand, then connect the server to an AI client and ask it to complete real tasks. Watch for the model choosing the wrong tool, sending invalid arguments or needing several calls for what should be one. Each of those is a description or schema to improve.
Security checklist
- Validate every input on the server. The model’s arguments are untrusted.
- Treat text you return from user-generated content as untrusted too. It can contain instructions aimed at the model.
- Rate-limit by token and by tool.
- Require explicit user confirmation for payments and other irreversible actions.
- Log tool calls so you can see what agents do and where they fail.
Frequently asked questions
01What is an MCP server for a website?
A service that exposes a website’s main tasks, such as searching products or checking an order, as tools an AI application can call through the Model Context Protocol, instead of the agent clicking through the interface.
02Do I need an MCP server to be agent ready?
No. Agents can use a well-built website directly, and very few sites publish an MCP server today. It becomes worthwhile when you have an API, or when tasks need a signed-in account.
03What is the difference between an MCP server and an API?
An API is designed for developers who read documentation and write code. An MCP server describes its tools in a form a model reads at run time, so an agent can discover and call them without custom integration.