TensorPass

Give Your Site's AI Chat Real Tools: An MCP Server for Websites

An MCP server for websites lets your public AI chat answer from your live catalogue: four tools, JSON Schemas the model reads, Streamable HTTP and CORS, auth for anonymous visitors and the monthly hosting bill.

Published on

An MCP server for websites lets your public AI chat answer from your live catalogue instead of its training data. On 22 November 2026 the taamtaam.com directory listed 255 kosher restaurants from Tel Aviv to Miami; a chat without tools knows none of today's rows. With tools, the visitor's model calls search, detail and availability functions that your server runs against Postgres, then answers from the rows it gets back. Third party MCP directories list servers for developer tools. This guide covers the single server your own site hosts for its own chat: the four tools it needs, the JSON Schemas the model reads, Streamable HTTP and CORS, auth for anonymous visitors, and what hosting costs you each month.

Key takeaways:

  • Model Context Protocol version 2025-11-25 defines two transports, stdio and Streamable HTTP; a site chat uses Streamable HTTP on one endpoint such as /api/mcp.
  • A Streamable HTTP server must validate the Origin header on every connection and answer 403 Forbidden to an invalid one.
  • A catalogue chat needs four tools; ship the three that read your own database first, marked readOnlyHint: true and openWorldHint: false.
  • Cloudflare Workers Paid starts at $5 a month with 10 million requests included (prices of 18 November 2026).
  • Public tools sit behind a per-address rate limit; 60 requests a minute per address is a workable default for a human visitor.

Why a site chat needs tools, and where WebMCP fits

A language model answers from what it saw in training, and your catalogue keeps changing after that training ends. A tool is a named function the model asks the host to run, with arguments it fills from the conversation; the result goes back into the model's context before it writes the answer.

The Model Context Protocol (MCP) is the open standard that carries those calls between an AI client and the system that owns the data. An MCP server publishes a list of tools; the client fetches that list, the model picks a tool, and the client sends a tools/call request. Tools in MCP are model-controlled: the model decides when to call them from the visitor's prompt.

WebMCP is a proposed browser standard that lets a page expose tools to agents running in the browser. WebMCP tools exist only while the page is open and sign in with the visitor's current session. An MCP server holds its own credentials and stays reachable from any client. "MCP is a call center. It's available from anywhere, at any time," write André Cipriani Bandarra, Alexandra Klepper and Kasper Kulikowski of the Chrome team, who describe WebMCP as "an in-store expert" available only while the user is on your page.

For a chat embedded in your own site, catalogue search belongs on the server, next to Postgres. WebMCP fits actions bound to the open tab, such as filling the booking form the visitor is looking at. Both coexist on one site. The hub guide on how to add an AI chatbot to your site covers the front end that calls these tools.

What an MCP server for websites exposes to a public chat

Four tools answer what a visitor asks a catalogue chat: which values exist, which items match, what one item contains, and whether it is free on a given date. The first three read rows you already publish on public pages. The fourth reaches a booking or stock system, which changes its risk profile even when it only reads.

The MCP specification gives each tool a name, an optional title, a description, an inputSchema and optional annotations. Two annotations matter on a public server. readOnlyHint: true tells the client the tool changes nothing. openWorldHint: false tells it the tool reaches no outside system. Clients treat annotations from an unknown server as untrusted, so they inform the visitor's client and replace none of your server's own checks. The table below is the starting set for an MCP server for websites whose catalogue lives in Postgres.

ToolReturnsInputsreadOnlyHintopenWorldHint
list_facetsAllowed values for each filter (cities, cuisines, categories)nonetruefalse
search_catalogueUp to 12 matching items by default, 25 at most, as JSONfilters from enums, limittruefalse
get_itemOne item's full public recordslugtruefalse
check_availabilityFree slots or stock for one item on one dateslug, date, party_sizetruetrue

list_facets takes no arguments; its schema is { "type": "object", "additionalProperties": false }, the form the specification recommends because it accepts only an empty object. search_catalogue carries the filters. get_item takes one slug and returns the record the item page already shows. check_availability calls a third party, so it ships after the other three are stable.

Tool descriptions and JSON Schemas the model reads

The visitor's model reads every tool's name, description and input schema before it picks one. JSON Schema is the vocabulary that describes the shape of a JSON value; MCP defaults to its 2020-12 dialect when $schema is absent. Tool names run from 1 to 128 characters drawn from ASCII letters, digits, underscore, hyphen and dot.

