Skip to main content
Glama

LORE 是一个用于 TypeScript 项目的基于插件的代码考古引擎。它通过模型上下文协议 (MCP) 解析你的 AST、映射依赖关系、检测循环依赖、跟踪异步链、评估类型安全性,并将架构智能提供给 AI 编码助手。

由 EliotShift 构建 · 在 16 个真实项目中经过实战检验 · 100% 通过率。


为什么选择 LORE?

AI 编码助手编写代码很快,但它们缺乏架构记忆。它们无法记住:

  • 哪些文件耦合紧密

  • 循环依赖存在于何处

  • 哪些类型正在跨边界传播

  • 哪些文件更改过于频繁(热点)

  • 架构层级是什么

LORE 通过 CLI 分析和 MCP 服务器集成,为你的 AI 助手提供对代码库架构的深度理解,从而解决了这些问题。


Related MCP server: Continuum

特性

13 个分析器

#

分析器

功能

1

AST 解析器

使用 ts-morph + 正则表达式混合实现的完整 TypeScript/TSX 解析

2

依赖图

映射项目中所有的导入、导出和重新导出

3

循环依赖检测器

查找循环并按严重程度进行排名

4

依赖方向检查器

强制执行层级规则(例如,禁止 controller → DB 导入)

5

香农熵

每个文件的复杂度评分(简单 → 非常复杂)

6

热点分析

Git 变动检测 — 更改过于频繁的文件

7

导入影响分析器

显示每个导入的影响范围

8

类型安全评分器

对你的 any 使用、显式类型和严格性进行评分

9

隐藏耦合检测器

通过共享类型查找隐式依赖

10

AI 建议

优先修复建议 (P0–P3)

11

工具配置检查器

验证 ESLint、Prettier、tsconfig 设置

12

破坏性变更检测器

标记高风险的弃用模式

13

架构缺口查找器

识别缺失的抽象和模式

MCP 集成(8 个工具 + 3 个资源)

将 LORE 暴露给 Claude Desktop、VS Code、Cursor 或任何 MCP 客户端:

工具

描述

analyze

全项目分析 — 评分、违规、复杂度、热点

get-scores

健康评分:整体、类型安全、工具、架构

get-violations

循环依赖、层级违规、架构缺口

get-recommendations

AI 改进建议 (P0–P3)

get-hotspots

Git 变动频繁的文件(红/黄/绿)

get-entropy

香农熵复杂度报告

query-file

文件导入、导出、消费者、复杂度

analyze_architecture

深度 TS 分析:框架、层级、异步链、类型流

资源

描述

lore://analysis

最新分析结果 (JSON)

lore://architecture

深度架构图 (JSON)

lore://config

环境和缓存状态 (JSON)

CLI 命令

lore [path]                   Analyze project (default: cwd)
lore analyze [path]           Explicit analysis
lore init                     Extract architectural decisions
lore status                   View decisions by category
lore diff                     Diff against saved baseline
lore doctor                   Environment + tooling check
lore doctor --fix             Auto-fix project setup
lore ignore                   List/manage ignore patterns
lore watch                   Watch + re-analyze on change
lore mcp inspect             Inspect MCP server setup
lore mcp config              Claude Desktop config snippet
lore version                  Show version

文档

网站: eliotshift.github.io/lore-mcp

页面

描述

落地页

完整功能概述、徽章和快速入门

安装指南

npm、npx 和 Docker 安装

命令参考

所有 CLI 命令:init、status、doctor、watch、diff 等

MCP 集成

Claude Desktop、Cursor 和 Windsurf 设置

示例

Express、NestJS、Next.js 等的真实项目分析

常见问题

常见问题解答


快速入门

安装

npm install -g lore-mcp

CLI 使用

# Analyze current project
lore

# Analyze a specific project
lore ./my-typescript-project

# Check environment and auto-fix
lore doctor --fix

# Watch for changes
lore watch --filter src/

# Diff from last baseline
lore diff

MCP 集成 (Claude Desktop)

将其添加到你的 Claude Desktop 配置中:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Linux: ~/.config/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "lore": {
      "command": "npx",
      "args": ["-y", "lore-mcp"]
    }
  }
}

或者如果已全局安装:

{
  "mcpServers": {
    "lore": {
      "command": "lore",
      "args": ["mcp"]
    }
  }
}

重启 Claude Desktop,然后询问:

"Analyze my project architecture" → LORE 运行 analyze_architecture "What are the circular dependencies?" → LORE 运行 get-violations "Which files are hotspots?" → LORE 运行 get-hotspots "What are the AI recommendations?" → LORE 运行 get-recommendations


