Guides8 stepschecked 6 December 2026

Give your product a connector

Put your product at one public address that Claude, ChatGPT, Codex and Gemini can all add, with tools that do your product's jobs.

  • A product with something worth asking for
  • Somewhere to host one HTTPS endpoint
A connectorone address
  • A serverit offers your tools
  • An addressthe same one for every client
  • A line for each clientpaste it and the connector is added
  • A listingwhere agents look

Steps

  1. Step 1: Pick the jobsWrite down the few things people ask your product for. Each one becomes a tool.

    What should a connector do?

    The few things people already ask your product for. Write each one as a request in their words, such as "find my note about the launch". Each request you keep becomes one tool.

    A connector is not a copy of your API. Leave out anything nobody asks for. You can add a tool later.

    Should the first tools change anything?

    No. Start with tools that only read. A public server that only reads can run with no sign-in, and Claude and Codex both connect to one. Tools that change things can wait until you have sign-in.

    Write the list down before you write code:

    • the request, in a person's words;
    • what the tool needs to be told;
    • what it gives back.

    This step in full: Design tools an agent uses well

  2. Step 2: Write the serverOne file makes a server that answers the Model Context Protocol at one address.

    What is the least code that works?

    One file. The protocol's official TypeScript package, @modelcontextprotocol/server, gives you createMcpHandler. You hand it a function that makes a server and adds your tools. It runs on Node.js, Bun and Deno. This guide used version 2.4.0.

    import { createMcpHandler, McpServer } from '@modelcontextprotocol/server';
    import * as z from 'zod/v4';
    
    const handler = createMcpHandler(() => {
        const server = new McpServer({ name: 'notes', version: '1.0.0' });
        server.registerTool('add-note', { description: 'Append a note', inputSchema: z.object({ text: z.string() }) }, async ({ text }) => ({
            content: [{ type: 'text', text: `Saved: ${text}` }]
        }));
        return server;
    });
    
    export default handler;
    

    Does the server remember each client?

    No. Since revision 2026-07-28 of the protocol, a client sends no opening handshake and the server keeps no session. Every request stands alone, and your function runs again for each one. Add your tools inside that function, never outside it.

    Older clients still send the handshake. The package answers them too, unless you turn that off.

    connector/src/hub.ts
    /** The HTTP face of one connector. Every request gets a fresh server; nothing is remembered between requests. */
    export function handler(guide?: string) {
      const key = guide ?? '';
      let found = handlers.get(key);
      if (!found) handlers.set(key, found = createMcpHandler(() => server(guide), { legacy: 'stateless', responseMode: 'json' }));
      return found;
    }
  3. Step 3: Add a toolGive each job a name, a description, its inputs and a function that does the work.

    What does a tool need?

    A name, a description, the inputs it takes and a function that does the work. You give them to registerTool. The description is all an agent knows about the tool, so write it for someone who has never seen your product.

    server.registerTool('find-note', {
        title: 'Find a note',
        description: 'Find notes by the words in them. Use it when someone asks for a note they wrote. Returns each matching note with its number.',
        inputSchema: z.object({ words: z.string().describe('The words to look for.') }),
        annotations: { readOnlyHint: true }
    }, async ({ words }) => ({ content: [{ type: 'text', text: await findNotes(words) }] }));
    

    How does a client know a tool only reads?

    You say so, with readOnlyHint: true. Without it a client takes the tool as one that may change things. Claude Code runs calls marked this way alongside other read-only calls.

    connector/src/tools/shared.ts
    export const listGuides = tool({
      name: 'list_guides',
      title: 'List the guides',
      description: 'List every guide with the job it covers and what you end up with. Start here when you do not know which guide applies. Takes nothing.',
      input: z.strictObject({}),
      output: z.strictObject({ guides: z.array(z.strictObject({ id: z.string(), title: z.string(), description: z.string(), gets: z.string(), steps: z.number().int(), url: z.string(), tools: z.array(z.string()) })) }),
      run: (_args, { library }) => ({
        guides: library.guides.map(guide => ({ id: guide.id, title: guide.title, description: guide.description, gets: guide.gets, steps: guide.steps.length, url: guideUrl(guide.id), tools: guide.tasks.filter(task => task.kind !== 'read').map(task => task.tool) })),
      }),
    });

    This step in full: Design tools an agent uses well

  4. Step 4: Return fixable errorsWhen a call goes wrong, return words the agent can act on and mark the result as an error.

    What should a tool do when a call goes wrong?

    Return an ordinary result that says what was wrong and what to try next, and mark it with isError: true. The agent reads the words, corrects the call and tries again. The specification keeps this apart from a protocol error, which is for a request that is broken.

    return {
        content: [{ type: 'text', text: 'There is no note 12. Call list-notes to see the numbers.' }],
        isError: true
    };
    

    What makes an error fixable?

    It names what was wrong and the next call to make. "Not found" gives the agent nothing to do. "There is no note 12. Call list-notes to see the numbers." tells it the next step.

    Write the message for the agent, in full sentences. Leave out anything private, such as a file path on your server.

    connector/src/tools/shared.ts
    const unknownGuide = (id: string, ids: readonly string[]) => new Problem(`There is no guide "${id}". The guides are: ${ids.join(', ')}. Call list_guides to see what each is for.`);
  5. Step 5: Put it at an addressRun the server where anyone can reach it, at an address that starts with https.

    Where does the server have to run?

    Anywhere that gives it a public address starting with https://, such as https://example.com/mcp. Claude's apps connect from Anthropic's servers, not from the person's computer, so an address on your own machine does not work for them.

    On Bun, Deno and Cloudflare Workers, export default handler is enough. On Node.js, wrap handler once with toNodeHandler from @modelcontextprotocol/node.

    Does it need sign-in?

    Not for a public server that only reads. Claude's apps offer "No sign-in" as a choice, and Codex connects to a server without it. Add sign-in before a tool changes something or shows something private.

    What does the package not check?

    Where a request comes from. handler reads neither the Origin header nor the Host header. The package gives you two functions for that, originValidationResponse and hostHeaderValidationResponse. Put them in front of handler.

    connector/server.ts
      const { host } = new URL(request.url), origin = request.headers.get('origin');
      if (!OWN_HOST.test(request.headers.get('host') ?? host)) return json({ error: 'This connector does not answer to that host name.' }, 403);
      if (origin !== null && !webOrigin(origin)) return json({ error: 'The Origin header is not a web origin.' }, 403);
  6. Step 6: Ask it for its toolsSend one request that asks for the list of tools, and read what comes back.

    How do you know the server answers?

    Send it one request that asks for its list of tools. If the reply names your tools, the server works.

    curl -s -X POST https://example.com/mcp \
      -H 'Content-Type: application/json' \
      -H 'Accept: application/json, text/event-stream' \
      -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
    

    What should come back?

    Each tool, with its name, its description and its inputSchema. Read them as an agent would: with no other knowledge of your product. If a description is unclear here, it is unclear to every agent.

    This request is in the older form. It works because the package answers older clients unless you turn that off.

    Why not open the address in a browser?

    A browser asks in a different way, so it is not a test. This site's connector answers a browser with a short refusal that says to send a request like the one above.

    Run
    curl -s -X POST https://example.com/mcp -H 'Content-Type: application/json' -H 'Accept: application/json, text/event-stream' -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
  7. Step 7: Add it to each clientGive the same address to each client, in the way that client wants it.

    What does each client need?

    The same address, given in that client's own way. Choose a short name in lowercase letters, digits and hyphens. Gemini CLI says not to use underscores.

    claude mcp add --transport http notes https://example.com/mcp
    codex mcp add notes --url https://example.com/mcp
    gemini mcp add --transport http notes https://example.com/mcp
    

    How is it added in the apps?

    In Claude, select Add, then Add custom connector, and paste the address, or run claude mcp add --web notes https://example.com/mcp. In ChatGPT, select the plus button, then Add custom MCP server.

    What goes in a settings file?

    For clients that read .mcp.json, such as Claude Code and VS Code, an entry with "type": "http" and url. The type line is required. Claude Code reads an entry without it as a program to start.

    {
      "mcpServers": {
        "notes": { "type": "http", "url": "https://example.com/mcp" }
      }
    }
    

    Gemini CLI's own settings file differs. There httpUrl means Streamable HTTP, and url means an older way of connecting, called SSE.

    src/agent-doors.ts
        { id: 'claude-code', client: 'Claude Code', how: 'Run this in a terminal.', kind: 'run', text: `claude mcp add --transport http ${name} ${url}` },
        { id: 'codex', client: 'Codex', how: 'Run this in a terminal. The ChatGPT desktop app and the IDE extension read the same setting.', kind: 'run', text: `codex mcp add ${name} --url ${url}` },
        { id: 'gemini-cli', client: 'Gemini CLI', how: 'Run this in a terminal.', kind: 'run', text: `gemini mcp add --transport http ${name} ${url}` },

    This step in full: Test which agent does best

  8. Step 8: Help agents find itWrite the address where people and agents look, on your own site, in your list for agents and in the registry.

    Where should the address be written?

    On a page of your own site, with the line each client needs beside it. A person copies one line and the connector is added. Say on that page what the tools do and whether there is sign-in.

    How does an agent find it on your site?

    Through llms.txt, a Markdown file on your site that lists links for agents to read. Add a link to your connector there, with a few words on what it offers. It is a proposal, not a standard.

    Is there a public list of servers?

    Yes, the MCP Registry. You describe your server in a file named server.json, with its address under remotes, and publish it with the mcp-publisher command. The registry keeps a description of your server, not its code. The address must be public.

    src/agent-copies.ts
        '## Connectors',
        [
          `- [Every guide](${HUB.url}): Model Context Protocol over HTTP, no sign-in. Add it with: ${connectorSetup(HUB)[0]!.text}`,
          ...library.guides.map(guide => `- [${guide.title} only](${guideConnector(guide.id).url})`),
          `- [Connectors and skills as data](${SITE}/connectors.json)`,
        ].join('\n'),

