ai-knowledge-hub
Version:
MCP server that provides unified access to organizational knowledge across multiple platforms (local docs, Guru, Notion)
249 lines (180 loc) โข 8.3 kB
Markdown
# Knowledge Hub
A **Model Context Protocol (MCP) server** that provides AI assistants with unified access to organizational knowledge across multiple platforms. This server bridges the gap between AI tools and your organization's knowledge repositories, enabling intelligent document creation, retrieval, and management across local docs, Guru, and Notion.
## ๐ What is this?
Knowledge Hub is a production-ready MCP server that provides:
- **๐ง Guru Knowledge Base Integration** - Search, read, and manage Guru cards and collections
- **๐ Notion Database Management** - Create, query, update, and manage documentation in Notion databases
- **๐ Advanced Query & Search** - Powerful filtering, sorting, and search capabilities across all platforms
- **๐ ๏ธ Content Creation & Management** - Convert markdown to Notion pages with proper metadata and code block validation
- **๐ Bi-directional Sync** - Export Notion pages back to markdown format
- **๐๏ธ Development & Production Modes** - Flexible deployment options for different environments
## ๐๏ธ Architecture
Built with **TypeScript/Node.js** (โฅ20.0.0), **MCP SDK v1.12.0**, and **Zod validation** for type safety. Features a clean, modular architecture with separated concerns:
```
src/
โโโ index.ts # Main MCP server entry point
โโโ server.ts # Server configuration and tool registration
โโโ services/ # API services (Notion, Guru)
โโโ tools/ # MCP tool implementations
โโโ types/ # TypeScript type definitions
โโโ utils/ # Conversion utilities and helpers
```
## ๐ ๏ธ Available Tools (9 Total)
### ๐ง Guru Knowledge Base (3 tools)
- **`guru-list-cards`** - Search and filter Guru cards with advanced queries
- **`guru-read-card`** - Read complete card content with formatting
- **`guru-get-card-attachments`** - List and download card attachments
### ๐ Notion Database Management (5 tools)
- **`list-database-pages`** - Advanced query and search with filtering by category, tags, status
- **`create-page-from-markdown`** - Create pages from markdown with metadata and code block validation
- **`update-page`** - Update existing pages (content and/or metadata)
- **`archive-page`** - Archive pages by moving to trash
- **`export-page-to-markdown`** - Export pages to clean markdown format
### ๐ง Utility (1 tool)
- **`hello`** - Example tool demonstrating MCP capabilities
## โ๏ธ Configuration & Setup
### ๐ Installation
```bash
# Clone and install
git clone https://github.com/LaserFocused-ee/ai-docs-mcp.git
cd ai-docs-mcp/mcp_server
npm install
# Development
npm run dev
# Production build
npm run build && npm start
```
### ๐ Claude Desktop Integration
#### Development Configuration
```json
{
"mcpServers": {
"ai-knowledge-hub-dev": {
"command": "node",
"args": ["dist/index.js"],
"env": {
"NODE_ENV": "development",
"DEV_HOME": "/path/to/your/mcp_server",
"GURU_TOKEN": "username:token",
"NOTION_TOKEN": "your-notion-token",
"NOTION_MCP_DATABASE_ID": "your-database-id"
}
}
}
}
```
#### Production Configuration
```json
{
"mcpServers": {
"ai-knowledge-hub": {
"command": "npx",
"args": ["ai-knowledge-hub"],
"env": {
"GURU_TOKEN": "username:token",
"NOTION_TOKEN": "your-notion-token",
"NOTION_MCP_DATABASE_ID": "your-database-id"
}
}
}
}
```
### ๐ API Credentials
**Guru**: Log into Guru โ Settings โ API Access โ Generate token โ Format as `username:token`
**Notion**: Go to [Notion Integrations](https://www.notion.so/my-integrations) โ Create integration โ Get API key โ Share database with integration โ Copy database ID from URL
## ๐ Documentation Structure
Local documentation organized in `docs/` directory:
```
docs/
โโโ code_guidelines/
โ โโโ flutter/architecture/ # Flutter architecture patterns
โ โโโ react/ # React best practices
โ โโโ nestjs/ # NestJS guidelines
โ โโโ git/ # Git workflows
โโโ service-docs/ # API guides and references
```
## ๐ Key Features
### ๐ Markdown โ Notion Conversion
- **Code Block Validation**: Automatically validates code blocks against Notion's 2000 character limit
- **Intelligent Error Handling**: Provides specific guidance for splitting large code blocks while preserving logical boundaries
- **Rich Formatting Support**: Tables, lists, headers, links, code blocks, and more
- **Metadata Preservation**: Categories, tags, descriptions, and status values
### ๐ Advanced Query System
- **Multi-Platform Search**: Unified search across local docs, Guru, and Notion
- **Smart Filtering**: Filter by category, tags, status, dates with flexible sorting
- **Pagination Support**: Handle large datasets efficiently
### ๐ ๏ธ Development Support
- **Environment Detection**: Automatic dev/production mode switching
- **Hot Reload**: Development mode with file watching
- **MCP Inspector Integration**: Comprehensive testing tools
- **Type Safety**: Full TypeScript with Zod validation
## ๐งช Testing & Validation
### Quick Testing
```bash
# Interactive UI testing
npm run inspect
# Basic validation
npm run validate
# Comprehensive test suite
npm run test:inspector
```
### Example Tool Calls
```bash
# List available documentation
npx @modelcontextprotocol/inspector --cli node dist/index.js \
--method tools/call --tool-name legacy-list-docs
# Search Notion pages
npx @modelcontextprotocol/inspector --cli node dist/index.js \
--method tools/call --tool-name list-database-pages \
--tool-arg search="testing" --tool-arg limit=5
# Search Guru knowledge
npx @modelcontextprotocol/inspector --cli node dist/index.js \
--method tools/call --tool-name guru-list-cards \
--tool-arg searchTerms="API documentation" --tool-arg maxResults=5
```
## ๐ก Usage Patterns
### Local Documentation
```bash
legacy-list-docs() # Discover available docs
legacy-read-doc(category="code_guidelines/flutter", name="best-practices")
```
### Notion Management
```bash
# Context-aware search
list-database-pages(search="testing", tags=["react"], status="published")
# Create with metadata
create-page-from-markdown(
markdown="# API Guide\n\nDocumentation...",
metadata={category: "api-reference", tags: ["api", "rest"]}
)
```
### Guru Knowledge Access
```bash
guru-list-cards(searchTerms="troubleshooting", maxResults=10)
guru-read-card(cardId="card-uuid")
```
## ๐ Releases & Publishing
This package uses automated GitHub Actions workflows for professional release management.
### ๐ฆ **For Users**
- Install the latest stable version: `npx ai-knowledge-hub`
- View all releases: [GitHub Releases](https://github.com/LaserFocused-ee/ai-docs-mcp/releases)
- Check npm versions: [npm Package](https://www.npmjs.com/package/ai-knowledge-hub)
### ๐ ๏ธ **For Contributors/Maintainers**
- **Automated Releases**: Use GitHub Actions for safe, validated releases
- **Version Management**: Supports semantic versioning (patch/minor/major)
- **Quality Assurance**: Automated testing and validation before publishing
๐ **Full setup guide**: See [RELEASE_SETUP.md](./RELEASE_SETUP.md) for complete instructions on:
- Setting up npm tokens and GitHub secrets
- Using the automated release workflow
- Understanding semantic versioning
- Troubleshooting common issues
## ๐ Security & Requirements
- **Node.js**: โฅ20.0.0 required
- **Secure Credentials**: Environment variable handling only
- **File Access**: Restricted to docs directory
- **Input Validation**: Zod schema validation for all parameters
- **API Rate Limiting**: Automatic handling
## ๐ License
MIT License - See package.json for details.
---
Knowledge Hub transforms static documentation, institutional knowledge, and content management into an intelligent, queryable ecosystem for AI assistants. It enables context-aware development guidance, comprehensive documentation management, and seamless access to your organization's collective knowledge across multiple platforms through a unified, powerful API.