架构

lore-mcp/
├── src/
│   ├── algorithm/          # LoreGraph, AST parser, async chain builder, type tracker
│   ├── algorithms/         # AI recommendations, hotspot analysis, entropy, scoring
│   ├── analyzer/           # Dependency parsers, circular deps, direction, imports
│   ├── commands/           # CLI: doctor, diff, ignore, init, status, watch
│   ├── core/               # Plugin system, pipeline runner, graph engine
│   ├── lib/                # Hidden coupling, gaps, middleware chain, ontology
│   ├── mcp/                # MCP server + architecture bridge
│   ├── output/             # Formatter, markdown, SARIF, logger
│   ├── plugins/built-in/   # 13 built-in analysis plugins
│   ├── storage/            # Cache and decision store
│   ├── types/              # TypeScript type definitions
│   ├── cli.ts              # CLI entry point
│   └── index.ts            # MCP server entry point
├── package.json
└── tsconfig.json

插件系统

LORE 使用基于插件的架构 — 每个分析器都是一个插件:

interface LorePlugin {
  name: string;
  version: string;
  analyze(context: AnalysisContext): Promise<PluginResult>;
}

内置插件包括:circular-deps, coupling-matrix, dep-direction, entropy, gaps, hidden-coupling, hotspot, import-impact, middleware-chain, breaking-changes, type-safety, tooling-config, ai-recommendations。


工作原理

  1. 解析 — LORE 使用混合 ts-morph + 正则表达式解析器解析所有 .ts/.tsx 文件

  2. 构建图 — 构建带有类型化边(导入、类型引用、装饰器、异步链、实现、扩展)的依赖图

  3. 运行插件 — 13 个分析器通过插件管道并行运行

  4. 评分 — 计算健康评分(类型安全、工具、架构,整体 0–100)

  5. 推荐 — AI 引擎生成优先级建议(P0 关键 → P3 建议)

  6. 服务 — 结果可通过 CLI 输出、MCP 工具或 SARIF 格式获取


验证

项目

文件数

结果

Express

42

100% 通过

Next.js

68

100% 通过

Fastify

55

100% 通过

NestJS

38

100% 通过

Prisma

45

100% 通过

Zod

35

100% 通过

TypeORM

60

100% 通过

+ 9 更多

所有 16 个测试项目:100% 通过率,零崩溃。


要求

  • Node.js >= 18.0.0

  • TypeScript 项目(分析 .ts 和 .tsx 文件)

  • Git(可选,用于热点分析)

  • ripgrep(可选,用于更快的发现文件)


技术栈

组件

技术

语言

TypeScript 5.5+

AST 解析

ts-morph 21

协议

模型上下文协议 (MCP) SDK 1.0

传输

Stdio (兼容 Claude Desktop / IDE)

验证

Zod schemas

输出

ANSI 终端, Markdown, SARIF


许可证

MIT © 2025 EliotShift


Available Tools

3 tools
get_contextA

Get all architectural decisions for this project. Call this at the START of every session to understand the codebase.

ParametersJSON Schema
NameRequiredDescriptionDefault
categoryNoFilter by category (optional)
queryNoSearch for specific decisions (optional)

TDQS

A3.5/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the tool retrieves decisions but doesn't describe key behaviors: whether it returns all decisions at once or paginates, what format the output is in, if there are rate limits, or authentication requirements. The instruction to call at session start implies it's foundational but lacks operational details.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is highly concise and front-loaded: two sentences with zero waste. The first sentence states the purpose, and the second provides usage guidance, both earning their place without redundancy or fluff.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description is incomplete for a tool that likely returns complex data (architectural decisions). It covers purpose and high-level usage but lacks details on output format, error handling, or behavioral constraints. For a retrieval tool with 2 parameters and no structured output info, this is minimally adequate but has clear gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents both optional parameters ('category' and 'query') with descriptions. The description doesn't add any meaning beyond what the schema provides—it doesn't explain how filtering or searching works, example categories, or query syntax. Baseline 3 is appropriate when the schema handles parameter documentation.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Get all architectural decisions for this project.' It specifies the resource (architectural decisions) and scope (this project). However, it doesn't explicitly differentiate from sibling tools like 'get_gaps' or 'record_decision' beyond implying this is for retrieval rather than recording.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit usage guidance: 'Call this at the START of every session to understand the codebase.' This gives clear context for when to use it (session initialization). However, it doesn't specify when NOT to use it or mention alternatives like the sibling tools, leaving some gaps in comparative guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_gapsB

