Claude Integration
Integrate NoLag MCP with Claude Desktop and Claude Code to manage real-time infrastructure through natural conversation.
NoLag MCP is a remote HTTP endpoint -- there is no npm package to install. You just need to configure your Claude client to connect to https://api.nolag.app/v1/mcp with your project API key.
Setup with Claude Desktop
Step 1: Get a Project API Key
In the NoLag Portal, go to your project settings and create an API key. Copy it -- you will need it for the next step.
Step 2: Configure Claude Desktop
Open your Claude Desktop configuration file and add the NoLag MCP server:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"nolag": {
"type": "streamable-http",
"url": "https://api.nolag.app/v1/mcp",
"headers": {
"Authorization": "Bearer YOUR_PROJECT_API_KEY"
}
}
}
}Replace YOUR_PROJECT_API_KEY with your actual API key (format: nl_live_...).
Step 3: Restart Claude Desktop
Restart Claude Desktop to load the new MCP server. You should see "nolag" listed in the available tools when you start a new conversation.
Setup with Claude Code (CLI)
For Claude Code CLI users, add the MCP server to your project or global settings:
{
"mcpServers": {
"nolag": {
"type": "streamable-http",
"url": "https://api.nolag.app/v1/mcp",
"headers": {
"Authorization": "Bearer YOUR_PROJECT_API_KEY"
}
}
}
}Example Conversations
Setting Up a Chat App
I want to build a chat application with NoLag. Set up an app with rooms for general chat and support.
I'll set up your chat app infrastructure. Let me start by creating the app and rooms.
Uses nolag_create_app, nolag_create_room (x2)
Done! I've created:
- App: "chat-app"
- Room: "general" (for general chat)
- Room: "support" (for support discussions)
Now let me create an actor token so your frontend can connect:
Uses nolag_create_actor
Here's your actor token: act_...
Save this token now -- it won't be shown again.
Generated Client Code
After setting up the infrastructure, you can ask Claude to generate connection code:
import { NoLag } from '@nolag/js-sdk'
// Connect using the actor token from nolag_create_actor
const client = NoLag(actorToken)
await client.connect()
// Join the room created via nolag_create_room
const room = client.room('general')
// Subscribe to messages
room.on('chat', (data, meta) => {
console.log(`[${meta.actorName}]: ${data.text}`)
})
// Send a message
room.emit('chat', { text: 'Hello from the SDK!' })Inspecting Messages
Show me the recent messages in my "general" room. Are people actually using it?
Uses nolag_list_apps, nolag_list_rooms, nolag_get_messages
I found your "general" room and pulled the last 10 messages. Here's what I see:
- 5 messages in the last hour
- 3 unique actors sending messages
- Most recent: "Hello world" from actor "web-client-1" (2 minutes ago)
Your room is active. Would you like me to check any specific topic?
Debugging Webhooks
My webhook doesn't seem to be firing. Can you check the configuration and see if there are any failures?
Uses nolag_get_webhook_config, nolag_list_webhook_dlq
I checked your webhook setup:
- Trigger webhook URL:
https://api.example.com/hooks/nolag - DLQ has 12 failed entries with status "dead"
- All failures show HTTP 401 -- your webhook endpoint is rejecting the requests
It looks like the authentication headers on your webhook receiver don't match. Would you like me to update the webhook configuration with new headers?
Best Practices
Be Specific
Give Claude detailed context about what you want to build:
Less Effective
"Set up NoLag for my app"
More Effective
"Create a NoLag app called 'game-lobby' with rooms for matchmaking and in-game chat. Create a 'device' actor for the game client."
Use the Right Tools for the Job
MCP tools are for infrastructure management, not real-time messaging. Use MCP to set up apps, rooms, and actors, then use the NoLag SDK in your application code for actual messaging.
Save Actor Tokens
When Claude creates an actor with nolag_create_actor, the access token is shown exactly once. Make sure to copy it immediately into your environment variables or secrets manager.
Limitations
- MCP cannot publish or subscribe to real-time messages -- use the SDK for that
- The
nolag_publishtool is listed but has no backend handler yet - API key must be a project-level key (not organization-level)
- Actor access tokens are only returned at creation time and cannot be retrieved later