Your Astro API Route Can Be an MCP Server
Most MCP tutorials assume a standalone process. Here's how to expose one as just another Astro API route using Streamable HTTP — same auth, same deploy pipeline, no second app to maintain.
Read moreDokku is a handy PaaS service you can run on servers. I have it running on a couple Digital Ocean servers and it works nicely.
I also use Directus a lot as a Headless CMS and overall database management, so being able to quickly install is very handy.
Here's a little recipe I use to set it up. First, we want to create the app and set up everything we need:
dokku apps:create directus
dokku domains:add directus YOURDOMAIN
dokku postgres:create directus
dokku postgres:link directus directus
dokku storage:list directus
dokku storage:ensure-directory directus
dokku storage:mount directus /[SOME-FOLDER-ON-MACHINE]/data:/app/data
dokku ps:restart directus
dokku config:set --no-restart directus KEY=$(openssl rand -hex 32)
dokku config:set --no-restart directus SECRET=$(openssl rand -hex 32)
dokku config:set --no-restart directus ADMIN_EMAIL=[[email protected]]
dokku config:set --no-restart directus ADMIN_PASSWORD=[YOUR-ADMIN-PASSWORD]
dokku config:set --no-restart directus PUBLIC_URL=[YOUR-DOMAIN]
dokku config:set --no-restart directus STORAGE_LOCATIONS="local"
dokku config:set --no-restart directus STORAGE_LOCAL_DRIVER="local"
dokku config:set --no-restart directus STORAGE_LOCAL_ROOT="/app/data/uploads"
dokku config:set --no-restart directus DB_CLIENT=pg
dokku config:set --no-restart directus DB_CONNECTION_STRING="<info from above command>"
dokku ports:set directus http:80:8055
This creates the app, and the database, and configures the app to use the env vars specified.
Next, we want to pull the Directus docker image and deploy it:
docker pull directus/directus
dokku git:from-image directus directus/directus
Last step is to set up our SSL certs:
dokku config:set --no-restart directus
dokku letsencrypt:set directus email YOU@YOURDOMAIN
dokku letsencrypt:enable directus
That's it, you now have an Directus instance running, and you can add other instances quickly by making new apps.
To update, you can replace latest with any tag you want:
docker pull directus/directus:latest && dokku git:from-image directus directus/directus:latest
Most MCP tutorials assume a standalone process. Here's how to expose one as just another Astro API route using Streamable HTTP — same auth, same deploy pipeline, no second app to maintain.
Read moreExtending the Datastar chat widget with the browser's native SpeechRecognition API — no new backend, no transcription service, just one more way to fill the same signal.
Read moreTake the Astro + Datastar + Vercel AI SDK stack from this series and run it entirely on your own machine with Ollama — no API key, no per-token cost, no data leaving your laptop. It's a one-import change.
Read more