Skip to main content
Glama
dazeb

GitHub Mapper MCP Server

map-github-repo

Visualize and analyze the structure of any GitHub repository by entering its URL. Retrieve summary information to understand repository organization and content efficiently.

Instructions

Map a GitHub repository structure and provide summary information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repoUrlYesURL of the GitHub repository (e.g., https://github.com/username/repo)

Implementation Reference

  • src/index.ts:43-55 (registration)
    Registration of the 'map-github-repo' tool in the ListToolsRequestSchema handler, including name, description, and input schema.
      name: "map-github-repo",
      description: "Map a GitHub repository structure and provide summary information",
      inputSchema: {
        type: "object",
        properties: {
          repoUrl: {
            type: "string",
            description: "URL of the GitHub repository (e.g., https://github.com/username/repo)",
          },
        },
        required: ["repoUrl"],
      },
    },
  • Main handler logic for executing the 'map-github-repo' tool within the CallToolRequestSchema handler. Parses URL, fetches repo info and structure using helpers, formats, and returns text content.
    } else if (name === "map-github-repo") {
      if (!githubToken || !octokit) {
        throw new Error("GitHub token not set. Please use the set-github-token tool first.");
      }
    
      const { repoUrl } = args as { repoUrl: string };
    
      try {
        const { owner, repo } = parseGitHubUrl(repoUrl);
        const repoInfo = await getRepoInfo(owner, repo);
        const repoStructure = await getRepoStructure(owner, repo);
        const formattedOutput = formatOutput(repoInfo, repoStructure);
    
        return {
          content: [
            {
              type: "text",
              text: formattedOutput,
            },
          ],
        };
      } catch (error: unknown) {
        console.error("Error mapping repository:", error);
        const errorMessage = error instanceof Error ? error.message : 'An unknown error occurred';
        return {
          content: [
            {
              type: "text",
              text: `Error mapping repository: ${errorMessage}`,
            },
          ],
        };
      }
  • Helper function to parse GitHub repository URL into owner and repository name.
    function parseGitHubUrl(url: string): { owner: string; repo: string } {
      const match = url.match(/github\.com\/([^\/]+)\/([^\/]+)/);
      if (!match) {
        throw new Error("Invalid GitHub URL format");
      }
      return { owner: match[1], repo: match[2] };
    }
  • Helper function to fetch repository metadata (name, description, stars, etc.) using Octokit.
    async function getRepoInfo(owner: string, repo: string) {
      if (!octokit) {
        throw new Error("GitHub client not initialized");
      }
      const { data } = await octokit.repos.get({ owner, repo });
      return {
        name: data.name,
        description: data.description,
        stars: data.stargazers_count,
        forks: data.forks_count,
        language: data.language,
        createdAt: data.created_at,
        updatedAt: data.updated_at,
      };
    }
  • Recursive helper function to build the full directory structure tree of the repository by fetching contents recursively.
    async function getRepoStructure(owner: string, repo: string, path = "") {
      if (!octokit) {
        throw new Error("GitHub client not initialized");
      }
      const { data } = await octokit.repos.getContent({ owner, repo, path });
      
      if (!Array.isArray(data)) {
        throw new Error("Unable to retrieve repository structure");
      }
    
      const structure: { [key: string]: any } = {};
    
      for (const item of data) {
        if (item.type === "file") {
          structure[item.name] = null;
        } else if (item.type === "dir") {
          structure[item.name] = await getRepoStructure(owner, repo, item.path);
        }
      }
    
      return structure;
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. While 'Map' implies a read operation, it doesn't specify what 'summary information' includes, whether authentication is needed, rate limits, error conditions, or how the mapping is performed (e.g., depth, file types included). The description is too vague about the tool's behavior.

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 a single, efficient sentence with zero wasted words. It's appropriately sized for a tool with one parameter and gets straight to the point without unnecessary elaboration.

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

Completeness2/5

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

Given no annotations, no output schema, and a description that lacks behavioral details, this is incomplete for a tool that presumably analyzes repository structure. The description doesn't explain what 'summary information' means, how results are returned, or any constraints. For a tool that likely interacts with external APIs, this leaves significant 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%, so the schema already documents the single parameter 'repoUrl' with its format. The description adds no additional parameter semantics beyond what the schema provides (no format examples, validation rules, or usage context). Baseline 3 is appropriate when schema does the heavy lifting.

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 action ('Map') and resource ('GitHub repository structure'), providing a specific verb+resource combination. However, it doesn't differentiate from the sibling tool 'set-github-token' (which appears to be for authentication configuration rather than repository analysis), so it doesn't fully distinguish from alternatives.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. There's no mention of prerequisites (like authentication), comparison to other repository analysis tools, or limitations. The sibling tool 'set-github-token' suggests authentication might be required, but this isn't addressed.

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

Related 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/dazeb/MCP-Github-Mapper'

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