MCP

Lag exposes a Model Context Protocol (MCP) server that lets AI assistants interact with your account - managing friends, reading and sending messages, browsing servers, and configuring robots.

Connecting

Claude Desktop

Add the following to your Claude Desktop MCP configuration:

{
  "mcpServers": {
    "lag": {
      "url": "https://api.trylag.com/mcp/",
      "transport": "streamable-http"
    }
  }
}

On first use, Claude Desktop will open your browser to authenticate via Discord or Google OAuth. Once authenticated, the connection persists across sessions.

Claude Code

Add the Lag MCP server from the command line:

claude mcp add lag --transport http https://api.trylag.com/mcp/

Other MCP Clients

Any MCP-compatible client can connect using the streamable HTTP transport. The server publishes OAuth metadata at:

GET https://api.trylag.com/mcp/.well-known/oauth-authorization-server

This returns the authorization, token, and registration endpoints needed for the OAuth flow. Clients that support MCP OAuth will handle this automatically.

Authentication Flow

The MCP server uses OAuth 2.0 with Supabase as the identity provider. The full flow:

  1. Client registration - Your MCP client sends a POST to /mcp/register with its redirect URIs. The server returns a client_id.

  2. Authorization - The client redirects you to /mcp/authorize with the client_id, redirect_uri, and an optional provider parameter (discord or google, defaults to Discord).

  3. OAuth login - You authenticate with Discord or Google through Supabase.

  4. Callback - Supabase redirects back to /mcp/callback, which issues an authorization code and redirects to your client’s redirect_uri.

  5. Token exchange - The client exchanges the authorization code for an access token via POST /mcp/token.

  6. Ready - The client includes the access token as a Bearer token on all subsequent POST /mcp/ requests.

Available Tools

Once connected, these tools are available to the AI assistant:

Friends

ToolDescription
list_friendsList all accepted friends
list_friend_requestsList pending incoming and outgoing requests
send_friend_requestSend a friend request by username
accept_friend_requestAccept an incoming request
decline_friend_requestDecline an incoming request
remove_friendRemove an existing friendship
block_userBlock a user

Direct Messages

ToolDescription
list_dm_conversationsList all DM conversations sorted by activity
read_dm_messagesRead messages in a DM conversation (up to 100)
send_dm_messageSend a message in a DM conversation

Servers

ToolDescription
list_serversList all servers you are a member of
get_server_detailsGet server info including rooms, members, and your role
read_room_messagesRead messages in a server room (up to 100)
send_room_messageSend a message to a server room

Profile

ToolDescription
get_my_profileGet your profile information
update_my_profileUpdate your display name

Robots

ToolDescription
list_robotsList robots configured for a server
get_robot_detailsGet a specific robot’s configuration
create_robotCreate a new robot (server owner only)
update_robotUpdate a robot’s configuration (server owner only)
delete_robotDelete a robot (server owner only)
regenerate_robot_keyRegenerate a robot’s API key (server owner only)
get_robot_logsGet recent event delivery logs for a robot

Documentation

ToolDescription
get_docsRetrieve Lag documentation. No params returns the table of contents. Specify section and page for specific content.

Protocol Details

  • Transport: Streamable HTTP (stateless) - each request is independent
  • Endpoint: POST https://api.trylag.com/mcp/
  • Auth: Authorization: Bearer <access-token> header on every request
  • Rate limit: 100 requests per minute per user
  • Methods not supported: GET /mcp/ and DELETE /mcp/ return 405 (stateless mode)