# 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.

8 steps. Checked 2026-12-06. Page for people: https://app.makeaguide.guides.hopperlabs.ai/guides/add-a-connector

You start with: A product with something worth asking for; Somewhere to host one HTTPS endpoint.

You end up with: A server (it offers your tools); An address (the same one for every client); A line for each client (paste it and the connector is added); A listing (where agents look).

## Steps

### 1. Pick the jobs

Write 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](https://app.makeaguide.guides.hopperlabs.ai/guides/design-tools.md)

### 2. Write the server

One 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.

```ts
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.

From `connector/src/hub.ts`:

```typescript
/** 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. Add a tool

Give 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.

```ts
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.

From `connector/src/tools/shared.ts`:

```typescript
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](https://app.makeaguide.guides.hopperlabs.ai/guides/design-tools.md)

### 4. Return fixable errors

When 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.

```ts
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.

From `connector/src/tools/shared.ts`:

```typescript
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. Put it at an address

Run 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`.

From `connector/server.ts`:

```typescript
  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. Ask it for its tools

Send 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.

```sh
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:

```shell
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. Add it to each client

Give 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.

```sh
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.

```json
{
  "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.

From `src/agent-doors.ts`:

```typescript
    { 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](https://app.makeaguide.guides.hopperlabs.ai/guides/test-agents.md)

### 8. Help agents find it

Write 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.

From `src/agent-copies.ts`:

```typescript
    '## 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

## 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

- [Model Context Protocol specification 2026-07-28, changelog](https://modelcontextprotocol.io/specification/2026-07-28/changelog.md), read 2026-12-06, sha256 fd286a50738078eb7d8a815b13a547eaa430e4abb517d3989bb25983466da37a
- [Model Context Protocol specification 2026-07-28, tools](https://modelcontextprotocol.io/specification/2026-07-28/server/tools.md), read 2026-12-06, sha256 e4fcffe263254cb7cc6b95854436091a541e77ea88cd53431ab26f9e2429f9b7
- [MCP TypeScript SDK, serving from a web-standard handler](https://raw.githubusercontent.com/modelcontextprotocol/typescript-sdk/main/docs/serving/web-standard.md), read 2026-12-06, sha256 5de5c78370a66521377057ec6e5a9e51bbe0207bfbe3ed6cc666714728e96325
- [MCP TypeScript SDK, serving over HTTP](https://raw.githubusercontent.com/modelcontextprotocol/typescript-sdk/main/docs/serving/http.md), read 2026-12-06, sha256 05d2e81f2fed3bc6b1ca6bde531697b8bb74d1c2ef2394c5560167cd6187801b
- [MCP TypeScript SDK, serving legacy clients](https://raw.githubusercontent.com/modelcontextprotocol/typescript-sdk/main/docs/serving/legacy-clients.md), read 2026-12-06, sha256 8040a5e5580f4924552905e7519be2f475178ea4d70962f201e1e3dafb466ce2
- [Claude Code, connecting to MCP servers](https://code.claude.com/docs/en/mcp.md), read 2026-12-06, sha256 6c49c6d48f5e5e07051968231c9526958f75428cca8d217b4a4fb5279d90ae1f
- [Claude, adding a custom connector](https://claude.com/docs/connectors/custom/add-unlisted.md), read 2026-12-06, sha256 6d8f63425897dde9b7d6a9e0d245f61b003dba27f8085413a636402b3c4632d1
- [Codex, Model Context Protocol](https://learn.chatgpt.com/docs/extend/mcp.md?surface=cli), read 2026-12-06, sha256 12266629489c323c218c3b360db305144863b901b80b4e70b53924825ecc56e4
- [Gemini CLI, MCP servers](https://raw.githubusercontent.com/google-gemini/gemini-cli/main/docs/tools/mcp-server.md), read 2026-12-06, sha256 9e4608980e3adf50d39c6b336536829257f45f48a83f5e7e677a622929693b46
- [ChatGPT, connecting a custom MCP server](https://developers.openai.com/plugins/deploy/connect-chatgpt.md), read 2026-12-06, sha256 979f47ad47e83757f8bd9fca5cbd898d7e9a1fb0d534b6021e3031f6207a224a
- [VS Code, MCP configuration reference](https://code.visualstudio.com/docs/agents/reference/mcp-configuration.md), read 2026-12-06, sha256 84ab48aea428fc5f4edaa7957afd1a787548ca1cef1fc0ec7bc48447e113f1b6
- [MCP Registry, remote servers](https://modelcontextprotocol.io/registry/remote-servers.md), read 2026-12-06, sha256 124dc969f2cf9f5ebb606b0d7fc2d4fb7a06cd71a2871cb518f125b531acb81f
- [MCP Registry, quickstart](https://modelcontextprotocol.io/registry/quickstart.md), read 2026-12-06, sha256 2e017084feed66b88f6af48c4d8a4a0d0ef74c92ef7d3197b4ea9af517261286
- [The /llms.txt file](https://llmstxt.org/index.md), read 2026-12-06, sha256 d89ead25c4192b3f3a2a09e858df0c3f121bf616cb130cb070100201b9c7aa56

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

## For agents

- Connector for this guide: https://app.makeaguide.guides.hopperlabs.ai/api/mcp/add-a-connector (tools: list_guides, search, get_guide, fetch, define_word, connector_setup)
- Connector for every guide: https://app.guides.hopperlabs.ai/api/mcp
- Skill: https://app.makeaguide.guides.hopperlabs.ai/skills/hopper-add-a-connector/SKILL.md
- Tests written: 6. What agents did with them: https://app.makeaguide.guides.hopperlabs.ai/results
- Next guide: [Write a skill](https://app.makeaguide.guides.hopperlabs.ai/guides/write-a-skill.md)
