Model Context Protocol (MCP)

Opalstack provides a remote MCP endpoint that publishes common dashboard operations (apps, databases, DNS, SSL, users, sites, etc.) as typed tools. Use it from an MCP-capable client to automate deployments and day-to-day tasks. (opalstack.com)


MCP Endpoint

https://my.opalstack.com/mcp

Use your Opalstack API token (see below) as the bearer credential when configuring the client. (opalstack.com)

API Tokens

Create and manage tokens in the dashboard.

Create a token

  1. Click Tokens in the dashboard sidebar.
  2. Click Create API Token (top-right).
  3. Name the token and click Create Token.
  4. Copy the token value from the token list. (docs.opalstack.com)

Delete a token

  1. Click Tokens in the dashboard sidebar.
  2. Click the trashcan icon for the token.
  3. Confirm deletion in the prompt. (docs.opalstack.com)

API Reference

Use these to view request/response shapes behind the MCP tools. (docs.opalstack.com)

Clients

  1. Install the GitHub Copilot extension.
  2. Command Palette → MCP: Open User Configuration.
  3. Add an entry for Opalstack and replace ABC123 with your API token:

    {
      "servers": {
        "opalstack": {
          "url": "https://my.opalstack.com/mcp",
          "type": "https",
          "headers": { "Authorization": "Bearer ABC123" }
        }
      }
    }
    
  4. Switch Copilot to Agent mode and open the tool catalog. (opalstack.com)

Tip The blog post “Vibe deploy your next app” includes a one-click helper and screenshots for the configuration flow. (opalstack.com)

Quick Test

After configuring the server, try a simple read-only action (e.g., list applications or sites) from the client. The blog walkthrough shows example prompts and expected tool listings. (opalstack.com)

Build Your Own MCP Server (Django)

Use django-mcp-server to expose your app’s tools at /mcp.

Install

pip install django-mcp-server

Add to Django

# settings.py
INSTALLED_APPS = [
    # ...
    "mcp_server",
]
# urls.py
from django.urls import include, path

urlpatterns = [
    # ...
    path("", include("mcp_server.urls")),  # publishes /mcp
]

By default the MCP endpoint is served at /mcp. (GitHub)

Define tools

# myapp/mcp.py
from mcp_server import MCPToolset

class MyTools(MCPToolset):
    def ping(self, name: str = "world") -> dict:
        """Return a simple greeting."""
        return {"message": f"hello, {name}"}

Validate your manifest:

python manage.py mcp_inspect

See examples/mcpexample in the repository for a working project layout and additional patterns (including DRF integration and model query toolsets). (GitHub)

Note

The Opalstack blog post “MCP won’t let me be…” includes a forwarding pattern that simply wraps existing REST endpoints as MCP tools—useful when you already have a stable API surface. (opalstack.com)

Troubleshooting

  • 401/Forbidden: verify the header is present as Authorization: Bearer <token> in the MCP client config. (opalstack.com)
  • No tools listed: re-save the MCP configuration and confirm your token is valid and active. (opalstack.com)
  • Need raw shapes: check Swagger/ReDoc and compare the tool’s parameters to the underlying REST endpoint. (docs.opalstack.com)
  • API Guide — tokens, references, and cURL example. (docs.opalstack.com)
  • Blog: Vibe deploy your next app (MCP intro + VS Code config). (opalstack.com)
  • Blog: MCP won’t let me be… (Django server how-to + repo links). (opalstack.com)
  • django-mcp-server repository (README + examples). (GitHub)