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); }

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