What you keep

  • One server that offers your product's jobs as tools
  • One public address that every client adds
  • The line each client needs, ready to paste
  • A listing where people and agents find it

Did agents get it right?

AgentConnector addedThe guide's own connector
Claude Codeclaude-sonnet-5-518 of 1815 of 18
Codexgpt-6.2-sol10 of 1815 of 18

Run 6 December 2026. How the tests are run, and every result

Words used here

Address
The web address of your server, starting with https, that a person gives to a client to add your connector, such as https://example.com/mcp.
Agent
A program that uses an AI model to do a job for someone, reading pages and calling tools as it goes. Claude, ChatGPT, Codex and Gemini are agents.
Client
The program an agent runs in, such as Claude Code, the ChatGPT app or Gemini CLI, which connects to your server and calls its tools.
Connector
An address an agent connects to that offers tools, using the Model Context Protocol (MCP). Often called an MCP server.
Header
A named line sent along with a web request, such as Origin, which says which site the request came from.
Model Context Protocol
The shared rules by which a client asks a server what tools it has and calls them, so one server works with many agents.
Registry
A public list of servers, each with a description and an address, that people and programs search to find one.
Server
The program you run that answers a client's requests, by listing your tools and doing the work when one is called.
Sign-in
The step where a person proves who they are before a server answers, which a public server that only reads may leave out.
Streamable HTTP
The way a client talks to a server over the web in the Model Context Protocol, where each message is one request sent to the server's one address.
Tool
One named thing an agent can ask a connector to do, with the facts it needs described well enough for the agent to supply them.

