cd /news/ai-agents/i-built-one-self-hosted-mcp-server-t… · home › topics › ai-agents › article
[ARTICLE · art-182937] src=dev.to ↗ pub= topic=ai-agents verified=true sentiment=↑ positive

I built one self-hosted MCP server that every AI client shares

A developer built SelfMCP, a self-hosted MCP server that lets multiple AI clients — including Claude Code, claude.ai and Codex — share one set of tools, memory and API keys through a single OAuth 2.1 sign-in. The server exposes upstream tools in three tiers (search_tools, get_tool, call_tool) so the visible tool list stays fixed as new MCP servers are added, and stores credentials in a vault the model can use but not read. Released as v0.1.0-beta.2 under AGPL-3.0, it runs on Python 3.12, the official MCP SDK, Postgres, Caddy and Docker, and installs on a $5 VPS with 2 GB RAM.

key takeaway

SelfMCP's three-tier tool exposure (search_tools, get_tool, call_tool) keeps the client-visible tool list fixed as upstream MCP servers are added, avoiding the degraded tool selection and context bloat that comes with putting 300 tools in front of a model.

by read2 min views5 publishedDec 6, 2026

Every AI app I use starts from zero.

Claude Code on the laptop, claude.ai on my phone and Codex each keep their own MCP servers, their own API keys and their own memory. A new laptop or a new AI meant an evening of setting everything up again, and my notes, passwords and Telegram were not reachable from any of them.

So I built SelfMCP: one MCP server, on a server I own, that every AI connects to. I think of it as an exosuit. The AI is swappable, the suit stays.

You connect each client once, with one URL and a browser sign-in (OAuth 2.1). After that every AI you use sees:

claude mcp add ... line you would put in a local config;

Without SelfMCP With SelfMCP
Memory each AI forgets the others one memory, every AI reads and writes it
MCP servers set up again in every app add once, every AI has it, no reconnect
API keys pasted into config files in a vault: the AI uses them, never sees them
New laptop or new AI an evening of setup paste one link

If you put 300 tools in front of a model, it gets worse at picking the right one, and your context fills up before you say anything. SelfMCP exposes tools in three tiers:

get_tool and calls it through call_tool. search_tools, connect, status. The exposed tool list never changes when you add an upstream MCP, so no client has to reconnect.

Paste this into Claude Code or Codex:

Install SelfMCP for me: https://github.com/AlexZai007/selfmcp

or run it in a terminal:

curl -LsSf https://raw.githubusercontent.com/AlexZai007/selfmcp/main/install.sh | sh

It asks where to install (a VPS over SSH, this server, or only this computer), sets up HTTPS, a firewall and nightly backups, moves your notes, Claude skills and MCP configs over (passwords and keys go to the vault, not into notes), and connects Claude Code and Codex on your machine. Any $5 VPS with 2 GB RAM works.

Python 3.12, the official MCP SDK, Postgres, Caddy, Docker. AGPL-3.0. About 100 decision records in docs/decisions if you like reading why things are the way they are.

It is a beta (v0.1.0-beta.2), so expect rough edges. I would love feedback on two things: the security model (docs/ARCHITECTURE.md, SECURITY.md), and whether "one MCP for every client" matches how you use AI.

── more in #ai-agents 4 stories · sorted by recency
── more on @selfmcp 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/i-built-one-self-hos…] indexed:0 read:2min 2026-12-06 · —