{
  "openapi": "3.1.0",
  "info": {
    "title": "Safeguard Security Platform API",
    "description": "Safeguard MCP Server API for OpenAI Integration\n\nThis API provides access to the Safeguard security platform's capabilities including:\n- Software Bill of Materials (SBOM) management\n- Vulnerability scanning and analysis\n- Project and dependency tracking\n- Security remediation recommendations\n- SCM integrations (GitHub, GitLab, Bitbucket, Azure DevOps)\n\nAll endpoints require authentication via API key in the Authorization header.",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "http://localhost:3100",
      "description": "Safeguard MCP Server"
    }
  ],
  "paths": {
    "/health": {
      "get": {
        "summary": "Health check endpoint",
        "description": "Check if the API is running",
        "operationId": "health_check",
        "tags": [
          "System"
        ],
        "responses": {
          "200": {
            "description": "API is healthy",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string",
                  "example": "OK"
                }
              }
            }
          }
        },
        "security": []
      }
    },
    "/api/tools/safeguard_add_integration": {
      "post": {
        "summary": "One-shot: create a configuration and select repositories/images in a single call. Use when all details are known; otherwise use the step-by-step tools.",
        "description": "One-shot: create a configuration and select repositories/images in a single call. Use when all details are known; otherwise use the step-by-step tools.",
        "operationId": "safeguard_add_integration",
        "tags": [
          "Integrations"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "description": {
                    "type": "string"
                  },
                  "type": {
                    "type": "string",
                    "enum": [
                      "SCM",
                      "CONTAINER_IMAGE",
                      "AI_MODEL"
                    ]
                  },
                  "provider": {
                    "type": "string"
                  },
                  "is_private": {
                    "type": "boolean"
                  },
                  "publicRepositoryUrls": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "region": {
                    "type": "string"
                  },
                  "registryId": {
                    "type": "string"
                  },
                  "namespace": {
                    "type": "string"
                  },
                  "server": {
                    "type": "string"
                  },
                  "userName": {
                    "type": "string"
                  },
                  "workspaceSlug": {
                    "type": "string"
                  },
                  "repositories": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "repositoryName": {
                          "type": "string"
                        },
                        "repositoryUrl": {
                          "type": "string"
                        },
                        "repositoryId": {
                          "type": "string"
                        },
                        "projectName": {
                          "type": "string"
                        },
                        "projectVersion": {
                          "type": "string"
                        },
                        "selectedBranch": {
                          "type": "string"
                        },
                        "useDefaultBranch": {
                          "type": "boolean"
                        }
                      },
                      "required": [
                        "repositoryName"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "scan_mode": {
                    "type": "string",
                    "enum": [
                      "fast",
                      "deep",
                      "progressive"
                    ]
                  },
                  "credential": {
                    "type": "string",
                    "description": "Inline secret (PAT / app password / user:token / accessKeyId:secretAccessKey:region)"
                  },
                  "credentialRef": {
                    "type": "string",
                    "description": "Vault reference to a stored secret (alternative to inline credential)"
                  },
                  "org_id": {
                    "type": "string",
                    "description": "Override active organization for this call"
                  },
                  "product_id": {
                    "type": "string",
                    "description": "Override active product for this call"
                  }
                },
                "required": [
                  "name",
                  "type",
                  "provider"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the operation succeeded"
                    },
                    "data": {
                      "type": "object",
                      "description": "Response data"
                    },
                    "message": {
                      "type": "string",
                      "description": "Human-readable response message"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - invalid parameters",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - invalid or missing API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "string",
                      "example": "Unauthorized"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/api/tools/safeguard_list_vulnerabilities": {
      "post": {
        "summary": "List vulnerabilities in your environment filtered by severity, ecosystem, CVSS score, or exploit status.",
        "description": "List vulnerabilities in your environment filtered by severity, ecosystem, CVSS score, or exploit status.",
        "operationId": "safeguard_list_vulnerabilities",
        "tags": [
          "Vulnerabilities"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "severity": {
                    "type": "string",
                    "enum": [
                      "critical",
                      "high",
                      "medium",
                      "low",
                      "all"
                    ],
                    "default": "all"
                  },
                  "ecosystem": {
                    "type": "string",
                    "enum": [
                      "npm",
                      "pypi",
                      "maven",
                      "go",
                      "cargo",
                      "rubygems",
                      "nuget",
                      "all"
                    ],
                    "default": "all"
                  },
                  "exploited_only": {
                    "type": "boolean",
                    "default": false,
                    "description": "Only return vulnerabilities with known active exploits (KEV)"
                  },
                  "cvss_min": {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 10,
                    "description": "Minimum CVSS score"
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 200,
                    "default": 50
                  },
                  "offset": {
                    "type": "integer",
                    "minimum": 0,
                    "default": 0
                  }
                },
                "required": []
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the operation succeeded"
                    },
                    "data": {
                      "type": "object",
                      "description": "Response data"
                    },
                    "message": {
                      "type": "string",
                      "description": "Human-readable response message"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - invalid parameters",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - invalid or missing API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "string",
                      "example": "Unauthorized"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/api/tools/safeguard_list_projects": {
      "post": {
        "summary": "List all projects with optional filtering by name, status, or other criteria.",
        "description": "List all projects with optional filtering by name, status, or other criteria.",
        "operationId": "safeguard_list_projects",
        "tags": [
          "Projects"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "Filter by project name"
                  },
                  "limit": {
                    "type": "number",
                    "default": 20,
                    "description": "Maximum number of projects to return"
                  },
                  "offset": {
                    "type": "number",
                    "default": 0,
                    "description": "Number of projects to skip"
                  }
                },
                "required": []
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the operation succeeded"
                    },
                    "data": {
                      "type": "object",
                      "description": "Response data"
                    },
                    "message": {
                      "type": "string",
                      "description": "Human-readable response message"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - invalid parameters",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - invalid or missing API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "string",
                      "example": "Unauthorized"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/api/tools/safeguard_list_findings": {
      "post": {
        "summary": "List security findings (vulnerability occurrences) in a specific SBOM or project.",
        "description": "List security findings (vulnerability occurrences) in a specific SBOM or project.",
        "operationId": "safeguard_list_findings",
        "tags": [
          "Query"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "sbom_id": {
                    "type": "string",
                    "description": "Filter findings by SBOM ID"
                  },
                  "project_id": {
                    "type": "string",
                    "description": "Filter findings by project ID"
                  },
                  "severity": {
                    "type": "string",
                    "enum": [
                      "critical",
                      "high",
                      "medium",
                      "low",
                      "all"
                    ],
                    "default": "all"
                  },
                  "status": {
                    "type": "string",
                    "enum": [
                      "open",
                      "suppressed",
                      "false_positive",
                      "fixed",
                      "all"
                    ],
                    "default": "open"
                  },
                  "limit": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 200,
                    "default": 50
                  },
                  "offset": {
                    "type": "integer",
                    "minimum": 0,
                    "default": 0
                  }
                },
                "required": []
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the operation succeeded"
                    },
                    "data": {
                      "type": "object",
                      "description": "Response data"
                    },
                    "message": {
                      "type": "string",
                      "description": "Human-readable response message"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - invalid parameters",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - invalid or missing API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "string",
                      "example": "Unauthorized"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    },
    "/api/tools/safeguard_scan_repository": {
      "post": {
        "summary": "Scan a git repository for vulnerabilities and generate an SBOM. Supports full dependency analysis, secret detection, and combined scans.",
        "description": "Scan a git repository for vulnerabilities and generate an SBOM. Supports full dependency analysis, secret detection, and combined scans.",
        "operationId": "safeguard_scan_repository",
        "tags": [
          "General"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "repository_url": {
                    "type": "string",
                    "format": "uri",
                    "description": "Git repository URL to scan (e.g. \"https://github.com/org/repo\")"
                  },
                  "branch": {
                    "type": "string",
                    "default": "main",
                    "description": "Branch to scan (default: main)"
                  },
                  "project_id": {
                    "type": "string",
                    "description": "Project ID to associate scan results with"
                  },
                  "scan_type": {
                    "type": "string",
                    "enum": [
                      "full",
                      "dependencies",
                      "secrets",
                      "all"
                    ],
                    "default": "dependencies",
                    "description": "Type of scan to perform: dependencies only, secrets, full analysis, or all"
                  }
                },
                "required": [
                  "repository_url"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "description": "Whether the operation succeeded"
                    },
                    "data": {
                      "type": "object",
                      "description": "Response data"
                    },
                    "message": {
                      "type": "string",
                      "description": "Human-readable response message"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad request - invalid parameters",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - invalid or missing API key",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "string",
                      "example": "Unauthorized"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean",
                      "example": false
                    },
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {},
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "Authorization"
      }
    }
  },
  "security": [
    {
      "ApiKeyAuth": []
    }
  ]
}