Skip to main content
Glama
Infisical

Infisical MCP Server

Official
by Infisical

create-environment

Set up new environments in Infisical by specifying project ID, name, and slug. This tool facilitates organized secret management within defined project structures.

Instructions

Create a new environment in Infisical

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesThe name of the environment to create (required)
positionNoThe position of the environment to create
projectIdYesThe ID of the project to create the environment in (required)
slugYesThe slug of the environment to create (required)

Implementation Reference

  • The main handler logic for the 'create-environment' tool. It validates input using Zod, calls the Infisical SDK to create the environment, and returns a success response with the created environment details.
    if (name === AvailableTools.CreateEnvironment) { const data = createEnvironmentSchema.zod.parse(args); const environment = await infisicalSdk.environments().create({ projectId: data.projectId, name: data.name, slug: data.slug, position: data.position }); return { content: [ { type: "text", text: `Environment created successfully: ${JSON.stringify(environment, null, 3)}` } ] }; }
  • Defines the Zod validation schema and the tool capability metadata (name, description, inputSchema) for the 'create-environment' tool.
    const createEnvironmentSchema = { zod: z.object({ projectId: z.string(), name: z.string(), slug: z.string(), position: z.number().optional() }), capability: { name: AvailableTools.CreateEnvironment, description: "Create a new environment in Infisical", inputSchema: { type: "object", properties: { projectId: { type: "string", description: "The ID of the project to create the environment in (required)" }, name: { type: "string", description: "The name of the environment to create (required)" }, slug: { type: "string", description: "The slug of the environment to create (required)" }, position: { type: "number", description: "The position of the environment to create" } }, required: ["projectId", "name", "slug"] } } };
  • src/index.ts:452-467 (registration)
    Registers all tool capabilities, including 'create-environment', in the ListToolsRequestHandler, making the tool discoverable.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: [ createSecretSchema.capability, deleteSecretSchema.capability, updateSecretSchema.capability, listSecretsSchema.capability, getSecretSchema.capability, createProjectSchema.capability, createEnvironmentSchema.capability, createFolderSchema.capability, inviteMembersToProjectSchema.capability, listProjectsSchema.capability ] }; });
  • src/index.ts:64-64 (registration)
    Defines the string constant for the tool name in the AvailableTools enum, used in schema and handler.
    CreateEnvironment = "create-environment",

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Infisical/infisical-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server