How to connect your MCP server to ChatGPT

Day 3, 30 minutes · advanced

Goal of this lessonGive your local MCP server a public https address, add it in ChatGPT as a custom MCP server, and test it with a written set of prompts.

Why it matters

To connect an MCP server to ChatGPT, you give it a public https address, add it as a custom MCP server, and check with written prompts that ChatGPT picks the right tool.

A server on your own computer cannot be reached from ChatGPT. ChatGPT connects to remote servers over https, so you need a public address first. That is also the moment where a mistake can cost you: a tunnel (a temporary public address that forwards to your computer) exposes your server to everyone who finds the address.

Today Ingrid gives the Moorhen server a public address, adds it in ChatGPT, and checks that ChatGPT really picks the right tool. She does not trust one lucky prompt. She writes a small set of prompts on paper, direct ones, indirect ones, and one that must not call a tool, and runs them all. You end with a connected plugin and a written test set you can run again after every change.

Why https and a public address

The help article says ChatGPT connects to remote MCP servers, not directly to a server on your computer. In the Add form you enter the server's public https address, which must end in the MCP path, here /mcp. For testing, the quickstart uses a development tunnel; its example is ngrok http 3000, which is only an example, any https forwarding service will do. A tunnel is meant for testing: stop it when you are done, and never leave a server with real customer data behind one.

If your server runs on a private network or on-premises, the docs describe a Secure MCP Tunnel: you create one in the OpenAI Platform, get a tunnel_id, and run the tunnel-client program next to your server with a runtime API key. The page says it does not support public submission, so for a plugin you publish you need a normal public https host. This course uses the simple route.

Keep secrets and addresses out of git

You make .gitignore first, check that git ignores .env, and only then create .env. The file holds your public address, so the server's host guard allows it. Never commit a real key or token; this course only uses made-up practice values.

Adding the server

The help article lists the click path in the current Plugins experience: Plugins, the plus button, Add custom MCP server, a name, the server URL, the authentication setting, the risk warning checkbox I understand and want to continue, then Create as a plugin. Review the tools ChatGPT found, then install the plugin. The authentication choices on the form are OAuth, no authentication, or OAuth or no authentication. This lesson uses No authentication because the two tools are public. If your account does not show the button, go back to lesson 1: your plan or role may not allow it.

To use it, start a new chat and mention the plugin with @. The quickstart tests in a Work chat, reached from the homepage tab switcher; if you do not see your plugin in a normal Chat, try Work. After you change tool names, descriptions or flags, use Refresh on the plugin so ChatGPT reads the new list.

Test with a written set

The pages on testing and optimising say to test direct prompts (that name the plugin), indirect prompts (that state the goal) and prompts that should not trigger it. For each prompt write down: which tool was called, whether the arguments were right, and whether the answer matched the data. Change one thing at a time, then run the whole set again.

The steps

  1. Create .gitignore, check it, then .env.
  2. Start a public https address to port 3000.
  3. Put the address in .env and restart the server.
  4. Check it from outside with the Inspector command line.
  5. Add the server in ChatGPT and install it.
  6. Run your prompts, then Refresh after any change.

Pick your tool below and follow the steps.

If something fails

  • 421 "Invalid Host header": the address in .env does not match the address in the call. Fix PUBLIC_URL, restart the server.
  • The Add button is missing: your plan or role does not allow it (lesson 1).
  • ChatGPT shows old tools: use Refresh.
  • The plugin is never picked: rewrite the description to say when the tool should be used.

Common mistakes

  • Putting /mcp in PUBLIC_URL. It holds only the origin.
  • Leaving the tunnel on when you stop working.
  • Testing one prompt and calling it done.

Today's actions

Ticks are not saved without an account

Do it in OpenAI API

OpenAI API

  1. Run git init. Create .gitignore from the text below, then run git check-ignore -v .env: it must print a line that names .gitignore.
    .env
    .venv/
    __pycache__/
    
  2. Start a public https address that forwards to port 3000, with a development tunnel or another https forwarding service. The quickstart's example is ngrok http 3000. Copy the https address it prints. This course did not run a real tunnel.
  3. Create .env with the line below, with your own address instead of the placeholder and no /mcp at the end. Then stop the server and start it again with python moorhen.py.
    PUBLIC_URL=https://replace-me.example.net
    
  4. Check from outside: npx @modelcontextprotocol/inspector --cli https://YOUR-ADDRESS/mcp --transport http --method tools/list. You should see both tools. A 421 means the address in .env is wrong.
  5. In ChatGPT open Plugins, select the plus button, then Add custom MCP server. Enter a name, your address ending in /mcp, choose No authentication, tick I understand and want to continue, select Create as a plugin, review the tools and install.
  6. Open a new chat and mention the plugin with @. If it is not offered in Chat, switch the homepage tab to Work, as the quickstart does. Ask: Which kayaks are free on 2027-06-12?
  7. Create eval-prompts.md with these rows and fill in the last two columns as you run them. Add one prompt of your own.
    | Prompt | Should call | Tool called | Right answer? |
    | --- | --- | --- | --- |
    | Use Moorhen to list free kayaks on 2027-06-12 | list_free_kayaks | | |
    | Is a double kayak free on 2027-06-13? | list_free_kayaks | | |
    | Do kids need a life jacket at the launch? | get_launch_rules | | |
    | What is the wind limit for paddling? | get_launch_rules | | |
    | Write me a poem about lakes | none | | |
  8. After any change to a tool name, description or flag, restart the server, select Refresh on the plugin in ChatGPT, and run the whole table again.

Note: Menu names are from the help article read on 4 December 2026 and may change. The plugin only works while your server and tunnel run. Stop the tunnel when you finish, and use only made-up data in this server.

Paid planNeeds Business or Enterprise/Edu with permission to add custom MCP servers (web). Pro: read/fetch only. Free, Go and Plus are not named.

Checked on 4 December 2026 · Source: OpenAI Plugins docs: Connect and test your plugin (opens in a new tab)

Create a free account to save your progress. Sign in or sign up