Several environments, one conversation
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:
{ "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.
Related patterns
Agents and MCP
Connect an agent in one line
Add the /mcp URL to any MCP client, sign in once in the browser, and the agent acts as you with your roles as they are now.
Agents and MCP
Scope times role
A key's scope decides read or write; the account's roles decide which tools and which records. Both must pass on every call.
Agents and MCP
Instance federation
One Long Tail calls another's tools over MCP with a service account the remote issues; neither side shares a database or a login.
