My MCP servers let everyone in
I run seven of my own MCP servers: Tududi, Paperless, Sonarr/Radarr, mail, YamTrack, Flight Recorder and a book price tool. Claude can reach my tasks, documents and mailbox through them. Handy. And, as a security review showed, also an open door.
The jump scare
I had the code of my MCP servers reviewed. One finding, severity high: the authorize() function approved every request. It only checked that the PKCE parameters were valid and that the redirect pointed to an allowed host. No password, no user check.
Translation: anyone who knows the URL of my MCP server can attach it as a connector to their own claude.ai account. From then on, their Claude can read my mail, browse my Paperless archive and edit my tasks. No break-in needed. The front door wasn't just unlocked, it had no lock at all.
How MCP OAuth fits together
An MCP server that uses OAuth has four endpoints that matter:
| Endpoint | Purpose |
|---|---|
| /register | A client announces itself |
| /authorize | The user grants consent (the front door) |
| /token | The client trades that consent for a token |
| /mcp | The actual work, only with a valid token |
If /authorize approves blindly, the rest of the chain is worthless. The token that comes out is only as trustworthy as the consent that came before it.
Two ways to close it
Option A: a password step inside authorize(). A shared password, asked at link time. Clean, but it means changing, testing and maintaining seven codebases.
Option B: /authorize reachable from LAN or VPN only. One rule per host in Nginx Proxy Manager, under Advanced:
location = /authorize {
allow 192.168.0.0/16;
allow 172.16.0.0/12;
allow 127.0.0.1;
deny all;
include conf.d/include/proxy.conf;
}
The other endpoints stay open. Linking now only works from home or over the VPN. Existing connectors keep working, because they use /token and /mcp.
A warning if you copy this: 172.16.0.0/12 is the Docker range. If Docker or a proxy in front of NPM (Cloudflare, for example) hides the real client IP, all traffic arrives as 172.x and the door is wide open again. Only an outside test tells you which situation you are in.
Why I picked B
Keep it stupid simple. Option B took about ten minutes for all seven hosts and touched zero lines of code. Option A would mean a custom piece of security code per server, and I would have to maintain all of it myself. A password step on top of a network restriction added little in my setup. I link rarely and always from home.
The trade-off: B protects the moment of linking, not the usage afterwards. That part is the token's job. For a homelab with one user that is enough. If I shared these servers with others, I would need A (or both).
Testing from the outside
Testing a defense from the inside is like checking the locks from inside the house: you never see what the outside sees. I tested from an external IP, through a VPN container:
| Endpoint | Result from outside |
|---|---|
| /authorize | 403 (closed) |
| metadata | 200 (open, as intended) |
| /register | 400 |
| /token, /mcp | 401 (token required) |
Only linking was closed, everything else behaved as designed. Then I re-linked a connector from my LAN and over the VPN: the logs showed a 302 on /authorize and the link worked.
Did anyone get in?
The first question after a finding like this. Claude went through the nginx logs looking for unknown links to /authorize and found nothing. But that is luck, not design: for as long as these servers were online, it could have happened.
The side effect: my own fail2ban bit me
While testing I fired several requests without a token at /token and /mcp. Result: 401, 401, 401. My fail2ban jail for repeated 401s saw an attacker and banned my test host. Fine work by the guard, shame about the target.
Lesson: when you test your security, you also test your other security. Lift the ban if you have to.
What I take away from this
- An MCP server is an API with access to your private life. Treat /authorize as the door, not a formality.
- Put the approval where you hold the keys. A network restriction is cheaper than custom auth code and often enough for a homelab.
- Test from the outside. A passing test from the inside proves nothing.
- Let a review go through your own code. I would not have spotted this myself. A security review with Claude found it in one pass.
Want to reach out? Contact me.