{
  "name": "search_restaurants",
  "title": "Search restaurants",
  "description": "Search the public restaurant catalogue. Send only the filters the visitor named. Returns a JSON array; an empty array means no match, so relax one filter and search again.",
  "inputSchema": {
    "type": "object",
    "properties": {
      "city": { "type": "string", "maxLength": 40 },
      "kosher_type": { "type": "string", "enum": ["bassari", "halavi"], "description": "bassari: meat restaurant. halavi: dairy restaurant." },
      "features": { "type": "array", "maxItems": 10, "items": { "type": "string", "enum": ["mehadrin_only", "shiddoukh", "terrasse", "rooftop", "wine_cellar", "takeaway"] } },
      "query": { "type": "string", "maxLength": 80 },
      "limit": { "type": "integer", "minimum": 1, "maximum": 25 }
    },
    "additionalProperties": false
  },
  "annotations": { "readOnlyHint": true, "openWorldHint": false }
}

A description is text the model trusts. Write it about the tool alone: what it returns, which arguments to send, what an empty result means. A description that addresses the user or mentions other tools is the pattern attackers use when they poison a server, and your own server has no reason to carry it. These seven rules keep the schema tight:

  1. Name the tool with a verb and a noun in snake_case. search_restaurants reads as an action; restaurants does not.
  2. Use an enum for every fixed set. Explain each value inside the description, as kosher_type does above.
  3. Cap every string and array. Bounds of 40, 80 or 120 characters and 10 array items stop a prompt injection payload from riding in an argument.
  4. Cap the result count. A default of 12 items and a ceiling of 25 keeps each tool result small in the visitor's context.
  5. Tell the model to send only the filters the visitor named. Invented filters return empty results and waste a step.
  6. Return [] with a hint on no match. "If nothing matches, relax a filter" gives the model a next move.
  7. Set additionalProperties: false. Unknown keys fail validation before they reach SQL.

Validate the arguments again on the server with the same schema. Anyone can call the endpoint with curl, without your page and without a model. The handler's own validation is the check that stops a malformed argument before it reaches SQL.

Remote transport over Streamable HTTP, with CORS for your own origin

Streamable HTTP is the MCP transport for remote servers: one endpoint path that accepts POST and GET. Every JSON-RPC message from the client is a new POST. A GET asks for a server stream, and the server answers with text/event-stream or with 405 Method Not Allowed. After initialization the client sends an MCP-Protocol-Version header, for example 2025-11-25, and a server that does not support the version answers 400.

A catalogue server runs stateless. Build a fresh server and transport for each POST, with sessionIdGenerator: undefined and enableJsonResponse: true, and answer GET and DELETE with 405. A 405 on GET in your logs is expected: the client asks for a stream once, and the stateless server declines it.

MCP sets one hard rule for this transport. The server validates the Origin header on every incoming connection and answers 403 to an invalid origin, which blocks DNS rebinding. List your production origins explicitly.

CORS (Cross-Origin Resource Sharing) is the HTTP header mechanism through which a server tells the browser which other origins may read its responses. Serve the endpoint under your own domain at /api/mcp and the browser treats the call as same-origin, so no CORS setup is needed. A server on a separate host such as mcp.example.com gets a CORS preflight, because application/json is outside the three content types that skip one. Answer the OPTIONS preflight with an explicit Access-Control-Allow-Origin, an Access-Control-Allow-Headers list naming content-type, accept and mcp-protocol-version, and an Access-Control-Max-Age of 86400 seconds; browsers apply their own lower ceiling. The wildcard * is refused on any request that carries a cookie.

A relay keeps the database host private. A Next.js route.js on the Node.js runtime forwards the accept, content-type and mcp-protocol-version headers to MCP_SERVER_URL. In production it caps the body size and passes the visitor's IP address to the backend for rate limiting.

Auth when the caller is an anonymous visitor

Authorization is optional in MCP. When a server uses it over HTTP, the specification builds it on OAuth 2.1: the server publishes Protected Resource Metadata (RFC 9728, the document that names its authorization server), the client runs PKCE with the S256 method, and the server accepts only tokens issued for itself. The server does not forward a token it received to an upstream API. That flow suits a client acting for a user who holds an account. A visitor reading your restaurant list holds none.

Split callers into three levels and build the tool list per request:

LevelCheck on each requestTools registered
PublicNone, plus a rate limit per addresslist_facets, search_catalogue, get_item
Signed inThe site's session cookie or bearer tokenPublic tools plus the visitor's own bookings
StaffThe session plus the existing role checkInternal tools such as unpublished items

A tool registered only for staff is absent from the list an anonymous visitor's model receives. The client returns a Tool error: result for a call to a tool it was not offered, and the request does not reach your server.

Cookie sessions need two extra checks. The Origin header matches your own site, and the session cookie is set with SameSite=Lax or SameSite=Strict. Bearer-token logins pass a custom fetch to the client so the token travels in the Authorization header. The tools specification lists rate limiting among the four duties of every server, next to input validation, access control and output sanitising. Set the public limit at 60 requests a minute per address and return 429 above it.

Read only first, actions later

