Skip to main content
Glama

审计前端工程

auditPackage

Audit direct and indirect dependencies in frontend projects to identify security vulnerabilities. Supports local projects and remote repositories, generating standardized Markdown reports for immediate use.

Instructions

审计前端工程的所有直接和间接依赖,得到安全审计结果。支持本地工程的审计,也支持远程仓库的审计。审计结果为标准格式的markdown字符串,不用修改,直接用于展示即可。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectRootYes本地工程的根路径,或者远程仓库的URL地址
savePathYes保存审计结果的路径,传递当前工程的根路径下的工程明audit.md,如果没有当前工程,则传递桌面路径下的audit.md(注意,桌面路径必须传入绝对路径)

Implementation Reference

  • MCP tool handler for 'auditPackage'. Invokes the core auditPackage function to perform the audit and returns a success message indicating the result has been saved.
    async ({ projectRoot, savePath }) => {
      await auditPackage(projectRoot, savePath);
      return {
        content: [
          {
            type: 'text',
            text: `审计完成,结果已保存到: ${savePath}`,
          },
        ],
      };
    }
  • Input schema definition using Zod for the 'auditPackage' tool, specifying projectRoot and savePath parameters.
    inputSchema: {
      projectRoot: z
        .string()
        .describe('本地工程的根路径,或者远程仓库的URL地址'),
      savePath: z
        .string()
        .describe(
          '保存审计结果的路径,传递当前工程的根路径下的工程明audit.md,如果没有当前工程,则传递桌面路径下的audit.md(注意,桌面路径必须传入绝对路径)'
        ),
    },
  • src/mcpServer.js:12-40 (registration)
    Registration of the 'auditPackage' MCP tool, including title, description, input schema, and handler function.
    server.registerTool(
      'auditPackage',
      {
        title: '审计前端工程',
        description:
          '审计前端工程的所有直接和间接依赖,得到安全审计结果。支持本地工程的审计,也支持远程仓库的审计。审计结果为标准格式的markdown字符串,不用修改,直接用于展示即可。',
        inputSchema: {
          projectRoot: z
            .string()
            .describe('本地工程的根路径,或者远程仓库的URL地址'),
          savePath: z
            .string()
            .describe(
              '保存审计结果的路径,传递当前工程的根路径下的工程明audit.md,如果没有当前工程,则传递桌面路径下的audit.md(注意,桌面路径必须传入绝对路径)'
            ),
        },
      },
      async ({ projectRoot, savePath }) => {
        await auditPackage(projectRoot, savePath);
        return {
          content: [
            {
              type: 'text',
              text: `审计完成,结果已保存到: ${savePath}`,
            },
          ],
        };
      }
    );
  • Core helper function 'auditPackage' that orchestrates the entire audit process: creates work directory, parses project, generates lockfile, audits, renders results, cleans up, and saves the markdown report.
    export async function auditPackage(projectRoot, savePath) {
      // 1. 创建工作目录
      const workDir = await createWorkDir();
      // 2. 解析项目,向工作目录添加pacakge.json
      const packageJson = await parseProject(projectRoot);
      // 3. 生成lock文件
      await generateLock(workDir, packageJson);
      // 4. 对工作目录进行审计
      const auditResult = await audit(workDir, packageJson);
      // 5. 渲染审计结果
      const renderedResult = await render(auditResult, packageJson);
      // 6. 删除工作目录
      await deleteWorkDir(workDir);
      // 7. 将结果保存到指定路径
      await fs.promises.writeFile(savePath, renderedResult);
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It discloses that the audit result is '标准格式的markdown字符串' (standard format markdown string) and should be used directly for display without modification, adding useful behavioral context. However, it doesn't cover other critical aspects like required permissions, rate limits, error handling, or whether the operation is read-only or mutative. The description adds some value but leaves significant gaps for a tool performing security audits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately concise with two sentences that efficiently cover purpose, scope, and output usage. It's front-loaded with the core function, and each sentence adds value without redundancy. A minor deduction for slightly awkward phrasing in the second sentence, but overall it's well-structured and waste-free.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (security auditing with 2 parameters) and no annotations or output schema, the description is moderately complete. It explains what the tool does, the types of inputs (local/remote), and output format, but lacks details on behavioral traits like safety, permissions, or error handling. Without an output schema, it should ideally describe return values more thoroughly, but the markdown format note provides some compensation. It's adequate but has clear gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with both parameters well-documented in the schema. The description doesn't add any parameter-specific information beyond what's in the schema (e.g., it doesn't explain 'projectRoot' or 'savePath' further). According to the rules, when schema coverage is high (>80%), the baseline is 3 even with no param info in the description, which applies here.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: '审计前端工程的所有直接和间接依赖,得到安全审计结果' (audits all direct and indirect dependencies of a frontend project to obtain security audit results). It specifies the verb ('审计' - audit) and resource ('前端工程' - frontend project) with scope ('所有直接和间接依赖' - all direct and indirect dependencies). However, with no sibling tools provided, it cannot demonstrate differentiation from alternatives, preventing a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context by stating '支持本地工程的审计,也支持远程仓库的审计' (supports auditing local projects and remote repositories), which suggests when to use it based on project location. However, it lacks explicit guidance on when not to use it or alternatives, and no prerequisites are mentioned. With no sibling tools, comparative guidance isn't applicable, but the implicit context is sufficient for a baseline score.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/Shen-zhihao/mcp-web-audit'

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