Skip to content

Several environments, one conversation

Agents and MCPMCP.mcp.jsonmcp:readapp_id

List local, staging and production as separate MCP servers and name the environment in the prompt; tool names never collide.

The situation

An engineer chasing a stuck order wants to look at production, reproduce the case locally, and compare with staging, all in one conversation with the same agent.

The recipe

Add one server entry per environment, each with its own key held in the shell environment:

.mcp.json
{
"mcpServers": {
"longtail-local": { "type": "http", "url": "http://localhost:3000/mcp",
"headers": { "Authorization": "Bearer ${LONGTAIL_LOCAL_KEY}" } },
"longtail-staging": { "type": "http", "url": "https://staging.lt.acme.dev/mcp",
"headers": { "Authorization": "Bearer ${LONGTAIL_STAGING_KEY}" } },
"longtail-prod": { "type": "http", "url": "https://lt.acme.dev/mcp",
"headers": { "Authorization": "Bearer ${LONGTAIL_PROD_KEY}" } }
}
}

Each server keeps its tools under its own name, so you choose one by naming the environment: “on production, find orphaned signals from the last 48 hours,” then “reproduce it locally and diagnose.”

The guarantee

The server name picks the deployment; a tool’s app_id argument picks the workspace inside it. Every server you list is live at once, so give production a read key by default (mcp:read) and reach for a full key only when you mean to change something there. Each environment’s account and key stay separate, and every action is recorded as that environment’s account. See MCP.