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-scoped API key. Create one in the Portal: open your project and go to API Keys. The secret half is shown once.

Quick Start

  1. Create a project in the NoLag Portal
  2. Generate a project-scoped API key (format: nlg_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 / Claude Code

Add this to your configuration file (~/Library/Application Support/Claude/claude_desktop_config.json on macOS, %APPDATA%\Claude\claude_desktop_config.json on Windows for Claude Desktop, or .mcp.json in your project root for Claude Code):

{
  "mcpServers": {
    "nolag": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "https://api.nolag.app/mcp/sse?token=nlg_live_yourKeyId.yourSecret"
      ]
    }
  }
}

Replace nlg_live_yourKeyId.yourSecret with your actual API key.

Note. mcp-remote is a third-party npm package that bridges the SSE transport to stdio for clients that only speak stdio. npx installs it on first run.

Cursor

Add this to your Cursor MCP configuration (.cursor/mcp.json):

{
  "mcpServers": {
    "nolag": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "https://api.nolag.app/mcp/sse?token=nlg_live_yourKeyId.yourSecret"
      ]
    }
  }
}

Custom MCP Clients (HTTP)

NoLag supports both SSE transport (GET /mcp/sse, with tool calls posted to the /mcp/message URL the stream announces) and plain HTTP (POST /mcp) for MCP. Use SSE for streaming clients; use HTTP for simple request/response integrations.

The handshake and the tool catalog are public. Only tools/call needs your key.

# Initialize session (no key needed)
curl -X POST https://api.nolag.app/mcp \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": "1",
    "method": "initialize",
    "params": {}
  }'

# List available tools (no key needed)
curl -X POST https://api.nolag.app/mcp \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": "2",
    "method": "tools/list",
    "params": {}
  }'

# Create an agent actor (key required)
curl -X POST https://api.nolag.app/mcp \
  -H "Authorization: Bearer nlg_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

TransportEndpointAuthUse Case
SSE via mcp-remote (recommended)GET /mcp/sse, then POST /mcp/message?sessionId=...?token= query parameter or Authorization headerClaude Desktop, Claude Code, Cursor, and other MCP clients
HTTPPOST /mcpAuthorization headerSimple integrations, scripts, testing

Available Tools

The NoLag MCP server exposes 35 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 (static rooms cannot be deleted)

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 a persistent session 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

Scopes

ToolDescription
nolag_create_scopeCreate an access scope for tenant isolation
nolag_list_scopesList all access scopes in the project
nolag_get_scopeGet details about a specific access scope
nolag_update_scopeUpdate a scope's name, description, metadata, or active flag (the slug cannot change)
nolag_delete_scopeDelete a scope (fails while actors are still assigned to it)
nolag_list_scope_actorsList the actors assigned to a scope
nolag_set_actor_scopeAssign an actor to a scope or unscope them

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

initialize, notifications/initialized, ping, and tools/list are served without a key, so any client or directory can introspect the server. tools/call requires a project-scoped API key. Organization-level and system keys are rejected. There are two ways to send the key:

Works on every endpoint.

Authorization: Bearer nlg_live_yourKeyId.yourSecret

Option 2: Query Parameter (SSE transport only)

GET /mcp/sse and POST /mcp/message also read the key from a ?token= query parameter, for clients such as mcp-remote that cannot set custom headers. POST /mcp does not; it reads the header only.

https://api.nolag.app/mcp/sse?token=nlg_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 is 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"; note the returned slug, which carries a random suffix
  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 once by the create tools above). The MCP service manages infrastructure; agents use the SDK for real-time coordination.