npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@kridaydave/code-mapper

v1.0.1

Published

MCP server for codebase mapping and analysis with graph visualization

Readme

CodeGraph

An MCP server that uses AST parsing to map TypeScript/JavaScript codebase structure and expose codebase intelligence for AI assistants.

Features

  • AST-based analysis - Uses ts-morph (TypeScript compiler API) to parse code without running it
  • Dependency graphs - Builds graph representations of how files, functions, and classes relate
  • Impact ranking - Identifies the most central/critical files using graph centrality metrics
  • Call chain tracing - Finds dependency paths between any two symbols
  • Mermaid diagrams - Generates visual dependency diagrams

MCP Tools

| Tool | Description | |------|-------------| | scan_codebase | Scan a directory and return a summary of all files, functions, classes, and relationships | | find_function | Search for a function or class by name, returns location, signature, callers, and callees | | analyze_dependencies | Returns the full dependency graph or a subgraph for a specific file (JSON or Mermaid) | | rank_impact | Ranks files by centrality (in-degree, out-degree, betweenness) to identify critical modules | | trace_call_chain | Traces the call chain / dependency path from one function or file to another | | analyze_complexity | Analyzes code complexity metrics for each file (cyclomatic, cognitive complexity, nesting depth) |

MCP Resources

| Resource | Description | |----------|-------------| | codebase://summary | Cached summary of the most recently scanned codebase | | codebase://graph/{format} | Dependency graph in json or mermaid format |

Setup

Install

npm install
npm run build

Use with Claude Desktop (or any MCP client)

Add this to your MCP client configuration:

{
  "mcpServers": {
    "CodeGraph": {
      "command": "npx",
      "args": ["tsx", "/absolute/path/to/CodeGraph/src/index.ts"]
    }
  }
}

Or after building:

{
  "mcpServers": {
    "CodeGraph": {
      "command": "node",
      "args": ["/absolute/path/to/CodeGraph/dist/index.js"]
    }
  }
}

Usage

Once connected, AI assistants can:

  1. Scan your codebase: "Scan my codebase at ./src"
  2. Find symbols: "Where is the authenticate function defined and who calls it?"
  3. Analyze dependencies: "Show me the dependency graph as mermaid"
  4. Rank impact: "What's the most central file in my project?"
  5. Trace paths: "Trace the call chain from handleRequest to saveToDatabase"

Architecture

src/
├── index.ts              # MCP server entry point (stdio transport)
├── parser/
│   ├── types.ts          # FileInfo, FunctionInfo, ClassInfo, etc.
│   ├── FileAnalyzer.ts   # ts-morph single-file analysis
│   └── ProjectParser.ts  # Directory scanning with caching
├── graph/
│   ├── types.ts          # GraphNode, GraphEdge, RankedFile, etc.
│   ├── GraphBuilder.ts   # Converts ParseResult to graphology Graph
│   └── GraphAnalyzer.ts  # Centrality, path finding, cycle detection
└── mcp/
    ├── cache.ts          # Shared analyzer cache
    ├── tools.ts          # 5 MCP tool definitions
    └── resources.ts      # MCP resource definitions

Tech Stack

  • ts-morph - TypeScript AST parsing (wraps the TypeScript compiler API)
  • graphology - Graph data structure for dependency mapping
  • graphology-metrics - Centrality algorithms (betweenness, degree, etc.)
  • graphology-shortest-path - Bidirectional shortest path finding
  • @modelcontextprotocol/server - MCP server SDK with stdio transport
  • zod - Schema validation for tool inputs

Ignored Directories

By default, these directories are excluded from scanning:

  • node_modules, dist, build, .git, coverage
  • .next, .nuxt, .svelte-kit, __tests__, .cache

License

MIT