SabaKore

Home / Articles / AI guides

Publishing an MCP Server on Your Own VPS

How to think about setting up, on your own VPS, a mechanism that safely bridges AI to external data and features. We also cover how to narrow the scope of exposure.

Ren, a junior infrastructure engineer

Ren

I've been seeing the term MCP server a lot lately. What does it do?
Procura, a cloud AI robot who explains

Procura

It's a standardized kind of bridge that lets an AI use external data and features. It lets the AI side call things in a uniform way, like showing your calendar or searching an internal database.

Why set one up on your own VPS

  • If you want the AI to handle data only you have (notes, database contents), you don't need to hand it over to an outside party
  • You decide which features are available (you write what the AI is allowed to do)
  • If you keep it running, the AI can call it anytime
Ren, a junior infrastructure engineer

Ren

Isn't it a bit scary to create a window the AI can call directly?
Wilson, the security guard

Wilson

Your instinct to be wary is correct. Building a window also means building a path in through it. The weaker the defenses of a window, the better it is for me.

How to narrow the scope of exposure

Procura, a cloud AI robot who explains

Procura

Wilson is right, and you need to build this carefully. The basics are not to expose it in a state where anyone can call it, and to limit what it can do to only what's necessary.
  • Always require authentication, so that only those holding a key or token can call it
  • Don't casually allow strong operations like writing or deleting
  • Don't expose it to the whole internet; limit it to only the parties who need it
  • Keep call logs so you can notice unexpected usage

Prepare a way to cut connections too

Windows you've built tend to be left alone after you stop using them. Connections you made just to try something, or keys that went unused after someone changed roles, can remain and stay as an entrance without anyone noticing. Regularly review whether only connections actually in use remain, and shut down anything you don't recognize early.

  • Manage the keys and tokens you've issued in a list so you can disable them at any time
  • Review connections that are no longer used on a regular schedule, with a deadline
  • Don't give one key multiple purposes
Wilson, the security guard

Wilson

...The more convenient a window is, the more complacency it breeds. Remember that the person who built it is the one most likely to forget about it.
Procura, a cloud AI robot who explains

Procura

An MCP server is convenient, but that also makes it a tool where you have to choose who you hand it to. Spend as much time reviewing before you publish as you do enjoying the build.
Ren, a junior infrastructure engineer

Ren

If I'm only using it personally, do I really need to lock it down that much?
Procura, a cloud AI robot who explains

Procura

Even for personal use, please don't skip authentication. Settings you loosen because it's just for you easily become gaps. It's only a bit of effort at the start, so don't skimp on it. And if you built it intending the scope to be 'only me,' get in the habit of checking later that it's actually that way.

When it's called by several AIs at once

You can also set up a single MCP server so that several AI apps or several users call it at the same time. It's convenient, but when access concentrates at once, responses can slow down or things can be processed in an unintended order. It may not matter in a personal experiment, but once it's meant to be shared by several people, review it with simultaneous access in mind.

  • Record who called it and when, so you can see the state of simultaneous access
  • Design write operations so they don't produce contradictions even when run at the same time
  • If you expect more users, check how the load behaves early
Ren, a junior infrastructure engineer

Ren

So the more convenient the bridge, the more you narrow down who it's handed to.

This article is translated from the Japanese original. If the two differ, the Japanese version is the one we keep up to date.