# API keys & secrets glossary

Canonical page: /glossary

What API keys, environment variables, the macOS Keychain, and MCP mean, in plain language, for people using Claude Code. 38 terms.

## Claude Code & MCP

How Claude Code talks to tools and where a key actually goes.

- [ANTHROPIC_API_KEY](/glossary/anthropic-api-key) — ANTHROPIC_API_KEY is the environment variable Claude Code and the Claude API look for to authenticate your requests. You get the value from the Anthropic Console, and Claude Code reads it from your shell environment, a .env file, or a secrets manager, not from a config file you edit by hand.
- [MCP server](/glossary/mcp-server) — An MCP server is a program that exposes a set of tools, like list_secret_names or run_with_secrets, that Claude Code can call during a conversation. Claude Code starts it as a subprocess and talks to it over a fixed protocol, the Model Context Protocol, so any client that speaks MCP can use it.
- [MCP tool](/glossary/mcp-tool) — An MCP tool is a single named action that an MCP server offers, complete with a description and a schema for its inputs. When Claude Code decides a tool is relevant, it calls it with specific arguments and gets a result back, the same way it would call any other function.
- [stdio transport](/glossary/stdio-transport) — stdio transport is the most common way Claude Code talks to an MCP server: the server is launched as a local subprocess, and messages pass over its standard input and output streams instead of a network socket. There is no port to open and nothing to expose to the network.
- [claude mcp add](/glossary/claude-mcp-add) — claude mcp add is the Claude Code CLI command that registers a new MCP server, either for the current project or globally for your user account. After you run it, Claude Code will start that server automatically whenever it needs its tools.
- [.mcp.json](/glossary/mcp-json) — .mcp.json is a configuration file, usually at the root of a project, that lists which MCP servers Claude Code should start for that project, along with the command and any environment variables each one needs.
- [Subprocess](/glossary/subprocess) — A subprocess is a new, separate process that one program starts and controls, in this case a command that Claude Code or an MCP server runs on your behalf. A subprocess gets its own environment variables, which is what makes it possible to hand a command a secret without exposing that secret anywhere else.

## Keys & secrets

The credentials themselves: what they are, and how to handle them.

- [API key](/glossary/api-key) — An API key is a secret string a service issues you so that requests can be traced back to your account and billed or rate-limited accordingly. Anyone who has the key can act as you against that service, so it is treated as a credential, not a public value.
- [.env file](/glossary/env-file) — A .env file is a plain text file, usually named exactly .env, that stores key-value pairs like ANTHROPIC_API_KEY=sk-ant-... so a program can load them as environment variables when it starts. It is a convention, not a built-in feature of any operating system.
- [Environment variable](/glossary/environment-variable) — An environment variable is a named value that is available to a running program, set either by the shell that launched it, a config file, or another program that started it. Programs read environment variables instead of hardcoding values, so the same code can run with different settings or credentials.
- [Personal access token (PAT)](/glossary/personal-access-token) — A personal access token, or PAT, is a credential you generate from your account settings on a service like GitHub, scoped to specific permissions and given its own expiry, separate from your login password. It is designed to be used by tools and scripts acting on your behalf.
- [OAuth token](/glossary/oauth-token) — An OAuth token is a credential a service issues after you complete a login and consent flow, rather than one you generate and copy manually like an API key. OAuth tokens are usually short-lived and paired with a longer-lived refresh token that fetches new ones automatically.
- [Service account key](/glossary/service-account-key) — A service account key is a credential that authenticates an automated process or program, rather than a human user. Cloud platforms typically issue it as a downloadable JSON file containing a private key, which the program loads at startup to authenticate its API calls.
- [API key rotation](/glossary/api-key-rotation) — API key rotation is the practice of periodically replacing an active API key with a new one and revoking the old one, even when there is no known leak. It limits how much damage a key could do if it were compromised without your knowledge.
- [API key scope](/glossary/api-key-scope) — An API key's scope is the specific set of actions or resources it is allowed to touch, as opposed to a key with full account access. Many services let you create a key scoped to, for example, read-only access, or access to a single project rather than every project on the account.
- [Rate limit](/glossary/rate-limit) — A rate limit is a cap a service places on how many requests a given API key, account, or IP address can make within a time window, such as 50 requests per minute. Exceeding it usually returns an error rather than queuing the extra requests.
- [Webhook secret](/glossary/webhook-secret) — A webhook secret is a shared value a service gives you so your code can verify that an incoming webhook request genuinely came from that service, usually by checking a signature included in the request headers against the secret.
- [JWT (JSON Web Token)](/glossary/jwt) — A JWT, or JSON Web Token, is a compact string, made of three parts separated by dots, that carries a set of claims, such as a user ID or an expiry time, along with a signature proving it was issued by a trusted party. Services use it to pass identity or permission information without a database lookup on every request.
- [dotenv](/glossary/dotenv) — dotenv refers both to the .env file convention itself and to the small libraries, such as python-dotenv or the Node.js dotenv package, that read a .env file and load its contents into a program's environment variables at startup.
- [Revoking an API key](/glossary/revoke-api-key) — Revoking an API key permanently disables it from the provider's side, usually from the same console page where the key was created. It is the correct response to a suspected leak, since changing where the key is stored does nothing if the value itself is already exposed.

