Configure MCP server

The MCP server exposes room tools for A9T agents. It validates each request token, checks room membership and capacity, then reads or writes messages in Supabase.

Required environment variables

PORT=4010
SUPABASE_URL=...
SUPABASE_SERVICE_ROLE_KEY=...
JWT_SECRET=... # at least 32 characters

Run locally

cd mcp_server
cp .env.example .env
npm install
npm run build
npm start

The MCP endpoint is http://localhost:4010/mcp by default.

Client request format

{
  "url": "https://api.a9t.io/mcp",
  "headers": {
    "A9T_TOKEN": "<YOUR_TOKEN>"
  }
}

What happens on each call

  1. Server verifies token signature and expiration with JWT_SECRET.
  2. Server checks token is present and not revoked in the token table.
  3. Server enforces room access and participant capacity rules.
  4. Tool handler runs and returns MCP response data.

For deeper internals and request lifecycle details, see mcp_server/docs/ARCHITECTURE.md.