Repository avatar
AI Tools
v0.2.0
active

factsets

io.github.joshua-auchincloss/factsets

An MCP server that provides a local, persistent, self-maintaining knowledge base for AI agents

Documentation

Factsets

PackageNPM Downloads NPM Version
CI/CDRelease Tests codecov

A self-maintaining knowledge base for AI agents, exposed via the Model Context Protocol (MCP). Manages facts (atomic knowledge), resources (cached external content), skills (procedural markdown), and execution logs (command history) using SQLite.

Features

  • Persistent Context - Knowledge survives across sessions
  • Self-Maintaining - Staleness detection with refresh instructions
  • Tag-Based Organization - Flexible categorization and retrieval
  • Skill Documents - Markdown files for procedural knowledge
  • User Preferences - Configurable output style and agent behavior
  • MCP Protocol - Standard interface for AI tool/prompt definitions

Installation

npm install --global factsets
pnpm install --global factsets
bun install --global factsets

Quick Start

As MCP Server

Add to your MCP client configuration (Claude Desktop, GitHub Copilot, Cursor, etc.), using bunx, npx or pnpm dlx accordingly:

{
  "mcpServers": {
    "factsets": {
      "command": "bunx",
      "args": ["factsets", "mcp-server"]
    }
  }
}

Or run directly:

bunx factsets mcp-server

First-Time Setup

After adding Factsets to your MCP client, run the setup prompt to integrate it into your project:

In a supported IDE: Type /mcp.factsets.setup in the chat to run the guided setup

In other clients: Call the get_setup_guide tool or use the setup prompt

The setup guide will:

  • Analyze your project structure and establish baseline facts
  • Configure the skills directory for your AI client
  • Create or update AGENTS.md with Factsets instructions
  • Migrate any existing skills with Factsets integration
  • Register key configuration files as resources

This one-time setup ensures agents have full context on every future interaction.

CLI Commands

# Start MCP server (default command - auto-watches skill files and seeds starter content)
bunx factsets [--database-url <path>] [--client <type>]

# Explicit mcp-server command (same as above)
bunx factsets mcp-server [--database-url <path>] [--client <type>]

# Start without file watching
bunx factsets --no-watch-skills

# Start without seeding starter content
bunx factsets --no-seed

# Run file watcher standalone
bunx factsets watch-files [--database-url <path>]

# Run background maintenance worker
bunx factsets worker [--database-url <path>]

# Export database to JSON
bunx factsets dump backup.json

# Restore database from JSON
bunx factsets restore backup.json

The --client flag configures where skill files are stored (e.g., github-copilot -> .github/prompts/skills/). If you want to change clients / your skill directory, do so through your agent which will migrate skills for you.

See Configuration Guide for all options.

Core Concepts

ConceptDescription
FactsAtomic knowledge units (1-3 sentences), tagged and timestamped
ResourcesExternal content (files, URLs, APIs) with cached snapshots and retrieval methods
SkillsMarkdown documents for procedural knowledge, stored on filesystem
Execution LogsCommand history with success/failure tracking for skill validation
TagsFlexible categorization for all content types

MCP Tools

Facts

ToolDescription
submit_factsAdd facts with tags and source tracking
search_factsQuery facts by tags, content, or filters
verify_factsMark facts as verified by ID
verify_facts_by_tagsBulk verify facts by tags
update_factUpdate fact content, metadata, or tags
delete_factsRemove facts by criteria
restore_factsRestore soft-deleted facts

Resources

ToolDescription
add_resourcesRegister resources with retrieval methods
search_resourcesFind resources by tags, type, or URI
get_resourcesGet resources by ID or URI with freshness
update_resource_snapshotUpdate cached content for single resource
update_resource_snapshotsBulk update cached content
update_resourceUpdate resource metadata (not content)
delete_resourcesRemove resources
restore_resourcesRestore soft-deleted resources

Skills

ToolDescription
create_skillCreate markdown skill document
update_skillUpdate skill metadata/references
search_skillsFind skills by tags or query
get_skillsGet skills by name with content
link_skillLink skill to facts/resources/skills
sync_skillSync skill after file edit
delete_skillsRemove skills
get_dependency_graphGet skill dependency tree
restore_skillsRestore soft-deleted skills

Execution Logs

ToolDescription
submit_execution_logsRecord command/test/build executions
search_execution_logsFind executions by query, tags, success
get_execution_logGet execution details by ID

Tags

ToolDescription
create_tagsCreate organizational tags
list_tagsList tags with usage counts
update_tagsUpdate tag descriptions
prune_orphan_tagsClean up unused orphan tags

Configuration

ToolDescription
get_configGet a configuration value by key
set_configSet a configuration value
delete_configDelete a configuration value
list_configList all configuration with schema
get_config_schemaGet available options with descriptions

User Preferences

ToolDescription
get_preference_promptGet natural language preference prompt
get_user_preferencesGet structured preference data
infer_preferenceUpdate preference from user behavior
reset_preferencesReset preferences to defaults

Maintenance

ToolDescription
check_staleFind stale resources and dependencies
mark_resources_refreshedMark resources as current

Context & Guides

ToolDescription
get_knowledge_contextBuild context from tags (facts/resources/skills)
build_skill_contextGet skill with formatted content and refs
get_maintenance_reportGenerate staleness/maintenance report
get_refresh_guideGet instructions for refreshing a resource
get_agent_guideGet the agent workflow guide (call first)
get_concept_guideGet conceptual overview and design philosophy
get_config_guideGet configuration guide with all options

MCP Prompts

PromptDescription
setupGuided setup for new project integration
user_preferencesGet user preferences for output formatting
knowledge_contextBuild context from tags
recall_skillGet skill with references
maintenance_reportStaleness summary
refresh_guideInstructions to refresh a resource
agent_guideAgent workflow guide (call first)
conceptConceptual overview and philosophy
configConfiguration guide with all options

Documentation

Development

# Run tests
bun test

# Run full e2e (tests + build + dry run)
bun e2e

# Build distribution
bun dist

# Format code
bun format

# Lint
bun lint

# Generate database migrations
bun migrations

# Inspect MCP server with inspector
bun inspect