Deploying Your MCP Server With Prefect Horizon

Walk through deploying a Model Context Protocol server to Prefect Horizon, including GitHub setup, environment variables, and connecting the hosted server back to Claude as a custom connector.

Running an MCP server on your laptop is a great way to learn, but sharing it with other people means hosting it somewhere that is not tied to a single machine.

  • Prefect Horizon deploys directly from a GitHub repository that contains your server code.
  • Environment variables, entry points, and authentication are configured during the deploy step.
  • Adding a remote server to the Claude web app makes it available on your desktop and mobile apps too.

This lesson is a preview from our Building Your First MCP Server and Client Course Online. Enroll in a course for detailed lessons, live instructor support, and project-based training.

Once your MCP server works locally, the natural next question is how to put it somewhere your friends, teammates, or eventually customers can reach it. Prefect Horizon is one of the simplest paths from a local project to a hosted server, with most of the heavy lifting reduced to pointing at a repository and clicking deploy.

Preparing the GitHub Repository

Horizon expects a repository that contains just the server itself, not your whole learning project. Cursor or any similar editor can help carve out a clean copy of the server folder into its own repo, including the TOML file and the UV configuration that describe dependencies. The result is a small, self-contained project with everything needed to build and run.

That separation pays off later. You keep the teaching examples in one place and the deployable server in another, which avoids accidentally pushing notes or scratch files into production.

Creating a Horizon Account and Deploying

Signing up for Horizon takes seconds. Pick your preferred login method, create an account, and choose to add a new server. From there, the flow asks for two key pieces of information: the repository to deploy from, and the entry point for the server. A standard layout uses server.py as the entry point, which matches the project structure most FastMCP tutorials produce.

Free accounts have a few limits worth knowing. Authentication cannot be turned off on the free tier, which is fine for personal testing but means you will want to upgrade before sharing with a wider group. Otherwise, the deploy experience is the same, and every push to main triggers a fresh build on Horizon automatically.

Environment Variables and External APIs

If your server calls an external API, like a NASA endpoint that requires a key, you will need to register those environment variables before the first deploy. Horizon exposes a simple interface for adding key and value pairs, and the values are injected into your server at runtime.

During the build you can watch standard requirements being installed, UV syncing the project, and FastMCP preparing to serve traffic. Depending on load, the first build can take a few minutes. The dashboard shows full logs, which is useful when something goes wrong and equally satisfying when everything works.

Connecting the Hosted Server to Claude

Once the build finishes, your server has a public URL. Inside the Claude web app or desktop app, go to connectors and choose to add a custom connector. Give it a name, paste the server URL, and save. Click connect, log in with your Horizon account when prompted, and the connector is ready to use.

A useful tip: adding a connector through the Claude web app automatically makes it available in the desktop and mobile apps linked to the same account. That is one of the quiet advantages of a remote server compared to a local one: it travels with you rather than living on a single machine.

Horizon turns MCP deployment into a click and forget experience. Point it at a clean GitHub repository, set your entry point, register any environment variables, and deploy. Add the hosted URL to Claude as a custom connector, and your server is now accessible from every Claude surface you use. With a proper git workflow in place, every future commit to main rebuilds the server without any further action required.

How to Learn AI

Build practical, career-focused skills in AI through hands-on training designed for beginners and professionals alike. Learn fundamental tools and workflows that prepare you for real-world projects or industry certification.