Typescript sdkCredentials

Environment-aware Credentials

Copy page

Environment-aware credentials enable automatic loading of environment-specific credentials (development, production, etc.) while keeping them cleanly separated and easily switchable via the CLI's --env flag.

Credentials are referenced in the TypeScript SDK using the envSettings object. Creating environment-aware credentials is a two step process:

Step 1: Define environment configurations

Step 2: Use the credentials in tools

<your-project-name>/tools/stripe-tool.ts
import { mcpTool } from "@inkeep/agents-sdk";
import { envSettings } from "../environments";

export const stripeTool = mcpTool({
  id: 'stripe-tool',
  name: 'Stripe',
  serverUrl: 'https://mcp.stripe.com/mcp',
  credential: envSettings.getEnvironmentCredential('stripe_api_key'),
});

This pattern is useful if you want to keep track of different credentials for different environments. When you push your project using the Inkeep CLI inkeep push command with the --env flag, the credentials will be loaded from the appropriate environment file. For example, if you run inkeep push --env development, the credentials will be loaded from the environments/development.env.ts file.