## macOS Keychain & security

What protects a key once it is on your Mac.

- [macOS Keychain](/glossary/macos-keychain) — The macOS Keychain is the encrypted credential store built into every Mac, used by Safari, Mail, and countless apps to hold passwords, certificates, and keys. It is protected by your login password and, on Apple silicon Macs, backed by the Secure Enclave.
- [Keychain Access](/glossary/keychain-access) — Keychain Access is the graphical app, included with every Mac in the Utilities folder, for browsing, adding, and removing items stored in the macOS Keychain. It shows passwords, certificates, keys, and notes, and lets you reveal a stored password after you authenticate.
- [security command](/glossary/security-command) — security is the built-in macOS command-line tool for interacting with the Keychain: adding items, finding a stored password, and deleting entries, all from a terminal or a script rather than the Keychain Access app's interface.
- [Secure Enclave](/glossary/secure-enclave) — The Secure Enclave is a dedicated, isolated coprocessor built into Apple silicon and recent Intel Macs with a T2 chip, used to handle the most sensitive cryptographic operations, such as Touch ID matching, independently of the main processor and operating system.
- [Touch ID authentication](/glossary/touch-id) — Touch ID authentication, when used by an app rather than just for unlocking your Mac, requires your fingerprint before that app can reveal a specific piece of protected data, such as a saved password or key. The match itself happens inside the Secure Enclave, not in the app's own code.
- [Code signing](/glossary/code-signing) — Code signing is the process of attaching a cryptographic signature to an app, tied to a developer's Apple Developer ID, so macOS can verify the app has not been altered since it was signed and can confirm who built it.
- [Notarization (macOS)](/glossary/notarization) — Notarization is a step where a developer submits an already code-signed app to Apple for an automated scan for known malware. Apple returns a ticket that macOS checks the first time you open the app, which is why non-App-Store apps can still open smoothly instead of being blocked outright.
- [App Sandbox](/glossary/app-sandbox) — The App Sandbox is a macOS security system that restricts what a running app can access by default, such as arbitrary files, other apps' processes, or network resources, unless the app explicitly declares and is granted specific entitlements for them.
- [Login keychain vs System keychain](/glossary/login-vs-system-keychain) — Your login keychain is unlocked automatically when you log into your Mac and holds personal items, such as Wi-Fi passwords and app credentials, tied to your user account specifically. The System keychain, by contrast, holds items available to every user on the Mac, such as some network certificates.
- [Keychain access group](/glossary/keychain-access-group) — A Keychain access group is a way for multiple apps signed by the same developer to share access to the same Keychain items without the user being prompted for permission every time each app runs, based on a shared identifier declared in each app's entitlements.
- [Entitlements (macOS)](/glossary/entitlements) — Entitlements are specific permissions a macOS app declares as part of its code signature, such as access to the Keychain, the network, or particular hardware. macOS checks these entitlements before granting the app the corresponding capability at runtime.

## Mistakes & leaks

The common ways a secret ends up somewhere it shouldn't.

- [Hardcoded secret](/glossary/hardcoded-secret) — A hardcoded secret is an API key, password, or token written directly into a program's source code, rather than loaded from an environment variable or a secrets manager at runtime. Anyone who can read the source, including through version control history, can read the secret.
- [Secret leaked in git history](/glossary/secret-in-git-history) — A secret leaked in git history means a key or password was committed at some point, and even though a later commit may delete or replace it, the original value remains readable in the repository's history unless that history is explicitly rewritten.
- [.gitignore](/glossary/gitignore) — A .gitignore file lists file and folder patterns that git should never track or commit, commonly including .env, credentials files, and build artifacts. It only affects files that are not already tracked, adding a pattern after a file was committed does not remove its history.
- [Secret scanning](/glossary/secret-scanning) — Secret scanning is an automated check, run by tools like GitHub's built-in scanner or standalone tools such as gitleaks, that searches a codebase and its commit history for patterns matching known secret formats, such as an API key prefix, and flags or blocks them.
- [Credential stuffing](/glossary/credential-stuffing) — Credential stuffing is an automated attack where leaked username-password pairs, or in some cases leaked API keys, from one breach are tried against many other services, on the assumption that people reuse the same credentials in more than one place.
- [Principle of least privilege](/glossary/least-privilege) — The principle of least privilege means giving any credential, whether a key, a token, or an account, only the specific access it needs to do its job, and nothing beyond that. It is one of the oldest ideas in security, and one of the most consistently useful.
- [Shell history leak](/glossary/shell-history-leak) — A shell history leak happens when a secret is typed directly as part of a terminal command, for example export ANTHROPIC_API_KEY=sk-ant-..., and your shell saves that entire line, value included, to a history file like .zsh_history, in plain text, indefinitely.
