Back to the red bull cans

Solo build

MCP chat client

A chat where AI can use outside tools, but asks you before each one

ShelvedApr 2025

Video in the works

MCP chat client

Asking a question, approving two tool calls at once, and the streamed answer.

About the project

A web chat where GPT-4o can use tools from any MCP server you list (MCP is a standard way to plug tools into AI), but only after you allow each call.

A web chat where GPT-4o can use tools from any MCP server you list in a config file, but only with your permission. I built it in April 2025 to learn how the client side of MCP works.

How it works

  1. Start the servers

    Each MCP server in the config starts up, and its tools are collected.

  2. Ask

    You type a question; the model gets the tools as functions.

  3. Approve

    Every tool the model wants to use waits for Allow or Deny, several at once if needed.

  4. Answer

    The reply streams back, with tables shown properly.

Under the hood

Server
Express 5, the OpenAI SDK, and the MCP SDK client over stdio.
Chat page
Plain HTML and JavaScript, with Markdown rendering.

What I did

  • Starts each configured MCP server, finds its tools and turns them into OpenAI tools
  • A reasoning loop with up to 5 steps that stops if the model repeats itself
  • Every tool call waits for Allow or Deny in the chat
  • Streaming replies, with tool calls rebuilt from the streamed pieces
  • Sessions with a 30-minute timeout, and a way for other systems to push a message into a live chat
  • Rewrote my first version from scratch into a clean structure, and built the chat page

What was new

  • Moved from parsing the model's text to native function calling
  • One approval prompt for several tool calls at once

Problems I hit, and how I fixed them

  1. When the model asked for several tools, only the first got a permission prompt.

    Fix Collect all calls first, then ask once for all of them.

  2. In streaming mode, tool calls arrive in pieces.

    Fix Rebuild each call by index, and fall back to non-streaming on errors.

  3. The agent could loop forever.

    Fix A step limit and a memory of replies already seen.

Screenshots

Screenshots in the works

Real screens from MCP chat client go here.