Questions

Do I need a different server for each agent?

No. One server at one address. Claude, ChatGPT, Codex and Gemini CLI all add the same address. Only the way you give it to each client differs.

Does my connector need sign-in?

Not if it is public and only reads. Claude's apps offer "No sign-in" as a choice, and Codex connects to a server without it. Add sign-in before a tool changes something or shows something private.

Can I use an address on my own computer?

For the curl check, yes. For Claude's apps, no. They connect from Anthropic's servers, not from your computer, so the address must be public.

Will older clients still work with my server?

Yes, if you use the official TypeScript package as it comes. Revision 2026-07-28 of the protocol dropped the opening handshake and sessions, but the package still answers clients that send them. Setting `legacy` to `'reject'` turns that off.

Why does Claude Code refuse my .mcp.json entry?

Most often the entry has `url` and no `type`. Add a `type` line with the value `http`. Claude Code reads an entry with no `type` as a program to start on your computer, so an address alone is an error.

Were these commands run for this guide?

Not all. The Claude Code and Codex commands were read from each tool's own help text. Gemini CLI was not installed, so its command comes from its documentation and was not run. The steps for the Claude apps, ChatGPT and VS Code also come from their documentation.

Sources

Written from the primary pages listed as sources, read on 2026-12-06, and from this site's own files. No outside reviewer.