general

Build a Working MCP Server in 15 Lines — Hosted Free

A small server with custom tools any AI assistant — Claude, Cursor, Codex, ChatGPT — can call during a chat. Fork the starter, drop a file in <code>mcp/</code>, and it is live with OAuth and a Postgres database, free.

What happens next

Step 1

Fork the starter

Open /apps/mcp and click Install. No account? That signs you up — free, no card. You get a working MCP server at {your-slug}.hatchable.site/mcp.

Step 2

Drop a tool file in mcp/

One file per tool, like the example below. The platform handles OAuth, the database, and the MCP wire protocol — you only write what the tool actually does.

Step 3

Connect any AI

Paste your URL into Claude, Cursor, Codex, ChatGPT, or anything that speaks MCP. Your tools appear in its tool list — no prompt engineering needed.

Open the MCP Server starter template
https://hatchable.com/apps/mcp

What an MCP server actually is

An MCP server is a small backend that exposes your own tools to any AI assistant — Claude, Cursor, Codex, ChatGPT. You write the tool (a few lines of code); the AI sees it in its tool list and calls it during a chat when it fits, with no prompt engineering on your side.

The catch with most "build an MCP server" tutorials: you end up writing OAuth, a database, and hosting before you can write the actual tool. Hatchable hands those to you so you only write the part that matters.

The whole tool, in about 15 lines

This is a complete, working tool that lets your AI save thoughts to your own private notebook from any chat. Nothing else — no auth code, no framework config, no hosting glue.

mcp/remember.js
// Save a thought to your private notebook from any AI chat.
export default {
  access: 'admin',                  // only you can call this
  inputSchema: {
    type: 'object',
    required: ['text'],
    properties: {
      text: { type: 'string', description: 'what to remember' },
      tag:  { type: 'string', description: 'optional tag' },
    },
  },
  handler: async ({ text, tag }, ctx) => {
    const { rows } = await ctx.db.query(
      'insert into thoughts (text, tag) values ($1, $2) returning id',
      [text, tag || null]
    )
    return { ok: true, id: rows[0].id }
  },
}

Plus a one-line migration so the thoughts table exists:

migrations/0001_init.sql
create table thoughts (
  id serial primary key,
  text text not null,
  tag  text,
  created_at timestamptz default now()
);

That is the entire thing. OAuth, hosting, Postgres, and the MCP wire protocol are already handled by the platform.

What this looks like in a chat

Once it is deployed, your AI sees remember in its tool list and uses it when it fits — no prompt engineering required:

you, to your AI

Remember that the support team wants the dashboard to default to last 7 days.

instantly
remembertext: "support team wants…"
savedid: 47

Got it — saved to your notebook. I can search your thoughts back later if you want.

What you could build

Once you have one tool live, more take minutes. A few patterns that show up again and again:

Each is one file in mcp/. Add a tool, your AI sees it on the next session.

What is wired up for free

You would otherwise be writing all of this before you wrote the first tool:

  • Live, authenticated remote MCP server at {your-slug}.hatchable.site/mcp
  • OAuth built in — per-account auth, no token plumbing in your tool code
  • Postgres database, file storage, and scheduled jobs — no config
  • Sub-second tool updates — drop a file, it is callable on the next request
  • Free forever for personal use. Custom domain on Builder ($12/mo flat, covers every project)

And unlike a local MCP server, the URL works when your laptop is closed. Your other AI in another chat can call it. Your friend can call it. It survives.

Connect any MCP client

Once your server is live, paste its URL into anything that speaks MCP Streamable HTTP:

Your tools appear automatically. Your code stays yours — real, portable Node + Postgres source with no proprietary lock-in.

Frequently asked

What is MCP?
Model Context Protocol — an open standard for AI assistants to call tools on remote servers. Claude, Cursor, ChatGPT, Codex, and Antigravity all speak it.
How does the AI know which tool to call?
The MCP protocol exposes each tool (name, description, inputSchema) to the AI on every session. The AI picks the right one based on what you ask — no prompt engineering on your side.
Does my server need OAuth?
Hatchable wraps every project in OAuth automatically. You don't write any auth code — your tool only sees the authenticated ctx.
Can my tool read and write a database?
Yes — every project gets a per-project Postgres database, available as ctx.db.query(...). You don't configure it; it is just there.
Can my tools call external APIs (Slack, Notion, etc.)?
Yes — declare [[api]] blocks in hatchable.toml and call them as ctx.api.call(name, ...). The platform attaches credentials at runtime; your code never sees the OAuth tokens.
How fast does a tool update?
Sub-second. Drop a file in mcp/ and the next call hits the new code.
Will the server stay up when my editor closes?
Yes. Unlike a local MCP server, Hatchable hosts your server remotely 24/7. Any client, anywhere, can call it.
Can I export everything?
Your code is standard Node + Postgres, fully portable and runnable anywhere, with no proprietary lock-in.

Ready to ship?

A small server with custom tools any AI assistant — Claude, Cursor, Codex, ChatGPT — can call during a chat. Fork the starter, drop a file in <code>mcp/</code>, and it is live with OAuth and a Postgres database, free.

Fork the MCP starter