lore-mcp
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 | 类型安全评分器 | 对你的 |
9 | 隐藏耦合检测器 | 通过共享类型查找隐式依赖 |
10 | AI 建议 | 优先修复建议 (P0–P3) |
11 | 工具配置检查器 | 验证 ESLint、Prettier、tsconfig 设置 |
12 | 破坏性变更检测器 | 标记高风险的弃用模式 |
13 | 架构缺口查找器 | 识别缺失的抽象和模式 |
MCP 集成(8 个工具 + 3 个资源)
将 LORE 暴露给 Claude Desktop、VS Code、Cursor 或任何 MCP 客户端:
工具 | 描述 |
| 全项目分析 — 评分、违规、复杂度、热点 |
| 健康评分:整体、类型安全、工具、架构 |
| 循环依赖、层级违规、架构缺口 |
| AI 改进建议 (P0–P3) |
| Git 变动频繁的文件(红/黄/绿) |
| 香农熵复杂度报告 |
| 文件导入、导出、消费者、复杂度 |
| 深度 TS 分析:框架、层级、异步链、类型流 |
资源 | 描述 |
| 最新分析结果 (JSON) |
| 深度架构图 (JSON) |
| 环境和缓存状态 (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文档
页面 | 描述 |
完整功能概述、徽章和快速入门 | |
npm、npx 和 Docker 安装 | |
所有 CLI 命令:init、status、doctor、watch、diff 等 | |
Claude Desktop、Cursor 和 Windsurf 设置 | |
Express、NestJS、Next.js 等的真实项目分析 | |
常见问题解答 |
快速入门
安装
npm install -g lore-mcpCLI 使用
# 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 diffMCP 集成 (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。
工作原理
解析 — LORE 使用混合 ts-morph + 正则表达式解析器解析所有
.ts/.tsx文件构建图 — 构建带有类型化边(导入、类型引用、装饰器、异步链、实现、扩展)的依赖图
运行插件 — 13 个分析器通过插件管道并行运行
评分 — 计算健康评分(类型安全、工具、架构,整体 0–100)
推荐 — AI 引擎生成优先级建议(P0 关键 → P3 建议)
服务 — 结果可通过 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
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
AlicenseNot gradedqualityCmaintenanceProvides 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- AlicenseNot gradedqualityDmaintenanceAutomatically 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.417MIT
- AlicenseAqualityAmaintenanceLocal-first memory layer for AI coding agents — captures issues, attempts, fixes, and decisions, and warns at git commit before you repeat a mistake.15665MIT
- AlicenseNot gradedqualityDmaintenanceProvides AI coding assistants with persistent, context-rich memory of a codebase, including documentation and git history, enabling recall across sessions.105Apache 2.0
Related MCP Connectors
AI Agent with Architectural Memory. Impact analysis (free), tests and code from the graph (pro).
Deterministic context layer for your codebase: change impact, blast radius, answers with receipts.
Give your AI agent a persistent map of your project's structure, dependencies, and bugs.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/EliotShift/lore-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server