Deploy AI agents

Deploy a Flask MCP server on DenkOps

An MCP server exposed over Server-Sent Events needs the connection to stay open for as long as the agent is attached, something a request/response serverless function actively works against. DenkOps runs your Flask app as one continuously-alive process, so an SSE stream to a connected agent doesn't get killed mid-session.

from flask import Flask, Response
import json, time

app = Flask(__name__)

@app.get("/mcp/sse")
def mcp_sse():
    def stream():
        yield f"event: endpoint\ndata: /mcp/messages\n\n"
        while True:
            yield f"event: ping\ndata: {json.dumps({'t': time.time()})}\n\n"
            time.sleep(15)
    return Response(stream(), mimetype="text/event-stream")

Deploy it: install the plugin, say "deploy on DenkOps", and get a live SSL URL.

Start on DenkOps →

FAQ

Can Flask host an MCP server over SSE on DenkOps?

Yes. The slot keeps the Flask process alive indefinitely, so the SSE generator can hold the connection open for the full length of an agent session.

Does my Flask MCP server need its own domain?

No extra setup required, every DenkOps deploy gets a live SSL-secured subdomain you register directly as the MCP server URL in your agent config.

← Deploy AI agents · API hosting