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
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.
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.
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.
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.
// 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:
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:
Remember that the support team wants the dashboard to default to last 7 days.
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:
The one above. Your AI captures thoughts into your own database from any chat.
ctx.db.query(...)
Your AI pings you when something specific happens, via an [[api]] you declared.
ctx.api.call('slack', ...)
Full-text search over a notes table you have been filling with the tool above.
ilike '%' || $1 || '%'
Your AI finds a customer in your own private CRM table by name or email.
where email = $1
Your AI reads your deployment log and summarizes it back into the chat.
where created_at > now() - '1d'
Pull your tracked mentions and ask the AI to flag anything urgent.
order by score desc
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?
How does the AI know which tool to call?
Does my server need OAuth?
ctx.Can my tool read and write a database?
ctx.db.query(...). You don't configure it; it is just there.Can my tools call external APIs (Slack, Notion, etc.)?
[[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?
mcp/ and the next call hits the new code.Will the server stay up when my editor closes?
Can I export everything?
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 →