© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•7d ago•
1 reply
Feitan

Self hosted mcp help

self-hostedSolved
Hello ! I tried to follow the docs here:
https://supabase.com/docs/guides/self-hosting/enable-mcp

But im getting this error, and i dont understand why:
{
    "message": "CSRF token mismatch."
}
{
    "message": "CSRF token mismatch."
}


$ curl http://localhost:8080/mcp   -X POST   -H "Content-Type: application/json"   -H "Accept: application/json, text/event-stream"   -H "MCP-Protocol-Version: 2025-06-18"   -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "initialize",
    "params": {
      "protocolVersion": "2025-06-18",
      "capabilities": {
        "elicitation": {}
      },
      "clientInfo": {
  }'} } "version": "1.0.0"ent",
{
    "message": "CSRF token mismatch."
}
$ curl http://localhost:8080/mcp   -X POST   -H "Content-Type: application/json"   -H "Accept: application/json, text/event-stream"   -H "MCP-Protocol-Version: 2025-06-18"   -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "initialize",
    "params": {
      "protocolVersion": "2025-06-18",
      "capabilities": {
        "elicitation": {}
      },
      "clientInfo": {
  }'} } "version": "1.0.0"ent",
{
    "message": "CSRF token mismatch."
}


Things i did:
1 - Added this section on kong.yml
  - name: mcp
    _comment: 'MCP: /mcp -> http://supabase-studio:3000/api/mcp (local access)'
    url: http://supabase-studio:3000/api/mcp
    routes:
      - name: mcp
        strip_path: true
        paths:
          - /mcp
    plugins:
      - name: cors
        config:
          origins:
            - "*"
          methods:
            - GET
            - POST
            - OPTIONS
          headers:
            - Accept
            - Accept-Version
            - Content-Length
            - Content-MD5
            - Content-Type
            - Date
            - X-Auth-Token
            - MCP-Protocol-Version
          exposed_headers:
            - X-Auth-Token
          credentials: true
          max_age: 3600
      - name: ip-restriction
        config:
          allow:
            - 127.0.0.1
            - ::1
            - 10.0.2.1
            - 172.18.0.1
          deny: []
  - name: mcp
    _comment: 'MCP: /mcp -> http://supabase-studio:3000/api/mcp (local access)'
    url: http://supabase-studio:3000/api/mcp
    routes:
      - name: mcp
        strip_path: true
        paths:
          - /mcp
    plugins:
      - name: cors
        config:
          origins:
            - "*"
          methods:
            - GET
            - POST
            - OPTIONS
          headers:
            - Accept
            - Accept-Version
            - Content-Length
            - Content-MD5
            - Content-Type
            - Date
            - X-Auth-Token
            - MCP-Protocol-Version
          exposed_headers:
            - X-Auth-Token
          credentials: true
          max_age: 3600
      - name: ip-restriction
        config:
          allow:
            - 127.0.0.1
            - ::1
            - 10.0.2.1
            - 172.18.0.1
          deny: []

2 - Enabled the ip-restriction plugin on the docker-compose on Kong because kong complained it was not enabled:
- 'KONG_PLUGINS=request-transformer,cors,key-auth,acl,basic-auth,ip-restriction'
- 'KONG_PLUGINS=request-transformer,cors,key-auth,acl,basic-auth,ip-restriction'

3 - Enabled tunnel:
ssh -L localhost:8080:localhost:8000 myuser@123.456.789
Enabling MCP Server Access | Supabase Docs
Configure secure access to the MCP server in your self-hosted Supabase instance.
Enabling MCP Server Access | Supabase Docs
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Supabase MCP server for self hosted version when?
SupabaseSSupabase / help-and-questions
4mo ago
self-hosted
SupabaseSSupabase / help-and-questions
8mo ago
Self hosted
SupabaseSSupabase / help-and-questions
3y ago
Help with Self hosted Supabase
SupabaseSSupabase / help-and-questions
3y ago