Find architectural gaps — decisions that were made but may not be fully implemented.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It mentions 'Find architectural gaps' but does not disclose behavioral traits such as what data sources are used, whether it's a read-only operation, potential side effects, or output format. This leaves significant gaps in understanding how the tool behaves.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It is front-loaded and wastes no space, making it easy to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of finding architectural gaps, no annotations, and no output schema, the description is incomplete. It lacks details on how gaps are identified, what the output includes, or any behavioral context, making it insufficient for an agent to fully understand the tool's operation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters with 100% schema description coverage, so the schema fully documents the lack of inputs. The description does not add parameter details, but this is acceptable as there are no parameters to explain, maintaining clarity without redundancy.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('Find') and resource ('architectural gaps'), explaining these as 'decisions that were made but may not be fully implemented.' It distinguishes from siblings like 'get_context' and 'record_decision' by focusing on gap identification rather than context retrieval or decision recording.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance is provided on when to use this tool versus alternatives. The description implies usage for finding architectural gaps but does not specify prerequisites, exclusions, or comparisons to sibling tools, leaving the agent to infer context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

record_decisionA

Record an architectural decision. Call this whenever you make a technical choice that affects the codebase structure.

ParametersJSON Schema
NameRequiredDescriptionDefault
categoryYesCategory: database, authentication, architecture, api, testing, deployment, security, performance, other
decisionYesShort description of the decision made
reasonYesWhy this decision was made
alternativesNoAlternatives that were considered and rejected
constraintsNoConstraints or rules that should not be violated
authorNoWho made this decision

TDQS

A3.5/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It states the action ('record') but doesn't disclose behavioral traits like how the decision is stored, if it's immutable, requires permissions, or has side effects. This is a significant gap for a tool with mutation implications.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the purpose and usage without any wasted words. It's appropriately sized for the tool's complexity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description adequately covers purpose and usage but lacks details on behavior, return values, or error handling. For a mutation tool with 6 parameters, it's minimally viable but has clear gaps in completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents all parameters. The description adds no additional meaning beyond implying the tool is for recording decisions, which aligns with the schema but doesn't enhance parameter understanding. Baseline 3 is appropriate as the schema handles the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('record') and resource ('architectural decision'), specifying it's for technical choices affecting codebase structure. It distinguishes from siblings like 'get_context' and 'get_gaps' by focusing on recording rather than retrieving, but doesn't explicitly differentiate beyond that.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It provides clear context on when to use ('whenever you make a technical choice that affects the codebase structure'), which implicitly distinguishes it from sibling tools that likely retrieve information. However, it lacks explicit exclusions or named alternatives for similar recording tasks.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 3 tool updatesv0.1.5
    • First observedget_context
    • First observedget_gaps
    • First observedrecord_decision

TDQS

A3.7/5.0

Scored across 3 tools

Disambiguation5/5

Each tool has a clearly distinct purpose: get_context retrieves existing decisions, get_gaps identifies implementation issues, and record_decision logs new choices. There is no overlap in functionality, making tool selection straightforward for an agent.

Naming Consistency5/5

All tools follow a consistent verb_noun pattern (get_context, get_gaps, record_decision) with clear, descriptive names. The naming style is uniform and predictable throughout the set.

Tool Count4/5

Three tools are appropriate for the server's purpose of managing architectural decisions, covering retrieval, gap analysis, and recording. While slightly minimal, each tool serves a distinct and necessary function without redundancy.

Completeness4/5

The tool set covers the core lifecycle of architectural decisions: retrieving context, identifying gaps, and recording new decisions. A minor gap exists in updating or deleting decisions, but agents can likely work around this for basic workflows.

Maintenance

ActivityInactive
ResponsivenessSyncing

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    C
    maintenance
    Provides persistent memory for AI coding assistants, storing and retrieving architectural decisions, patterns, and solutions across sessions using semantic search, while also offering git integration for commit messages and code expertise mapping.
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Automatically extracts architectural decisions, patterns, and insights from Git commits to build a local, structured project memory. It exposes this living context to AI tools via MCP, allowing them to understand the historical reasoning and evolution behind your codebase.
    34 npm
    6
    MIT
  • A
    license
    A
    quality
    A
    maintenance
    Local-first memory layer for AI coding agents — captures issues, attempts, fixes, and decisions, and warns at git commit before you repeat a mistake.
    17
    200 PyPI
    859
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Provides AI coding assistants with persistent, context-rich memory of a codebase, including documentation and git history, enabling recall across sessions.
    105
    Apache 2.0