Search the documentation
41 pages for process.env.
Titles and paths first, then pages whose text carries it. Each row opens that page as this site last read it.
strict-tool-use
Claude Developer Platform · in the page
agents-and-tools/tool-use/strict-tool-use
…```typescript TypeScript const client = new Anthropic({ apiKey: process.env.ANTHROPIC_API_KEY }); const response = await client.messages.create({ model: "claude-opus-5-5", max_token…
claude-in-microsoft-foundry
Claude Developer Platform · in the page
build-with-claude/claude-in-microsoft-foundry
…ai/foundry-sdk"; const client = new AnthropicFoundry({ apiKey: process.env.ANTHROPIC_FOUNDRY_API_KEY, resource: "example-resource" // your resource name }); const message = await clien…
context-editing
Claude Developer Platform · in the page
build-with-claude/context-editing
…typescript TypeScript const anthropic = new Anthropic({ apiKey: process.env.ANTHROPIC_API_KEY }); const response = await anthropic.beta.messages.create({ model: "claude-opus-5-5", m…
mid-conversation-effort-example
Claude Developer Platform · in the page
build-with-claude/mid-conversation-effort-example
…= 8000; const MAX_CONCURRENT = 10; const DOC_TEST_MODE = Boolean(process.env.DOC_TEST_MODE); const MAX_TOTAL_SUBTASKS = DOC_TEST_MODE ? 2 : 200; const MAX_SUBAGENT_TURNS = DOC_TEST_MODE ? 1 :…
openai-sdk
Claude Developer Platform · in the page
cli-sdks-libraries/libraries/openai-sdk
…port OpenAI from "openai"; const openai = new OpenAI({ apiKey: process.env.ANTHROPIC_API_KEY, // Your Claude API key baseURL: "https://api.anthropic.com/v1/" // Claude API endpoint });…
typescript
Claude Developer Platform · in the page
cli-sdks-libraries/sdks/typescript
…t). ## Usage ```typescript const client = new Anthropic({ apiKey: process.env["ANTHROPIC_API_KEY"] // This is the default and can be omitted }); const message = await client.messages.create({ m…
aws
Claude Developer Platform · in the page
manage-claude/wif-providers/aws
…dentityTokenProvider: getStsWebIdentityToken, federationRuleId: process.env.ANTHROPIC_FEDERATION_RULE_ID!, organizationId: process.env.ANTHROPIC_ORGANIZATION_ID!, serviceAccountId: p…
Create the app registration that represents the Claude API audience.
Claude Developer Platform · in the page
manage-claude/wif-providers/azure
…append &client_id=<IDENTITY_CLIENT_ID>. const identityEndpoint = process.env.IDENTITY_ENDPOINT; const url = identityEndpoint ? `${identityEndpoint}?api-version=2019-08-01&resource=${AUD…
gcp
Claude Developer Platform · in the page
manage-claude/wif-providers/gcp
…ntityTokenProvider: fetchGoogleIdentityToken, federationRuleId: process.env.ANTHROPIC_FEDERATION_RULE_ID!, organizationId: process.env.ANTHROPIC_ORGANIZATION_ID!, serviceAccountId: p…
okta
Claude Developer Platform · in the page
manage-claude/wif-providers/okta
…tchOktaToken(): Promise<string> { const response = await fetch(`${process.env.OKTA_ISSUER}/v1/token`, { method: "POST", headers: { "content-type": "application/x-www-form-urlencoded" }…
spawn.sh: called once per claimed work item
Claude Developer Platform · in the page
managed-agents/self-hosted-sandboxes
…-ai/sdk/helpers/beta/environments"; const environmentKey = process.env.ANTHROPIC_ENVIRONMENT_KEY!; const environmentId = process.env.ANTHROPIC_ENVIRONMENT_ID!; const cli…
Configure your agent
Claude Code CLI · in the page
agent-sdk/configuration
…, and your values override the inherited ones In TypeScript, spread `process.env` into `env` to keep inherited variables such as `PATH`, `HOME`, and `ANTHROPIC_API_KEY`. When you leave `env` unset, t…
Track cost and usage
Claude Code CLI · in the page
agent-sdk/cost-tracking
…hropic-ai/claude-agent-sdk"; const options = { env: { ...process.env, CLAUDE_CODE_USE_BEDROCK: "1", ENABLE_PROMPT_CACHING_1H: "1", }, }; for await (const message of q…
Hosting the Agent SDK
Claude Code CLI · in the page
agent-sdk/hosting
…rt { query } from "@anthropic-ai/claude-agent-sdk"; const prompt = process.env.TASK_PROMPT!; for await (const message of query({ prompt, options: { maxTurns: 20 } })) { console.log(message);…
Connect to external tools with MCP
Claude Code CLI · in the page
agent-sdk/mcp
…m/mcp/sse", headers: { Authorization: `Bearer ${process.env.API_TOKEN}` } } }, allowedTools: ["mcp__remote-api__*"] } }; ``` ```python Py…
Observability with OpenTelemetry
Claude Code CLI · in the page
agent-sdk/observability
…pt, `env` replaces the inherited environment entirely, so include `...process.env` in the object you pass. The CLI exports three independent OpenTelemetry signals. Each has its own enable switch and…
Persist sessions to external storage
Claude Code CLI · in the page
agent-sdk/session-storage
…s its local copy, so it needs no such setting. In TypeScript, spread `process.env` into `env` as well, since the [`env` option](/docs/en/agent-sdk/typescript#options) replaces the subprocess environme…
Subagents in the SDK
Claude Code CLI · in the page
agent-sdk/subagents
…ypeScript SDK replaces the subprocess environment with it, so spread `process.env` into it to keep variables like `PATH`, while the Python SDK merges it into the inherited environment. This example tu…
Track todos
Claude Code CLI · in the page
agent-sdk/todo-tracking
…TypeScript, `env` replaces the subprocess environment, so spread `...process.env` to keep inherited variables. In Python, `env` is merged on top of the inherited environment ## Todo lifecycle Claud…
Scale to many tools with tool search
Claude Code CLI · in the page
agent-sdk/tool-search
…TypeScript, `env` replaces the subprocess environment, so spread `...process.env` to keep inherited variables. In Python, `env` is merged on top of the inherited environment. This example connects to…
Agent SDK reference - TypeScript
Claude Code CLI · in the page
agent-sdk/typescript
…| `process.env` | Environment variables. When set, this replaces the subprocess environment instead of…
Claude Code on Claude Platform on AWS
Claude Code CLI · in the page
claude-platform-on-aws
…theme={null} import { query } from "@anthropic-ai/claude-agent-sdk"; process.env.CLAUDE_CODE_USE_ANTHROPIC_AWS = "1"; process.env.ANTHROPIC_AWS_WORKSPACE_ID = "wrkspc_01ABCDEFGHIJKLMN"; process.env.A…
Hooks reference
Claude Code CLI · in the page
hooks
…nd `CLAUDE_PLUGIN_DATA` on the spawned process, so a script can read `process.env.CLAUDE_PLUGIN_ROOT` regardless of how it was launched. Plugin hooks additionally substitute [`${user_config.*}`](/doc…
Connect Claude Code to an LLM gateway
Claude Code CLI · in the page
llm-gateway-connect
…but setting `options.env` replaces the environment entirely. Spread `process.env` into it to keep your gateway variables. * Python: `ClaudeAgentOptions(env=...)` merges on top of the inherited enviro…
Connect Claude Code to tools via MCP
Claude Code CLI · in the page
mcp
…_DIR` variable. Read it from inside your server process, for example `process.env.CLAUDE_PROJECT_DIR` in Node or `os.environ["CLAUDE_PROJECT_DIR"]` in Python. `CLAUDE_PROJECT_DIR` is the stable proje…
Recommend your plugin from your CLI
Claude Code CLI · in the page
plugin-hints
…marketplace: <CodeGroup> ```javascript Node.js theme={null} if (process.env.CLAUDECODE) { process.stderr.write( '<claude-code-hint v="1" type="plugin" value="example-cli@claude-plugins…
Deploy with a bootstrap server
Claude Documentation · in the page
third-party/claude-desktop/bootstrap
…import { createRemoteJWKSet, jwtVerify } from "jose"; const TENANT = process.env.ENTRA_TENANT; const CLIENT_ID = process.env.CLIENT_ID; const JWKS = createRemoteJWKSet( new URL(`https://login.micro…
Build an MCP client
Model Context Protocol · in the page
docs/2024-11-05/develop/build-client
…v from "dotenv"; dotenv.config(); const ANTHROPIC_API_KEY = process.env.ANTHROPIC_API_KEY; if (!ANTHROPIC_API_KEY) { throw new Error("ANTHROPIC_API_KEY is not set"); } cla…
Understanding Authorization in MCP
Model Context Protocol · in the page
docs/2024-11-05/tutorials/security/authorization
…tprotocol/sdk/shared/auth-utils.js"; const CONFIG = { host: process.env.HOST || "localhost", port: Number(process.env.PORT) || 3000, auth: { host: process.env.AUTH_HOST |…
Build an MCP client
Model Context Protocol · in the page
docs/2025-03-26/develop/build-client
…v from "dotenv"; dotenv.config(); const ANTHROPIC_API_KEY = process.env.ANTHROPIC_API_KEY; if (!ANTHROPIC_API_KEY) { throw new Error("ANTHROPIC_API_KEY is not set"); } cla…
Understanding Authorization in MCP
Model Context Protocol · in the page
docs/2025-03-26/tutorials/security/authorization
…tprotocol/sdk/shared/auth-utils.js"; const CONFIG = { host: process.env.HOST || "localhost", port: Number(process.env.PORT) || 3000, auth: { host: process.env.AUTH_HOST |…
Build an MCP client
Model Context Protocol · in the page
docs/2025-06-18/develop/build-client
…v from "dotenv"; dotenv.config(); const ANTHROPIC_API_KEY = process.env.ANTHROPIC_API_KEY; if (!ANTHROPIC_API_KEY) { throw new Error("ANTHROPIC_API_KEY is not set"); } cla…
Understanding Authorization in MCP
Model Context Protocol · in the page
docs/2025-06-18/tutorials/security/authorization
…tprotocol/sdk/shared/auth-utils.js"; const CONFIG = { host: process.env.HOST || "localhost", port: Number(process.env.PORT) || 3000, auth: { host: process.env.AUTH_HOST |…
Build an MCP client
Model Context Protocol · in the page
docs/2025-11-25/develop/build-client
…v from "dotenv"; dotenv.config(); const ANTHROPIC_API_KEY = process.env.ANTHROPIC_API_KEY; if (!ANTHROPIC_API_KEY) { throw new Error("ANTHROPIC_API_KEY is not set"); } cla…
Understanding Authorization in MCP
Model Context Protocol · in the page
docs/2025-11-25/tutorials/security/authorization
…tprotocol/sdk/shared/auth-utils.js"; const CONFIG = { host: process.env.HOST || "localhost", port: Number(process.env.PORT) || 3000, auth: { host: process.env.AUTH_HOST |…
Build an MCP client
Model Context Protocol · in the page
docs/2026-07-28/develop/build-client
…v from "dotenv"; dotenv.config(); const ANTHROPIC_API_KEY = process.env.ANTHROPIC_API_KEY; if (!ANTHROPIC_API_KEY) { throw new Error("ANTHROPIC_API_KEY is not set"); } cla…
Understanding Authorization in MCP
Model Context Protocol · in the page
docs/2026-07-28/tutorials/security/authorization
…tprotocol/sdk/shared/auth-utils.js"; const CONFIG = { host: process.env.HOST || "localhost", port: Number(process.env.PORT) || 3000, auth: { host: process.env.AUTH_HOST |…
Build an MCP client
Model Context Protocol · in the page
docs/draft/develop/build-client
…v from "dotenv"; dotenv.config(); const ANTHROPIC_API_KEY = process.env.ANTHROPIC_API_KEY; if (!ANTHROPIC_API_KEY) { throw new Error("ANTHROPIC_API_KEY is not set"); } cla…
Understanding Authorization in MCP
Model Context Protocol · in the page
docs/draft/tutorials/security/authorization
…tprotocol/sdk/shared/auth-utils.js"; const CONFIG = { host: process.env.HOST || "localhost", port: Number(process.env.PORT) || 3000, auth: { host: process.env.AUTH_HOST |…
Build an MCP App
Model Context Protocol · in the page
extensions/apps/build
…outDir: "dist", rollupOptions: { input: process.env.INPUT, }, }, }); ``` </Tab> </Tabs> </Step> <Step title="Build th…
OAuth Client Credentials
Model Context Protocol · in the page
extensions/auth/oauth-client-credentials
…JwtProvider({ clientId: "my-service", privateKey: process.env.CLIENT_PRIVATE_KEY_PEM, algorithm: "RS256", }); const client = new Client( { name…