> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getprimo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Set the policy of an MCP Gateway connector

> Replace the policy of a connector (`connectorId` from `getMcpGatewayConnectors`) and return it. Read it first with `getMcpGatewayConnectorPolicy` and send its `version` as `expectedVersion` (null when none is stored): a 409 `GatewayConnectorPolicyVersionConflictError` means it changed since, read it again. `defaultSetting` is required, whole; `rules`, when given, replace every rule in the order given (50 at most, each name unique whatever its case), and left out keep the stored ones. To give a connector to some employees only, block `access` in `defaultSetting` and add a rule whose `filter` includes them, before any rule that would match them first. It never approves a tool: `setMcpGatewayConnectorToolStatuses` does. A 404 means the company has no such connector. The MCP Gateway serves employees, through their one Primo connection, the tools of the MCP servers (connectors) IT added. No credential is ever sent or returned here: a shared account is connected, and the address or authentication of a custom connector changed, in the cockpit, at `cockpitUrl`. A company without the MCP Gateway gets a 403 `McpGatewayNotEnabledError`; a 503 means Primo could not check it, try again in a minute.

Key: WriteScope: Company


## OpenAPI

````yaml https://api.getprimo.com/openapi.json put /mcp-gateway/connectors/{connectorId}/policy
openapi: 3.1.1
info:
  title: Public API - BETA
  description: Read docs on https://docs.getprimo.com/
  version: '1.0'
  contact: {}
servers:
  - url: https://api.getprimo.com
security:
  - apikey: []
