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:
Client registration - Your MCP client sends a
POSTto/mcp/registerwith its redirect URIs. The server returns aclient_id.Authorization - The client redirects you to
/mcp/authorizewith theclient_id,redirect_uri, and an optionalproviderparameter (discordorgoogle, defaults to Discord).OAuth login - You authenticate with Discord or Google through Supabase.
Callback - Supabase redirects back to
/mcp/callback, which issues an authorization code and redirects to your client’sredirect_uri.Token exchange - The client exchanges the authorization code for an access token via
POST /mcp/token.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
| Tool | Description |
|---|---|
list_friends | List all accepted friends |
list_friend_requests | List pending incoming and outgoing requests |
send_friend_request | Send a friend request by username |
accept_friend_request | Accept an incoming request |
decline_friend_request | Decline an incoming request |
remove_friend | Remove an existing friendship |
block_user | Block a user |
Direct Messages
| Tool | Description |
|---|---|
list_dm_conversations | List all DM conversations sorted by activity |
read_dm_messages | Read messages in a DM conversation (up to 100) |
send_dm_message | Send a message in a DM conversation |
Servers
| Tool | Description |
|---|---|
list_servers | List all servers you are a member of |
get_server_details | Get server info including rooms, members, and your role |
read_room_messages | Read messages in a server room (up to 100) |
send_room_message | Send a message to a server room |
Profile
| Tool | Description |
|---|---|
get_my_profile | Get your profile information |
update_my_profile | Update your display name |
Robots
| Tool | Description |
|---|---|
list_robots | List robots configured for a server |
get_robot_details | Get a specific robot’s configuration |
create_robot | Create a new robot (server owner only) |
update_robot | Update a robot’s configuration (server owner only) |
delete_robot | Delete a robot (server owner only) |
regenerate_robot_key | Regenerate a robot’s API key (server owner only) |
get_robot_logs | Get recent event delivery logs for a robot |
Documentation
| Tool | Description |
|---|---|
get_docs | Retrieve 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/andDELETE /mcp/return 405 (stateless mode)