Skip to main content
Glama

inkog_mcp_scan

Scan MCP servers for security vulnerabilities including tool poisoning, command injection, data exfiltration, and supply chain risks. Maps findings to OWASP frameworks and offers AI-powered deep analysis for novel threats.

Instructions

Scan MCP servers from registry or by repository URL for security vulnerabilities. Detects tool poisoning, command injection, data exfiltration, prompt injection, excessive permissions, obfuscation, supply chain risks, and more. Maps findings to OWASP Agentic Top 10 and OWASP MCP Top 10. Set deep=true for AI-powered deep analysis (~10 min, catches novel threats). For skill package scanning, use inkog_skill_scan instead.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
server_nameNoMCP server name from registry (e.g., "github", "filesystem", "postgres")
repository_urlNoGitHub repository URL of the MCP server
deepNoEnable AI deep analysis

Implementation Reference

  • The handler function that implements the logic for 'inkog_mcp_scan' by using the client to perform the scan and formatting the results.
    async function handleMCPScan(args: Record<string, unknown>): Promise<ToolResult> {
      const parsed = MCPScanArgsSchema.parse(args);
    
      try {
        const client = getClient();
        let response: SkillScanResponse;
    
        if (parsed.server_name) {
          // Scan MCP server from registry (optionally with repo URL for deep)
          const mcpOpts: { serverName: string; url?: string } = {
            serverName: parsed.server_name,
          };
          if (parsed.repository_url) {
            mcpOpts.url = parsed.repository_url;
          }
          response = await client.scanMCPServer(mcpOpts);
        } else if (parsed.repository_url) {
          // Scan MCP server from repository URL
          response = await client.scanSkill({
            repositoryUrl: parsed.repository_url,
          });
        } else {
          return {
            content: [
              {
                type: 'text',
                text: 'Please provide either server_name or repository_url.',
              },
            ],
            isError: true,
          };
        }
    
        if (!response.success || !response.result) {
          return {
            content: [
              {
                type: 'text',
                text: `MCP scan failed: ${response.error ?? 'Unknown error'}`,
              },
            ],
            isError: true,
          };
        }
    
        // Format the results
        const result = response.result;
        const lines: string[] = [];
    
        lines.push(`# MCP Server Security Scan: ${result.name || 'Unknown'}`);
        lines.push('');
        lines.push(`**Overall Risk:** ${formatRiskBadge(result.overall_risk)}`);
        lines.push(`**Security Score:** ${result.security_score}/100`);
        lines.push(`**Files Scanned:** ${result.files_scanned} | **Lines:** ${result.lines_of_code}`);
        lines.push('');
    
        // Permissions
        if (result.permissions) {
          const p = result.permissions;
          lines.push('## Permissions');
          lines.push(formatPermission('File Access', p.file_access));
          lines.push(formatPermission('Network Access', p.network_access));
          lines.push(formatPermission('Code Execution', p.code_execution));
          lines.push(formatPermission('Database Access', p.database_access));
          lines.push(formatPermission('Environment Access', p.environment_access));
          lines.push(`**Scope:** ${p.scope}`);
    
          if (p.code_execution && p.network_access && (p.file_access || p.environment_access)) {
            lines.push('');
            lines.push('⚠️ **LETHAL TRIFECTA DETECTED:** Code Execution + Network + File/Env Access');
          }
          lines.push('');
        }
    
        // Tools
        if (result.tool_analyses?.length > 0) {
          lines.push(`## Tools (${result.tool_analyses.length})`);
          for (const tool of result.tool_analyses) {
            const riskIcon = tool.risk_level === 'dangerous' ? '🔴' :
                             tool.risk_level === 'moderate' ? '🟡' : '🟢';
            lines.push(`- ${riskIcon} **${tool.name}** [${tool.risk_level}]`);
            if (tool.attack_vectors?.length) {
              for (const v of tool.attack_vectors) {
                lines.push(`  - Attack vector: ${v}`);
              }
            }
          }
          lines.push('');
        }
    
        // Findings
        if (result.findings.length > 0) {
          lines.push(`## Findings (${result.findings.length})`);
          lines.push(`🔴 Critical: ${result.critical_count} | 🟠 High: ${result.high_count} | 🟡 Medium: ${result.medium_count} | 🟢 Low: ${result.low_count}`);
          lines.push('');
    
          for (let i = 0; i < result.findings.length; i++) {
            const f = result.findings[i]!;
            lines.push(`### ${formatSeverityIcon(f.severity)} #${i + 1}: ${f.title}`);
            if (f.file) {
              lines.push(`📁 ${f.file}${f.line ? `:${f.line}` : ''}`);
            }
            if (f.tool_name) {
              lines.push(`🔧 Tool: ${f.tool_name}`);
            }
            lines.push(f.description);
            if (f.owasp_agentic || f.owasp_mcp) {
              const refs: string[] = [];
              if (f.owasp_agentic) refs.push(`OWASP Agentic: ${f.owasp_agentic}`);
              if (f.owasp_mcp) refs.push(`OWASP MCP: ${f.owasp_mcp}`);
              lines.push(`📋 ${refs.join(' | ')}`);
            }
            lines.push(`💡 ${f.remediation}`);
            lines.push('');
          }
        } else {
          lines.push('## ✅ No security findings detected');
        }
    
        // Deep scan flow
        if (parsed.deep && response.scan_id) {
          lines.push('');
          lines.push('---');
          lines.push('## 🔬 Deep Analysis');
          lines.push('Triggering AI deep analysis...');
    
          try {
            await client.triggerSkillDeepScan(response.scan_id);
          } catch {
            lines.push('⚠️ Could not trigger deep analysis. Returning standard results.');
            return {
              content: [{ type: 'text', text: lines.join('\n') }],
            };
          }
    
          const deadline = Date.now() + 15 * 60 * 1000;
          let deepDone = false;
    
          while (Date.now() < deadline) {
            await sleep(5000);
            try {
              const detail: SkillScanDetailResponse = await client.getSkillScan(response.scan_id);
              const status = detail.scan?.ai_scan_status as string | undefined;
    
              if (status === 'completed') {
                const deepOutput = formatDeepFindings(detail.scan);
                if (deepOutput) {
                  lines.push(deepOutput);
                } else {
                  lines.push('✅ Deep analysis completed — no additional findings.');
                }
                deepDone = true;
                break;
              }
              if (status === 'failed') {
                lines.push('⚠️ Deep analysis failed. Standard scan results are shown above.');
                deepDone = true;
                break;
              }
            } catch {
              // Polling error — continue waiting
            }
          }
    
          if (!deepDone) {
            lines.push('⏱️ Deep analysis timed out (15 min). Check the dashboard for results.');
          }
        }
    
        return {
          content: [
            {
              type: 'text',
              text: lines.join('\n'),
            },
          ],
        };
      } catch (err) {
        if (err instanceof InkogAuthError) {
          return {
            content: [{ type: 'text', text: '🔐 Authentication required. Set INKOG_API_KEY environment variable.' }],
            isError: true,
          };
        }
        if (err instanceof InkogRateLimitError) {
          return {
            content: [{ type: 'text', text: '⏳ Rate limited. Please wait and try again.' }],
            isError: true,
          };
        }
        if (err instanceof InkogNetworkError) {
          return {
            content: [{ type: 'text', text: '🌐 Network error. Check your connection and try again.' }],
            isError: true,
          };
        }
        if (err instanceof InkogApiError) {
          return {
            content: [{ type: 'text', text: `❌ API error: ${err.message}` }],
            isError: true,
          };
        }
        throw err;
      }
    }
  • Input schema validation for the 'inkog_mcp_scan' tool.
    const MCPScanArgsSchema = z
      .object({
        server_name: z
          .string()
          .optional()
          .describe('MCP server name from registry (e.g., "github", "filesystem", "postgres")'),
        repository_url: z
          .string()
          .url()
          .optional()
          .describe('GitHub repository URL of the MCP server to scan'),
        deep: z
          .boolean()
          .optional()
          .default(false)
          .describe('Enable AI deep analysis (slower but catches novel threats)'),
      })
      .refine(
        (data) =>
          data.server_name !== undefined ||
          data.repository_url !== undefined,
        {
          message: 'Either server_name or repository_url must be provided',
        }
      );
  • Tool definition and registration for 'inkog_mcp_scan', connecting the schema, description, and the handler function.
    export const mcpScanTool: ToolDefinition = {
      tool: {
        name: 'inkog_mcp_scan',
        description:
          'Scan MCP servers from registry or by repository URL for security vulnerabilities. ' +
          'Detects tool poisoning, command injection, data exfiltration, prompt injection, excessive permissions, ' +
          'obfuscation, supply chain risks, and more. Maps findings to OWASP Agentic Top 10 and OWASP MCP Top 10. ' +
          'Set deep=true for AI-powered deep analysis (~10 min, catches novel threats). ' +
          'For skill package scanning, use inkog_skill_scan instead.',
        inputSchema: {
          type: 'object' as const,
          properties: {
            server_name: {
              type: 'string',
              description: 'MCP server name from registry (e.g., "github", "filesystem", "postgres")',
            },
            repository_url: {
              type: 'string',
              description: 'GitHub repository URL of the MCP server',
            },
            deep: {
              type: 'boolean',
              description: 'Enable AI deep analysis',
              default: false,
            },
          },
        },
      },
      handler: handleMCPScan,
    };
