Skip to main content
Glama
lordbasilaiassistant-sudo

base-security-scanner-mcp

audit_report

Generate a comprehensive security audit report for Base mainnet tokens by analyzing contract code, honeypot risks, rug pull potential, bytecode, and permissions in one consolidated assessment.

Instructions

Generate a full security audit report for a token on Base mainnet. Combines contract scan, honeypot check, rug risk score, bytecode analysis, and permission checks into one comprehensive report.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
token_addressYesToken contract address on Base mainnet

Implementation Reference

  • The handler logic for the 'audit_report' tool, which performs a full security audit of a contract on Base mainnet.
    server.tool(
      "audit_report",
      "Generate a full security audit report for a token on Base mainnet. Combines contract scan, honeypot check, rug risk score, bytecode analysis, and permission checks into one comprehensive report.",
      {
        token_address: z.string().describe("Token contract address on Base mainnet"),
      },
      async ({ token_address }) => {
        try {
          const code = await getContractBytecode(token_address);
          if (code === "0x" || code.length <= 2) {
            return ok({
              token: token_address,
              isContract: false,
              report: "Address is not a contract. Cannot generate audit report.",
            });
          }
    
          // Run all checks in parallel
          const [
            contractInfo,
            tokenMeta,
            ownership,
            honeypot,
            rugResult,
            liquidity,
          ] = await Promise.all([
            getBasicContractInfo(token_address),
            getTokenMetadata(token_address),
            checkOwnership(token_address),
            simulateHoneypot(token_address),
            computeRugScore(token_address),
            findLiquidityPair(token_address),
          ]);
    
          const selectors = extractSelectors(code);
          const { findings, riskCounts } = analyzeSelectorRisks(selectors);
          const opcodes = analyzeOpcodes(code);
          const contractTypes = identifyContractType(selectors);
    
          // Permission summary
          const dangerousSelectors = findings.filter(f => f.risk === "critical" || f.risk === "high");
          const permissionSummary = dangerousSelectors.length === 0
            ? "No dangerous owner permissions detected"
            : `${dangerousSelectors.length} dangerous permission(s): ${dangerousSelectors.map(f => f.name).join(", ")}`;
    
          // Overall risk
          let overallRisk = "LOW";
          if (rugResult.score >= 70 || honeypot.isHoneypot) overallRisk = "CRITICAL";
          else if (rugResult.score >= 50) overallRisk = "HIGH";
          else if (rugResult.score >= 30) overallRisk = "MEDIUM";
    
          // Build recommendations
          const recommendations: string[] = [];
          if (ownership.hasOwner && !ownership.isRenounced) {
            recommendations.push("Request ownership renouncement or verify owner identity");
          }
          if (honeypot.isHoneypot) {
            recommendations.push("DO NOT BUY — honeypot detected");
          }
          if (riskCounts.critical > 0) {
            recommendations.push("Critical functions detected — review contract source code on Basescan");
          }
          if (opcodes.hasSelfDestruct) {
            recommendations.push("SELFDESTRUCT present — contract can be destroyed at any time");
          }
          if (opcodes.hasDelegatecall) {
            recommendations.push("DELEGATECALL present — verify proxy implementation is safe");
          }
          if (!liquidity.hasLiquidity) {
            recommendations.push("No liquidity found — cannot trade this token");
          }
          if (recommendations.length === 0) {
            recommendations.push("No major red flags found. Always DYOR and start with small positions.");
          }
    
          return ok(serializeBigInts({
            report: "BASE SECURITY SCANNER - AUDIT REPORT",
            token: token_address,
            timestamp: new Date().toISOString(),
            overallRisk,
            rugScore: rugResult.score,
            tokenMetadata: tokenMeta,
            contractInfo: {
              bytecodeSize: contractInfo.bytecodeSize,
              balanceETH: contractInfo.balanceETH,
              contractTypes,
              complexity: opcodes.estimatedComplexity,
            },
            ownership: {
              hasOwner: ownership.hasOwner,
              owner: ownership.owner,
              isRenounced: ownership.isRenounced,
            },
            honeypotAnalysis: {
              isHoneypot: honeypot.isHoneypot,
              canBuy: honeypot.canBuy,
              canSell: honeypot.canSell,
              estimatedBuyTax: honeypot.buyTax,
              estimatedSellTax: honeypot.sellTax,
              details: honeypot.details,
            },
            liquidity: {
              pairAddress: liquidity.pairAddress,
              hasLiquidity: liquidity.hasLiquidity,
              reserveWETH: liquidity.reserveWETH,
            },
            dangerousOpcodes: {
              delegatecall: opcodes.hasDelegatecall,
              selfdestruct: opcodes.hasSelfDestruct,
              create: opcodes.hasCreate,
              create2: opcodes.hasCreate2,
            },
            permissionSummary,
            riskCounts,
            rugFactors: rugResult.factors,
            recommendations,
            knownFunctions: findings,
          }) as Record<string, unknown>);
        } catch (err) {
          return fail(`audit_report failed: ${err instanceof Error ? err.message : String(err)}`);
        }
      }
    );
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. While it mentions the types of checks performed, it lacks critical details such as whether this is a read-only operation, potential rate limits, authentication requirements, execution time, or what the output format looks like. For a tool performing multiple security analyses, this is a significant gap in transparency.

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

Conciseness5/5

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

The description is extremely concise and front-loaded, consisting of just two sentences that efficiently convey the tool's purpose and scope. Every word earns its place, with no redundant or unnecessary information.

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 (performing multiple security analyses) and the absence of both annotations and an output schema, the description is incomplete. It adequately explains what the tool does but fails to address behavioral aspects like safety, performance, or output format, which are crucial for a comprehensive audit tool.

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?

The schema description coverage is 100%, with the single parameter 'token_address' well-documented in the schema. The description doesn't add any meaningful parameter semantics beyond what's already in the schema (e.g., it doesn't clarify address format or validation rules), so it meets the baseline for high schema coverage.

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

Purpose5/5

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

The description clearly states the specific action ('Generate a full security audit report') and resource ('for a token on Base mainnet'), with explicit details on what the report includes ('contract scan, honeypot check, rug risk score, bytecode analysis, and permission checks'). It effectively distinguishes this comprehensive tool from its more specialized siblings like 'analyze_bytecode' or 'check_honeypot'.

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

Usage Guidelines4/5

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

The description provides clear context for when to use this tool ('for a token on Base mainnet') and implies it's for comprehensive security auditing. However, it doesn't explicitly state when not to use it or name alternatives (e.g., using individual sibling tools for specific checks), which prevents a perfect 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/lordbasilaiassistant-sudo/base-security-scanner-mcp'

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