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

swe-knowledge-base

v1.1.3

Published

MCP server for software engineering knowledge base and retrieval

Readme

SWE Knowledge Base MCP Server

A production-quality Model Context Protocol (MCP) server that acts as a software engineering knowledge base and retrieval system. It indexes high-quality software projects and allows AI assistants to search for best practices, architecture patterns, code examples, documentation, and project knowledge.

Features

  • Multi-language support: C, C++, C#, Rust, Python, JavaScript, TypeScript, Go, Java, Markdown
  • Semantic + keyword search: Fuzzy matching powered by Fuse.js with BM25-inspired ranking
  • Incremental indexing: Fast re-indexing by tracking file modifications
  • Architecture detection: Automatically detects design patterns (MVC, Repository, Factory, Singleton, Observer, Strategy, etc.)
  • Best practices extraction: Detects naming conventions, error handling, thread safety, testing strategies, and more
  • Symbol indexing: Indexes functions, classes, interfaces, structs, enums, and other symbols
  • Documentation search: Searches READMEs, docstrings, JSDoc, and markdown documentation
  • Caching: File-based and in-memory caching for fast repeated queries
  • Configurable: Customizable via JSON config file
  • LLM-optimized output: Results are formatted for easy consumption by AI assistants

MCP Tools

| Tool | Description | |------|-------------| | search_code | Search across source code with fuzzy and keyword matching | | search_docs | Search documentation, READMEs, and markdown files | | search_examples | Find code examples prioritizing documented code | | search_architecture | Find architecture and design patterns | | search_best_practices | Find coding best practices and conventions | | search_symbols | Find functions, classes, methods by name | | list_projects | List all indexed projects | | reindex_project | Re-index a specific project | | reindex_all | Re-index all projects |

Installation

Prerequisites

  • Node.js >= 18
  • npm

Steps

  1. Ensure the server is at C:\Users\Agami\Documents\Cline\MCP\swe-knowledge-base

  2. Install dependencies (if not already done):

cd C:\Users\Agami\Documents\Cline\MCP\swe-knowledge-base
npm install
npm run build
  1. Add to your MCP settings (see Configuration section below).

Configuration

MCP Client Configuration

Add this to your MCP settings file (cline_mcp_settings.json):

{
  "mcpServers": {
    "swe-knowledge-base": {
      "command": "node",
      "args": ["C:\\Users\\Agami\\Documents\\Cline\\MCP\\swe-knowledge-base\\build\\index.js"],
      "env": {}
    }
  }
}

Server Configuration

The server reads configuration from config/config.json. If not present, a default config is created:

{
  "projectDir": "./projects",
  "indexDir": "./index",
  "cacheDir": "./cache",
  "logDir": "./logs",
  "embeddingModel": "bm25",
  "indexRefreshIntervalMs": 300000,
  "maxFileSize": 1048576,
  "maxFilesPerProject": 10000,
  "ignorePatterns": [
    "node_modules/**",
    ".git/**",
    "dist/**",
    "build/**",
    "target/**",
    "__pycache__/**"
  ],
  "searchMaxResults": 20,
  "searchFuzzyThreshold": 0.3,
  "cacheEnabled": true,
  "cacheTtlMs": 1800000,
  "parallelProcessing": true,
  "logLevel": "info"
}

Environment Variables

| Variable | Description | |----------|-------------| | SWE_KB_BASE_DIR | Override the base directory for all paths |

Directory Structure

swe-knowledge-base/
├── projects/       # Place your software projects here
├── index/          # Persisted index data
├── cache/          # Search result cache
├── config/         # Configuration files
├── logs/           # Server logs
├── src/            # TypeScript source code
│   ├── index.ts    # Main MCP server
│   ├── config/     # Configuration management
│   ├── logger/     # Logging system
│   ├── cache/      # Caching system
│   ├── scanner/    # Project file scanner
│   ├── parser/     # Code parser (multi-language)
│   ├── indexer/    # Indexing pipeline + architecture + best practices
│   ├── search/     # Search engine (Fuse.js)
│   └── types/      # TypeScript type definitions
├── build/          # Compiled JavaScript output
├── package.json
└── tsconfig.json

Usage

Adding Projects

  1. Copy or symlink your software projects into the projects/ directory:
swe-knowledge-base/
└── projects/
    ├── my-react-app/
    ├── my-rust-lib/
    └── my-python-api/
  1. Each project should be a standalone directory with source code.

Indexing

Indexing happens automatically when the server starts and no index exists. You can also trigger it manually:

  • Reindex all projects: Ask the AI assistant to use reindex_all
  • Reindex one project: Ask the AI assistant to use reindex_project with the project name

The index auto-refreshes periodically (configurable via indexRefreshIntervalMs).

Example Workflows

Find how error handling is done across projects:

"Search for error handling best practices"

Find a specific function:

"Search for symbols named createServer"

Find architecture patterns:

"Search for dependency injection patterns"

Find code examples:

"Find examples of how to implement a REST API handler"

Search documentation:

"Search docs for rate limiting configuration"

List what's indexed:

"List all indexed projects"

Architecture

Indexing Pipeline

  1. Scanner discovers projects and files in projects/
  2. Parser extracts symbols, imports, comments, and documentation
  3. Indexer builds the search index (incremental, based on file modification times)
  4. Architecture Detector identifies design patterns and architectural styles
  5. Best Practices Extractor analyzes coding conventions and practices

Search Engine

  • Fuse.js provides fuzzy search with configurable thresholds
  • Inverted indexes for fast symbol lookups
  • BM25-inspired ranking combines multiple scoring factors
  • Result caching with configurable TTL

Supported Languages

| Language | Symbols | Imports | Comments | Documentation | |----------|---------|---------|----------|---------------| | Python | Classes, functions, methods | import/from...import | # comments | Docstrings | | JavaScript/TypeScript | Classes, functions, interfaces, types, enums | import/require | //, /** / | JSDoc | | Go | Functions, methods, structs, interfaces | import | // | Comments | | Rust | Functions, structs, enums, traits | use | //, /// | Doc comments | | Java | Classes, methods, interfaces | import | //, /* / | JSDoc | | C/C++ | Functions, structs, classes, enums | #include | //, / / | Comments | | C# | Classes, methods, interfaces, namespaces | using | //, /* */ | XML docs | | Markdown | Headers/sections | - | - | Full content |

Development

# Build
npm run build

# Watch mode
npm run watch

# Run MCP inspector
npm run inspector

License

MIT