JSPM

  • Created
  • Published
  • Downloads 22
  • Score
    100M100P100Q84111F
  • License MIT

Generic MCP server for intelligent documentation access in any project

Package Exports

  • @afterxleep/doc-bot
  • @afterxleep/doc-bot/src/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@afterxleep/doc-bot) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

doc-bot

npm version License: MIT

A generic MCP (Model Context Protocol) server that provides intelligent documentation and rules for any project. Works with any MCP-compatible AI tools and IDEs.

It's platform agnostic and designed to replace and extend the rule systems provided by different IDEs, such as Cursor (Cursor Rules) or Claude (CLAUDE.md). Instead of relying on separate rule-sets for each tool, you can use doc-bot to provide unified documentation for agentic coding across all your AI assistants.

What is doc-bot?

doc-bot is an intelligent documentation server that:

  • 🔍 Searches your project documentation instantly
  • 🧠 Auto-indexes content for smart inference (no manual keyword mapping!)
  • 📋 Applies global rules to every AI interaction
  • 🎯 Suggests contextual documentation based on file patterns
  • 🤖 Detects code patterns, frameworks, and keywords automatically
  • 🔄 Updates automatically when docs change

Installation

  1. Create your documentation folder in your project root (see organization section below)

  2. Add doc-bot to your MCP-compatible AI tool configuration:

    {
      "mcpServers": {
        "docbot": {
          "command": "npx",
          "args": ["@afterxleep/doc-bot", "--docs", "./doc-bot"]
        }
      }
    }
  3. Restart your AI tool

How to organize your documentation

Create a doc-bot/ folder in your project root with markdown files using frontmatter:

your-project/
├── doc-bot/
│   ├── coding-standards.md     # Global rule (alwaysApply: true)
│   ├── security.md             # Global rule (alwaysApply: true) 
│   ├── testing.md              # Contextual rule (alwaysApply: false)
│   ├── api-development.md      # Contextual rule (alwaysApply: false)
│   └── troubleshooting.md      # Contextual rule (alwaysApply: false)
└── package.json

Note: You can use any folder name - just specify it in your MCP configuration:

"args": ["@afterxleep/doc-bot", "--docs", "./my-custom-docs"]

Documentation types:

  • Global Rules (alwaysApply: true): Critical guidelines applied to every AI interaction
  • Contextual Rules (alwaysApply: false): Rules applied based on file patterns and context

Example documentation files:

Global Rule Example (doc-bot/coding-standards.md): ```markdown

alwaysApply: true title: "Coding Standards" description: "Core coding standards that apply to all code" keywords: ["code-quality", "standards", "best-practices"]

Coding Standards

  • Use 2 spaces for indentation
  • Maximum line length: 100 characters
  • Always use const/let, never var
  • Prefer async/await over promises
  • Write descriptive variable names

**Contextual Rule Example** (`doc-bot/testing.md`):
```markdown
---
alwaysApply: false
title: "Testing Guide"
description: "How to write and run tests"
keywords: ["testing", "jest", "tdd", "unit-tests"]
filePatterns: ["*.js"]
---

# Testing Guide

All test files should:
- Use describe/it blocks for organization
- Include both positive and negative test cases
- Mock external dependencies
- Aim for 80%+ code coverage

Run tests with: `npm test`

Frontmatter-Based Configuration

doc-bot uses frontmatter in your markdown files to automatically detect and categorize rules - no manifest.json required!

Frontmatter Fields:

  • alwaysApply: true - Global rules applied to every AI interaction
  • alwaysApply: false - Contextual rules applied based on file patterns
  • filePatterns: ["*.js"] - When to apply contextual rules (only needed for alwaysApply: false)
  • keywords: ["list", "of", "keywords"] - For smart indexing and search
  • title and description - Standard metadata

🎯 Automatic Intelligence

doc-bot automatically analyzes your documentation to provide smart suggestions:

  • Keyword-based search from frontmatter metadata
  • Context-aware suggestions based on file patterns
  • Smart inference from documentation content
  • Automatic indexing - no manual configuration needed

Writing effective documentation

For best results, include descriptive frontmatter:

---
alwaysApply: false
title: "React Component Guidelines"
description: "Best practices for building React components"
keywords: ["react", "components", "hooks", "jsx"]
filePatterns: ["*.js"]
---

# React Component Guidelines

Your documentation content here...

Development setup

Running locally

  1. Clone the repository:

    git clone https://github.com/afterxleep/doc-bot.git
    cd doc-bot
  2. Install dependencies:

    npm install
  3. Run the server (uses built-in doc-bot/ folder):

    npm start
  4. Run with file watching (recommended for development):

    npm run dev
  5. Run with examples documentation:

    npm run start:examples
  6. Run tests:

    npm test

Note: This is an MCP server that communicates via stdio transport, not HTTP. When running locally, it will start the MCP server and show you the configuration to add to your MCP client (like Claude Code).

Testing your setup

Ask your AI assistant something like "What documentation is available?" to test that doc-bot is working.

CLI Options

doc-bot [options]

Options:
  -d, --docs <path>        Path to docs folder (required)
  -c, --config <path>      Path to manifest file (optional, for backward compatibility)
  -v, --verbose           Enable verbose logging
  -w, --watch             Watch for file changes
  -h, --help              Show help

Example usage:

# Basic usage (no manifest.json needed)
doc-bot --docs ./my-docs

# With verbose logging and file watching
doc-bot --docs ./my-docs --verbose --watch

# With optional manifest for backward compatibility
doc-bot --docs ./my-docs --config ./manifest.json

Publishing and Development

Local Development

  1. Clone and setup:

    git clone https://github.com/afterxleep/doc-bot.git
    cd doc-bot
    npm install
  2. Run locally:

    npm run dev    # With file watching
    npm start      # Basic run
    npm test       # Run tests
  3. Test with Claude Code: Add to your Claude Code config:

    {
      "mcpServers": {
        "docs": {
          "command": "node",
          "args": ["/path/to/doc-bot/bin/doc-bot.js", "--docs", "./doc-bot", "--watch"]
        }
      }
    }

Publishing to npm

  1. Test the package:

    npm run test
    npm run lint
  2. Update version:

    npm version patch|minor|major
  3. Publish:

    npm publish

Push Changes

git add .
git commit -m "feat: your feature description"
git push origin main
git push --tags  # Push version tags

License

MIT License - see the LICENSE file for details.