MCP Setup for AI Agents

NoLag provides a Model Context Protocol (MCP) server that lets AI agents manage your real-time infrastructure directly. Connect Claude Desktop, Cursor, or any MCP-compatible client to create apps, rooms, actors, publish messages, and dispatch tasks - all through natural language.

Prerequisites: You need a NoLag account with a project-level API key. Create one in the Portal under Settings → API Keys.

Quick Start

  1. Create a project in the NoLag Portal
  2. Generate a project-level API key (format: nl_live_yourKeyId.yourSecret)
  3. Add the NoLag MCP server to your AI client's configuration (see below)
  4. Ask your AI agent to "list my NoLag apps" or "create an agent actor" to verify

Claude Desktop

Add this to your Claude Desktop configuration file (~/Library/Application Support/Claude/claude_desktop_config.json on macOS, %APPDATA%\Claude\claude_desktop_config.json on Windows):

{
  "mcpServers": {
    "nolag": {
      "url": "https://api.nolag.app/mcp/sse",
      "headers": {
        "Authorization": "Bearer nl_live_yourKeyId.yourSecret"
      }
    }
  }
}

Replace nl_live_yourKeyId.yourSecret with your actual API key.

Cursor

Add this to your Cursor MCP configuration:

{
  "mcpServers": {
    "nolag": {
      "url": "https://api.nolag.app/mcp/sse",
      "headers": {
        "Authorization": "Bearer nl_live_yourKeyId.yourSecret"
      }
    }
  }
}

Custom MCP Clients (HTTP)

NoLag supports both SSE transport (GET /mcp/sse) and plain HTTP (POST /mcp) for MCP. Use SSE for streaming clients; use HTTP for simple request/response integrations.

# Initialize session
curl -X POST https://api.nolag.app/mcp \
  -H "Authorization: Bearer nl_live_yourKeyId.yourSecret" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": "1",
    "method": "initialize",
    "params": {}
  }'

# List available tools
curl -X POST https://api.nolag.app/mcp \
  -H "Authorization: Bearer nl_live_yourKeyId.yourSecret" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": "2",
    "method": "tools/list",
    "params": {}
  }'

# Create an agent actor
curl -X POST https://api.nolag.app/mcp \
  -H "Authorization: Bearer nl_live_yourKeyId.yourSecret" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": "3",
    "method": "tools/call",
    "params": {
      "name": "nolag_create_agent",
      "arguments": {
        "name": "my-first-agent",
        "capabilities": ["drafting", "research"]
      }
    }
  }'

Transports

TransportEndpointUse Case
SSE (recommended)GET /mcp/sseClaude Desktop, Cursor, streaming MCP clients
HTTPPOST /mcpSimple integrations, scripts, testing

Available Tools

The NoLag MCP server exposes 28 tools for managing your real-time infrastructure:

App Management

ToolDescription
nolag_list_appsList all apps in your project
nolag_create_appCreate a new app (optionally from a blueprint)
nolag_get_appGet details about a specific app
nolag_update_appUpdate an app's name or description
nolag_delete_appSoft-delete an app

Room Management

ToolDescription
nolag_list_roomsList all rooms in an app
nolag_create_roomCreate a new dynamic room
nolag_get_roomGet room details
nolag_update_roomUpdate a room
nolag_delete_roomDelete a dynamic room

Actor Management

ToolDescription
nolag_list_actorsList all actors in your project
nolag_create_actorCreate a new actor (device, user, service, agent, etc.)
nolag_get_actorGet actor details
nolag_update_actorUpdate an actor
nolag_delete_actorDelete an actor

Agent-Specific

ToolDescription
nolag_create_agentCreate an AI agent actor with persistent sessions and capability tags
nolag_create_orchestratorCreate an orchestrator actor for coordinating agents
nolag_create_agents_appCreate an app from the Agents blueprint
nolag_dispatch_taskPublish a task envelope to a room's tasks topic
nolag_list_agent_eventsQuery the agent event stream with severity/category filters
nolag_get_blackboard_stateRead the current shared state for a room

Messaging

ToolDescription
nolag_publishPublish a message to a room/topic
nolag_get_messagesGet recent messages from a room/topic

Webhooks

ToolDescription
nolag_configure_webhooksConfigure hydration and trigger webhooks for an app
nolag_get_webhook_configGet current webhook configuration
nolag_list_webhook_dlqList failed webhook requests
nolag_retry_webhook_dlqRetry a failed webhook

Code Generation

ToolDescription
nolag_generate_codeGenerate SDK client code for a specific use case

Authentication

All MCP requests require a project-level API key in the Authorization header. Organization-level and system keys are not supported for MCP.

Authorization: Bearer nl_live_yourKeyId.yourSecret
Security: Your API key grants full project access. Never expose it in client-side code or public repositories.

Agent Workflow Example

Here's a typical workflow using MCP to set up a multi-agent system:

  1. Create an agents app: nolag_create_agents_app with name "my-workflow"
  2. Create an orchestrator: nolag_create_orchestrator with name "dispatcher"
  3. Create worker agents: nolag_create_agent with capabilities like "drafting", "research"
  4. Dispatch tasks: nolag_dispatch_task to send work to connected agents
  5. Monitor: nolag_list_agent_events to see what agents are doing
  6. Check state: nolag_get_blackboard_state to see shared agent state

Each agent connects using the @nolag/agents SDK with its access token (returned by the create tools above). The MCP service manages infrastructure; agents use the SDK for real-time coordination.