Skip to content

Profiles and multiple orgs

A profile is a named set of credentials and tokens. One organization needs only the default profile; consultants and platform teams working across several want one profile per organization, bound per project directory so the right one is used without a flag.

Create and authenticate

anc config init --profile org-a
anc config init --profile org-b

anc auth login --profile org-a
anc auth login --profile org-b

Use neutral local names such as org-a rather than a customer name. The profile identifier shows up in local files and can end up in a screenshot or a support thread.

Bind a directory to a profile

cd ~/projects/org-a-integrations
anc config use org-a

That writes .anypoint-connect.json containing { "profile": "org-a" }. Every command run in that directory or below now uses org-a with no flag. The file binds a machine-local profile name; it stores no credentials. Add it to .gitignore anyway, because a profile name can reveal customer labeling:

.anypoint-connect.json

Naming conventions

The same file can hold the organization's Exchange naming convention for application JARs. deploy_jar, publish_app_jar and anc deploy use it when no assetId / assetVersion is given:

{
    "profile": "org-a",
    "conventions": {
        "assetId": "{app}-{pomVersion}-{timestamp}",
        "assetVersion": "1.0.0"
    }
}
Token Value
{app} The application name
{artifactId} The JAR's Maven artifact ID
{pomVersion} The JAR's Maven version
{timestamp} UTC time as yyyyMMddHHmmss
{gitShort} The short commit hash of the project

assetVersion can be a fixed value or a template, and groupId sets the Exchange group. Each preview reports which rule chose each coordinate.

Without a convention, the coordinates come from the JAR. suggest_asset_name and the deploy preview still detect the pattern of the asset an app runs today, for example {app}-{pomVersion}-{timestamp} at 1.0.0, and show the conventions block to add. A detected pattern is never applied until it is written here.

Production approvals are not project settings

.anypoint-connect.json is part of the repository, so it cannot grant production access. Production pre-approvals and unmarked-artifact allowances live in ~/.anypoint-connect/production-approvals.json, bound to organization and environment IDs, and are written with set_production_preapproval and set_unmarked_artifact_allowance. A productionPreapproval left in a project file is ignored and reported by get_project_profile. See the safety model.

These entries belong to the organization and environment, not to a profile: switching between two profiles of the same organization keeps them in force, and a profile for another organization never matches them.

set_project_profile and anc config use update the nearest .anypoint-connect.json (walking up from the working directory) and keep its other fields, so a nested directory does not get a second file that shadows the first.

Managing configuration

anc config show                      # secrets masked
anc config show --profile org-a
anc config set defaultEnv Production
anc config set orgId <org-id>        # choose the organization (required for service authentication)
anc config set authMode client_credentials   # or bearer; see credentials.md
anc config profiles                  # list all profiles
anc config path                      # where files live

ANYPOINT_PROFILE=org-b anc apps list --env Sandbox   # one-off override

Resolution order

A profile is resolved first, then credentials within it.

Profile, highest priority first:

Priority Source Example
1 --profile on auth/config commands anc auth status --profile org-a
2 ANYPOINT_PROFILE export ANYPOINT_PROFILE=org-a
3 .anypoint-connect.json in the project, walking up from the working directory { "profile": "org-a" }
4 Fallback default

Operational commands do not expose a --profile option. For a one-off operational override, set ANYPOINT_PROFILE for that process; for day-to-day work, bind the project directory with anc config use <profile>.

Credentials within that profile, highest priority first:

Priority Source When it applies
1 Environment variables CI, containers, per-session overrides
2 Profile config.json Day-to-day development
3 .env in the working directory Legacy project-local fallback

The most common surprise is an environment variable left exported in a shell, silently overriding the profile you thought you selected. anc config show reports the active profile and how it was resolved, and env | grep ANYPOINT_ shows any credential override, so check both first when a command hits the wrong organization.

Storage layout

~/.anypoint-connect/
└── profiles/
    ├── default/
    │   ├── config.json     OAuth credentials (chmod 600)
    │   └── tokens.enc      AES-256-GCM encrypted tokens
    └── org-a/
        ├── config.json
        └── tokens.enc

Profiles and MCP

The MCP server resolves the active profile the same way, from .anypoint-connect.json in the project or default, so no env block is needed in host configuration. Two tools expose this to an agent: get_project_profile reports the active profile and where it came from, and set_project_profile binds a directory.

An agent should not switch profiles on its own initiative — it changes which organization subsequent calls hit. Treat it as an operation you authorize explicitly, and do not have an agent report the organization name in a document meant to be shared.