Excessive Agency is entry LLM06 of the OWASP Top 10 for LLM Applications 2025: an LLM-driven system performs damaging actions after unexpected, ambiguous or manipulated model output. OWASP traces it to excessive functionality, excessive permissions and excessive autonomy. A public chat on your site receives text from strangers, and part of that text is written to manipulate the model.

Start with a database role that cannot write. Grant SELECT on the published catalogue views only, then run ALTER ROLE mcp_reader SET default_transaction_read_only = on; a read-only transaction cannot alter non-temporary tables. Add statement_timeout on the same role, in milliseconds; its default of 0 disables the timeout, so set 2000 to stop a slow search at 2 seconds. Both parameters hold in PostgreSQL 19, released on 19 November 2026.

Actions arrive in a second release. A booking tool for a signed-in visitor returns a proposal that your page renders as a card, and the visitor confirms it with a click. The MCP tools specification asks for a human in the loop with the ability to deny tool invocations. Cap the tool loop as well: the TensorPass client stops after 6 steps by default, and its final step offers no tools, so the model writes an answer.

Compact rack server with green status lights and a small stack of coins on its chassis

Hosting an MCP server for websites: the monthly bill

The site keeps the hosting cost. When the chat runs on the visitor's own AI account, inference leaves your invoice; the server, its compute and its database reads stay on it. Two routes exist. A route inside your existing app at /api/mcp adds requests to a host you already pay for. A separate edge worker with its own database copy isolates the chat from your main application.

Cloudflare Workers prices on 18 November 2026:

ItemFree planPaid plan
Base price$0$5 a month minimum
Requests100,000 a day10 million a month included, then $0.30 per million
CPU time10 ms per invocation30 million CPU ms a month included, then $0.02 per million CPU ms

Neon serverless Postgres prices on 4 November 2026: the Free plan gives 100 CU-hours of compute per project and 1 GB of storage per project. The Launch plan bills $0.106 per CU-hour and $0.35 per GB-month, with no monthly minimum, and a compute scaled to zero costs $0 while suspended. A CU (compute unit) is Neon's measure of database compute size.

Worked example for a catalogue site with 50,000 chat conversations a month. Each conversation opens with an initialize request, an initialized notification and a tools/list call, then runs 3 tool calls: 6 POSTs plus 1 declined GET, so 7 requests. 50,000 × 7 = 350,000 requests a month, about 11,700 a day, inside the 10 million included in Workers Paid: $5. The database copy stays active 6 hours a day at 1 CU: 6 × 30 = 180 CU-hours × $0.106 = $19.08. Two GB of catalogue storage: 2 × $0.35 = $0.70. Total: $5 + $19.08 + $0.70 = $24.78 a month. Serving from your existing Postgres through a read-only role removes the second database line. The hub on AI chatbot pricing compared by who pays compares this bill with per-token and per-conversation billing.

The taamtaam.com catalogue as a worked case

taamtaam.com is a directory of kosher restaurants. On 22 November 2026 its home page listed 255 restaurants in cities that include Tel Aviv, Jerusalem, Haifa and Miami. Each listing carries a name, a neighbourhood, a city, the kashrut certifier (the authority that certifies the kitchen as kosher), a Bassari (meat) or Halavi (dairy) label, a cuisine and an atmosphere. The page filters on Mehadrin only, Shiddoukh, Terrasse, Rooftop, Wine cellar and Takeaway.

An AI mode that recommends restaurants from that catalogue maps onto three tools. list_cities returns the city names present in the catalogue, so the model copies a spelling from the list. search_restaurants takes the schema shown earlier, with kosher_type and features as enums built from the page's own filters. get_restaurant takes a slug and returns the full listing. A visitor who types "dairy place with a terrace in Tel Aviv" produces one call: search_restaurants({ "city": "Tel Aviv", "kosher_type": "halavi", "features": ["terrasse"] }). The directory lists no table booking, so check_availability stays unregistered until a booking partner supplies the data.

Test the tools from the chat itself before launch:

  1. Ask five real visitor questions. Read each { call, result } pair in turn.tools; result is null while the tool runs.
  2. Ask for something absent. The search returns [] and the model relaxes one filter.
  3. Paste an instruction into a search query. The 80-character cap and the enum filters reject it before SQL.
  4. Call the endpoint with curl and a foreign Origin. The server answers 403.
  5. Send 61 requests in one minute. Request 61 gets 429.

The companion guide on retrieval served as an MCP tool adds a fourth, text-search tool over your articles.

How TensorPass connects your MCP server to the visitor's AI

We built AI Connect so your chat calls your MCP server from the visitor's browser while the visitor's own AI picks the tool. You host the MCP server and pay for it.

AI Connect SDK. Free and open source under Apache 2.0. Its four packages are on npm under the @tensorpass scope since 16 November 2026, with npm provenance signed by the GitHub build. new McpToolSource('/api/mcp', 'Bookshop') is the whole client setup.