Behavior4/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. It does well by describing the tool's capabilities (detecting various vulnerabilities, mapping to OWASP frameworks) and operational details (deep analysis takes ~10 minutes, catches novel threats). However, it doesn't mention potential side effects, rate limits, or authentication requirements, leaving some behavioral aspects uncovered.

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 efficiently structured and front-loaded: the first sentence covers the core purpose, the second details capabilities, and the third provides usage guidance. Every sentence adds value without redundancy, making it appropriately sized and zero-waste.

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

Completeness4/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 scanning with multiple detection types) and lack of annotations or output schema, the description does a good job covering purpose, usage, and key behaviors. However, it doesn't describe the output format or what happens after scanning (e.g., report generation, error handling), which would be helpful for an agent invoking it.

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%, so the schema already documents all three parameters thoroughly. The description adds some context by explaining what 'deep=true' enables (AI-powered deep analysis, ~10 min runtime, catches novel threats), but doesn't provide additional meaning for 'server_name' or 'repository_url' beyond what the schema states. This 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 tool's purpose with specific verbs ('scan', 'detects', 'maps') and resources ('MCP servers'), and explicitly distinguishes it from a sibling tool ('For skill package scanning, use inkog_skill_scan instead'). It details the security vulnerabilities it identifies, making the purpose highly specific and differentiated.

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

Usage Guidelines5/5

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

The description provides explicit guidance on when to use this tool versus alternatives: it specifies two input methods (registry or repository URL), mentions when to use deep analysis, and explicitly names an alternative tool for skill package scanning ('inkog_skill_scan'). This covers both context and exclusions effectively.

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/inkog-io/inkog'

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