Skip to main content
Glama

sbom

Generate a Software Bill of Materials (SBOM) for npm projects to document dependencies and security components.

Instructions

Generate a Software Bill of Materials (SBOM) for a project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesAbsolute path to the package directory
formatNoSBOM format (default: cyclonedx)
productionNoOnly include production dependencies

Implementation Reference

  • Implementation of the "sbom" MCP tool, which generates a Software Bill of Materials using the `npm sbom` command.
    server.tool(
      "sbom",
      "Generate a Software Bill of Materials (SBOM) for a project",
      {
        path: z.string().describe("Absolute path to the package directory"),
        format: z
          .enum(["cyclonedx", "spdx"])
          .optional()
          .describe("SBOM format (default: cyclonedx)"),
        production: z.boolean().optional().describe("Only include production dependencies"),
      },
      async ({ path, format, production }) => {
        const args = ["sbom"];
        if (format) args.push(`--sbom-format=${format}`);
        if (production) args.push("--omit=dev");
        try {
          const { stdout } = await run(args, path);
          return { content: [{ type: "text", text: stdout }] };
        } catch (e: any) {
          return {
            content: [{ type: "text", text: `Error: ${e.stderr || e.message}` }],
            isError: true,
          };
        }
      },
    );

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/mikusnuz/npm-mcp'

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