AI Wallet. Free. It runs in desktop Chrome, Edge, Brave and Opera from the Chrome Web Store, and in desktop Firefox from Firefox Add-ons.

Done-for-you service. We make a site AI native in under 24 hours, priced on quote.

The TensorPass MCP tools guide carries the full server code: the read-only annotations, the per-request tool registration, the rate limiter and the Next.js relay.

FAQ: MCP servers for site chats

Should my site chat call WebMCP or an MCP server?

Use an MCP server for catalogue search, product detail and availability, because those tools read data that lives on your server and must answer from any client. WebMCP is a proposed browser standard whose tools exist only while the page is open and use the visitor's current session. It fits actions tied to the open tab, such as filling the form on screen. A site runs both: the server for data, WebMCP for in-page actions once browsers ship it.

Does an MCP server for websites need OAuth?

Public read-only tools need none. Authorization is optional in the MCP specification, and a public catalogue exposes data your pages already show. Protect those tools with a per-address rate limit, 60 requests a minute as a default, and strict input schemas. Add the site's existing session for tools that act for a signed-in visitor. Full OAuth 2.1 with PKCE and Protected Resource Metadata fits clients that connect on behalf of an account holder.

How many tools should a public chat expose?

Four cover a catalogue site: a facet list, a search, an item detail and an availability check. Ship the first three, which read your own database, before the fourth, which calls an outside booking or stock system. Every extra tool adds text the model reads on each turn and widens what a manipulated prompt reaches. OWASP lists excessive functionality as one of the three causes of Excessive Agency in its 2025 Top 10 for LLM applications.

Why does my server log 405 errors on GET?

The Streamable HTTP transport lets a client open a server stream with a GET request. A stateless server that offers no stream answers 405 Method Not Allowed, which the specification lists as the correct reply. The client asks once per connection, accepts the 405 and continues over POST. Treat a 405 on GET as normal traffic, and alert on 403 Forbidden from Origin checks and 429 Too Many Requests from the rate limiter instead.

How do I stop the chat from becoming a scraping endpoint?

Cap each search at 25 results, keep a per-address limit of 60 requests a minute and return only the fields your public pages already show. A scraper reaches the same rows through your HTML, so the MCP server adds no new exposure when it returns public data only. Keep unpublished items, internal prices and supplier fields behind the staff level, where the tool list is built only after the role check passes.

Your first deploy: three read-only tools behind /api/mcp

Deploy list_facets, search_catalogue and get_item this week on a read-only Postgres role, with Origin validation and a 60-requests-a-minute limit. Run the five chat tests, then read a week of logs before you register check_availability. The AI chatbot security guide for a public website lists the attacks to rerun after each new tool.

Measure requests per conversation in your own logs and compare them with the 7 used in the cost example above; that figure sets the real monthly bill of your MCP server for websites.

Also worth reading:

Sources:

Questions

Should my site chat call WebMCP or an MCP server?
Use an MCP server for catalogue search, product detail and availability, because those tools read data that lives on your server and must answer from any client. WebMCP is a proposed browser standard whose tools exist only while the page is open and use the visitor's current session. It fits actions tied to the open tab, such as filling the form on screen. A site runs both: the server for data, WebMCP for in-page actions once browsers ship it.
Does an MCP server for websites need OAuth?
Public read-only tools need none. Authorization is optional in the MCP specification, and a public catalogue exposes data your pages already show. Protect those tools with a per-address rate limit, 60 requests a minute as a default, and strict input schemas. Add the site's existing session for tools that act for a signed-in visitor. Full OAuth 2.1 with PKCE and Protected Resource Metadata fits clients that connect on behalf of an account holder.
How many tools should a public chat expose?
Four cover a catalogue site: a facet list, a search, an item detail and an availability check. Ship the first three, which read your own database, before the fourth, which calls an outside booking or stock system. Every extra tool adds text the model reads on each turn and widens what a manipulated prompt reaches. OWASP lists excessive functionality as one of the three causes of Excessive Agency in its 2025 Top 10 for LLM applications.
Why does my server log 405 errors on GET?
The Streamable HTTP transport lets a client open a server stream with a GET request. A stateless server that offers no stream answers 405 Method Not Allowed, which the specification lists as the correct reply. The client asks once per connection, accepts the 405 and continues over POST. Treat a 405 on GET as normal traffic, and alert on 403 Forbidden from Origin checks and 429 Too Many Requests from the rate limiter instead.
How do I stop the chat from becoming a scraping endpoint?
Cap each search at 25 results, keep a per-address limit of 60 requests a minute and return only the fields your public pages already show. A scraper reaches the same rows through your HTML, so the MCP server adds no new exposure when it returns public data only. Keep unpublished items, internal prices and supplier fields behind the staff level, where the tool list is built only after the role check passes.
Read the quickstartRead the changelog