tags: []
paths:
  /mcp-gateway/connectors/{connectorId}/policy:
    put:
      tags:
        - McpGateway
      summary: Set the policy of an MCP Gateway connector
      description: >-
        Replace the policy of a connector (`connectorId` from
        `getMcpGatewayConnectors`) and return it. Read it first with
        `getMcpGatewayConnectorPolicy` and send its `version` as
        `expectedVersion` (null when none is stored): a 409
        `GatewayConnectorPolicyVersionConflictError` means it changed since,
        read it again. `defaultSetting` is required, whole; `rules`, when given,
        replace every rule in the order given (50 at most, each name unique
        whatever its case), and left out keep the stored ones. To give a
        connector to some employees only, block `access` in `defaultSetting` and
        add a rule whose `filter` includes them, before any rule that would
        match them first. It never approves a tool:
        `setMcpGatewayConnectorToolStatuses` does. A 404 means the company has
        no such connector. The MCP Gateway serves employees, through their one
        Primo connection, the tools of the MCP servers (connectors) IT added. No
        credential is ever sent or returned here: a shared account is connected,
        and the address or authentication of a custom connector changed, in the
        cockpit, at `cockpitUrl`. A company without the MCP Gateway gets a 403
        `McpGatewayNotEnabledError`; a 503 means Primo could not check it, try
        again in a minute.
      operationId: setMcpGatewayConnectorPolicy
      parameters:
        - name: connectorId
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SetMcpGatewayConnectorPolicyBody'
      responses:
        default:
          description: ''
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/SetMcpGatewayConnectorPolicyResponse_Output
components:
  schemas:
    SetMcpGatewayConnectorPolicyBody:
      type: object
      properties:
        expectedVersion:
          description: >-
            The `version` read from `getMcpGatewayConnectorPolicy`, null when
            none is stored
          anyOf:
            - type: integer
              exclusiveMinimum: 0
              maximum: 9007199254740991
            - type: 'null'
        defaultSetting:
          description: Who may use the approved tools of the connector, by kind
          type: object
          properties:
            access:
              description: 'The connector itself: `blocked` serves none of its tools'
              type: string
              enum:
                - allowed
                - blocked
            readTools:
              type: string
              enum:
                - allowed
                - blocked
            writeTools:
              type: string
              enum:
                - allowed
                - blocked
            destructiveTools:
              description: null follows `writeTools`
              anyOf:
                - type: string
                  enum:
                    - allowed
                    - blocked
                - type: 'null'
          required:
            - access
            - readTools
            - writeTools
            - destructiveTools
        rules:
          description: >-
            Every rule, in order, replacing the stored ones; left out, the
            stored rules stay
          maxItems: 50
          type: array
          items:
            type: object
            properties:
              name:
                description: Unique in the policy, whatever its case
                type: string
                minLength: 1
                maxLength: 80
              filter:
                description: 'Who the rule applies to: every clause given must match'
                type: object
                properties:
                  teamIds:
                    description: Team ids, as `getEmployees` returns them
                    type: object
                    properties:
                      operationType:
                        type: string
                        enum:
                          - INCLUDE
                          - EXCLUDE
                      values:
                        minItems: 1
                        maxItems: 500
                        type: array
                        items:
                          type: string
                          pattern: ^[a-f\d]{24}$
                    required:
                      - operationType
                      - values
                  employeeIds:
                    description: Employee ids, as `getEmployees` returns them
                    type: object
                    properties:
                      operationType:
                        type: string
                        enum:
                          - INCLUDE
                          - EXCLUDE
                      values:
                        minItems: 1
                        maxItems: 500
                        type: array
                        items:
                          type: string
                          pattern: ^[a-f\d]{24}$
                    required:
                      - operationType
                      - values
              setting:
                description: Who may use the approved tools of the connector, by kind
                type: object
                properties:
                  access:
                    description: 'The connector itself: `blocked` serves none of its tools'
                    type: string
                    enum:
                      - allowed
                      - blocked
                  readTools:
                    type: string
                    enum:
                      - allowed
                      - blocked
                  writeTools:
                    type: string
                    enum:
                      - allowed
                      - blocked
                  destructiveTools:
                    description: null follows `writeTools`
                    anyOf:
                      - type: string
                        enum:
                          - allowed
                          - blocked
                      - type: 'null'
                required:
                  - access
                  - readTools
                  - writeTools
                  - destructiveTools
            required:
              - name
              - filter
              - setting
      required:
        - expectedVersion
        - defaultSetting
    SetMcpGatewayConnectorPolicyResponse_Output:
      type: object
      properties:
        source:
          type: string
          description: >-
            `credential_mode_default`: none is stored and the default of the
            credential mode applies
          enum:
            - stored
            - credential_mode_default
        version:
          description: What `setMcpGatewayConnectorPolicy` takes as `expectedVersion`
          anyOf:
            - type: integer
              minimum: -9007199254740991
              maximum: 9007199254740991
            - type: 'null'
        defaultSetting:
          type: object
          description: Who may use the approved tools of the connector, by kind
          properties:
            access:
              description: 'The connector itself: `blocked` serves none of its tools'
              type: string
              enum:
                - allowed
                - blocked
            readTools:
              type: string
              enum:
                - allowed
                - blocked
            writeTools:
              type: string
              enum:
                - allowed
                - blocked
            destructiveTools:
              description: null follows `writeTools`
              anyOf:
                - type: string
                  enum:
                    - allowed
                    - blocked
                - type: 'null'
          required:
            - access
            - readTools
            - writeTools
            - destructiveTools
          additionalProperties: false
        rules:
          type: array
          description: 'In order: the first whose filter matches an employee applies'
          items:
            type: object
            properties:
              name:
                description: Unique in the policy, whatever its case
                type: string
                minLength: 1
                maxLength: 80
              filter:
                description: 'Who the rule applies to: every clause given must match'
                type: object
                properties:
                  teamIds:
                    description: Team ids, as `getEmployees` returns them
                    type: object
                    properties:
                      operationType:
                        type: string
                        enum:
                          - INCLUDE
                          - EXCLUDE
                      values:
                        minItems: 1
                        maxItems: 500
                        type: array
                        items:
                          type: string
                          pattern: ^[a-f\d]{24}$
                    required:
                      - operationType
                      - values
                    additionalProperties: false
                  employeeIds:
                    description: Employee ids, as `getEmployees` returns them
                    type: object
                    properties:
                      operationType:
                        type: string
                        enum:
                          - INCLUDE
                          - EXCLUDE
                      values:
                        minItems: 1
                        maxItems: 500
                        type: array
                        items:
                          type: string
                          pattern: ^[a-f\d]{24}$
                    required:
                      - operationType
                      - values
                    additionalProperties: false
                additionalProperties: false
              setting:
                type: object
                description: Who may use the approved tools of the connector, by kind
                properties:
                  access:
                    description: 'The connector itself: `blocked` serves none of its tools'
                    type: string
                    enum:
                      - allowed
                      - blocked
                  readTools:
                    type: string
                    enum:
                      - allowed
                      - blocked
                  writeTools:
                    type: string
                    enum:
                      - allowed
                      - blocked
                  destructiveTools:
                    description: null follows `writeTools`
                    anyOf:
                      - type: string
                        enum:
                          - allowed
                          - blocked
                      - type: 'null'
                required:
                  - access
                  - readTools
                  - writeTools
                  - destructiveTools
                additionalProperties: false
            required:
              - name
              - filter
              - setting
            additionalProperties: false
        updatedAt:
          anyOf:
            - type: string
            - type: 'null'
      required:
        - source
        - version
        - defaultSetting
        - rules
        - updatedAt
      additionalProperties: false
  securitySchemes:
    apikey:
      scheme: bearer
      bearerFormat: API key
      type: http
      description: >-
        Use your Primo API key in the Authorization header as `Bearer
        <API_KEY>`.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.