Language Server Protocol (LSP)를 사용하여 AI 코딩 에이전트에게 멀티홉 호출 그래프, 심볼 컨텍스트 및 영향 분석 기능을 제공합니다.
다른 이름 ip2k/rarefaction, rarefaction-lsp-mcp
- 스타
- 0
- Tools
- 3
- 다운로드, 30일
- —
- 최신 버전
- 0.4.3
- 마지막 커밋
- 2026년 11월 8일
- 라이선스
- GPL-3.0
Rarefaction MCP란?
Rarefaction은(는) MCP server입니다. Language Server Protocol (LSP)를 사용하여 AI 코딩 에이전트에게 멀티홉 호출 그래프, 심볼 컨텍스트 및 영향 분석 기능을 제공합니다. 3개 도구를 제공합니다. 예: orient, scope, status.
프로젝트 README에서 생성된 요약
Rarefaction MCP server 정보
Claude Code 또는 Codex와 같은 AI 코딩 에이전트를 사용하는 개발자는 Rarefaction을 통해 Language Server Protocol 기반의 깊은 시맨틱 컨텍스트를 에이전트에 제공할 수 있습니다. 에이전트가 전체 파일을 읽거나 grep으로 연결 관계를 찾도록 강제하는 대신, 이 MCP server는 단일 요청으로 특정 심볼에 대한 제한된 멀티홉 호출 그래프를 제공합니다. 이 방식은 필요한 시그니처, 문서, 본문 및 관계 데이터만 전달하여 토큰 사용량을 크게 줄여줍니다.
이 서버는 stdio를 통해 작동하며 Swift, Rust, C/C++, TypeScript/JavaScript, Python, WebAssembly text를 포함한 다양한 언어 프로필을 지원합니다. 주요 도구로는 인덱스 최신 상태와 사용 가능한 프로필을 확인하는 status, 심볼의 호출자, 피호출자 및 관련 테스트를 가져오는 orient, 변경 시 영향을 받을 가능성이 있는 파일을 식별하는 scope 등 세 가지를 제공합니다. 기존 언어 서버와 직접 통합되므로 AI에 제공되는 정보가 정확하며 코드베이스의 실제 구조를 반영합니다.
활용 사례
- 1코드 영향 분석특정 메서드를 호출하는 함수가 무엇인지, 해당 메서드 수정 시 무엇이 깨질 수 있는지 에이전트에게 확인합니다.
- 2테스트 실행 최적화특정 심볼에 실제로 도달하는 특정 테스트만 식별하여 실행합니다.
- 3생소한 코드베이스 탐색정확한 파일 위치나 정규화된 이름을 사용하여 추측 없이 심볼을 찾습니다.
- 4AI 토큰 소비 감소에이전트가 여러 개의 대형 파일을 읽게 하는 대신, 작고 제한된 응답을 제공합니다.
프로젝트의 README를 바탕으로 작성되었습니다. 모든 활용 사례는 해당 내용의 인용문과 대조하여 확인합니다.
Rarefaction MCP 설치 방법
형식 확인: 2026년 11월 10일Cursor에 추가Goose에 추가Claude Code에 Rarefaction MCP 설치
$ claude mcp add rarefaction -- npx -y rarefaction-lsp-mcpCursor에 Rarefaction MCP 설치
~/.cursor/mcp.json
{
"mcpServers": {
"rarefaction": {
"command": "npx",
"args": [
"-y",
"rarefaction-lsp-mcp"
]
}
}
}VS Code에 Rarefaction MCP 설치
.vscode/mcp.json
{
"servers": {
"rarefaction": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"rarefaction-lsp-mcp"
]
}
}
}VS Code CLI에 Rarefaction MCP 설치
$ code --add-mcp '{"name":"rarefaction","type":"stdio","command":"npx","args":["-y","rarefaction-lsp-mcp"]}'Claude Desktop에 Rarefaction MCP 설치
claude_desktop_config.json
{
"mcpServers": {
"rarefaction": {
"command": "npx",
"args": [
"-y",
"rarefaction-lsp-mcp"
]
}
}
}Codex에 Rarefaction MCP 설치
$ codex mcp add rarefaction -- npx -y rarefaction-lsp-mcpCodex config.toml에 Rarefaction MCP 설치
~/.codex/config.toml
[mcp_servers.rarefaction] command = "npx" args = ["-y", "rarefaction-lsp-mcp"]
Gemini CLI에 Rarefaction MCP 설치
$ gemini mcp add -s user rarefaction npx -- -y rarefaction-lsp-mcpGemini settings.json에 Rarefaction MCP 설치
~/.gemini/settings.json
{
"mcpServers": {
"rarefaction": {
"command": "npx",
"args": [
"-y",
"rarefaction-lsp-mcp"
]
}
}
}Rarefaction MCP 도구 3
README에서 감지됨orientscopestatus
| orient | — | |
| scope | — | |
| status | — |
자동 검사
2026년 11월 14일에 실행됨전체 보고서 →자동 검사를 통과했습니다. 이는 보안 감사가 아닙니다. 코드를 직접 읽고 서버에 필요한 최소한의 권한만 부여하십시오. 검사 방식
- 소스 저장소 연결 및 접근 가능ip2k/rarefaction is public and reachablegithub.com/ip2k/rarefaction ↗통과
- 패키지가 이 저장소를 소스로 명시rarefaction-lsp-mcp names ip2k/rarefaction as sourcenpmjs.com/package/rarefaction-lsp-mcp ↗통과
- 빌드 출처(Sigstore 증명)Sigstore attestation for rarefaction-lsp-mcpnpmjs.com/package/rarefaction-lsp-mcp/v/0.4.3#provenance ↗통과
- 오픈 소스 라이선스 (OSI)GPL-3.0spdx.org/licenses/GPL-3.0.html ↗통과
- 최근 1년 내 커밋 또는 릴리스Last commit or release 2026-11-08github.com/ip2k/rarefaction ↗통과
- OpenSSF Scorecard검사되지 않음
- 패키지 이름이 인기 패키지와 유사하지 않음No popular package one edit away from rarefaction-lsp-mcp통과
- 패키지 및 해당 종속성에 중요한 보안 권고 없음12 resolved dependencies checked; no critical advisoryosv.dev ↗통과
- 모델에 대한 숨겨진 지침 없음3 tool descriptions and the README read; no override phrases, credential paths or hidden characters통과
- 파괴적인 도구에 라벨 표시됨No tool named like delete, drop or exec통과
- 원격 엔드포인트가 MCP 핸드셰이크에 응답검사되지 않음
README
GitHub에서 보기Rarefaction — LSP call graph MCP server for AI coding agents
Rarefaction is a Model Context Protocol (MCP) server that gives a coding agent the call graph and code context for one symbol straight from the project's language server (Language Server Protocol, LSP). Ask about a function, method or type and get, in one call: its signature and doc, its body, who calls it (tests marked), what it calls, who implements it, the tests that reach it and the short list of files a change can affect. The agent reads that instead of opening whole files and grepping, which keeps its context window small and spends fewer tokens on exploration.
Works with Claude Code, Codex and any MCP client over stdio. Profiles cover Swift, Rust, C/C++, TypeScript/JavaScript, Python and WebAssembly text (WAT).
Run against the bundled TypeScript fixture (fixtures/SampleTypeScript):
# scale — engine.ts:2:17
```
function scale(value: number): number
```
Double one input sample.
## Callers (2, 1 in tests)
- render — render.ts:2 (calls at 3)
- · testScale — engine.test.ts:2 (calls at 3) [test]
## Tests that reach it (1)
- testScale — engine.test.ts:2
Run only these:
```
npm test -- "engine.test.ts"
```
## Live files (3 of 3)
- engine.test.ts
- engine.ts
- render.ts
_11 LSP requests, 6430 ms (includes language-server cold start); index on-open_
Once the language server has indexed, a call takes a fraction of a second (median 80 ms on ripgrep, 220 ms on the 800-file IronRDP workspace); the server's cold start, 6–16 s on those projects, is paid once per session.
What it helps with
- Reducing token usage in AI coding agents. One bounded answer replaces several whole-file reads and searches. Measured on 50 real commits in ripgrep and IronRDP, the answer was a median 6–7% of the bytes of reading the files it names once. How much that saves in a whole agent session is not measured yet; see docs/measurement.md, including where the live set falls short.
- Call graph and impact analysis. "What calls this function, and what would break if I change it?" By default two levels of callers and one of callees, plus implementations and type hierarchy, each bounded and marked when truncated.
- Choosing which tests to run. Tests that reach the symbol, with a "run only these" command for the project's test runner.
- Orientation in an unfamiliar codebase. Bare names, qualified names or
exact
path:line:columnpositions; ambiguity comes back as a list of exact positions rather than a guess. - Honest answers about coverage. Stale indexes, servers still indexing and servers without call hierarchy are reported in the answer, not hidden.
Why an MCP server for LSP call graphs
Language servers already know the call graph precisely — that is what "find references" and "call hierarchy" are. Editors and LSP tools expose them one hop at a time, so an agent pays a tool call and a round of context per hop. An agent needs the closure: everything within a couple of hops, filtered to the project, with the tests picked out, small enough to read in one go. That composition is what this server does. It is deliberately language-agnostic: the core speaks LSP and nothing else, and everything a language needs is a small profile.
How it relates to nearby tools:
| approach | what the agent gets |
|---|---|
| reading files and grep | whole files; text matches, not calls |
| per-request LSP tools (definition, references, call hierarchy) | precise answers, one hop per tool call |
| Serena | symbol navigation and semantic editing over LSP; works well alongside this |
| Rarefaction | the bounded multi-hop call graph, tests and live files for one symbol in one call |
Install
Requires Node 22.22.2 or later; used on macOS and Linux (CI runs on Ubuntu),
untested on Windows. The TypeScript and Python language servers
are bundled. Install the others you need and put them on the PATH your
client launches with — see Languages and configuration.
Swift needs macOS with Xcode (or a Swift toolchain with sourcekit-lsp).
As a plugin (Claude Code and Codex)
The plugin bundles the server, launched with npx -y rarefaction-lsp-mcp,
and an orient-first skill that tells the agent to call status and
orient before reading whole files, and scope before editing.
# Claude Code
claude plugin install rarefaction --marketplace ip2k/rarefaction
# Codex
codex plugin marketplace add ip2k/rarefaction
codex plugin add rarefaction@rarefaction
In a Claude Code session, /plugin install rarefaction --marketplace ip2k/rarefaction
does the same. Restart or reconnect the session afterwards.
As an MCP server
claude mcp add --scope user --transport stdio rarefaction -- npx -y rarefaction-lsp-mcp
codex mcp add rarefaction -- npx -y rarefaction-lsp-mcp
Add --env PATH="$HOME/.local/bin:$HOME/.cargo/bin:$PATH" before the --
if rust-analyzer or wat_server live outside the client's PATH. The tools
are status, orient and scope (in Claude Code, mcp__rarefaction__status,
mcp__rarefaction__orient and mcp__rarefaction__scope); all three are
read-only, so you can allow them in your permissions to avoid repeated
prompts. For Codex, give the first index time
in ~/.codex/config.toml:
[mcp_servers.rarefaction]
startup_timeout_sec = 20
tool_timeout_sec = 180
The server takes --root <path> and --profile <id>. Explicit --root takes
precedence over Claude Code's CLAUDE_PROJECT_DIR, then the working
directory. Leave both unset in a user-wide registration so every project can
use all supported profiles. See the MCP documentation for
Claude Code and
Codex.
From a clone
To run your own changes, build and register the compiled entry instead:
git clone https://github.com/ip2k/rarefaction.git
cd rarefaction
npm ci && npm run build
claude mcp add --scope user --transport stdio rarefaction -- "$(command -v node)" "$PWD/dist/index.js"
Rebuild after changing the server, then restart or reconnect (/mcp) the
client session.
Check it works
Start a new chat in a project and ask the agent to call status, then
orient on a symbol you know. status.root should match the project and the
selected entry in status.profiles should have ok: true. One registration
serves all supported languages; each language server starts lazily.
Agent guidance
The plugin's skill covers this. Without the plugin, add this to ~/.claude/CLAUDE.md, AGENTS.md or a
project instruction file:
Use rarefaction's status tool once in a new project, then orient on the relevant symbol before reading whole files, and scope on a symbol before editing it (advisory: also look outside the files it lists). In mixed repositories pass profile or a workspace-relative path:line:column, and pass project for a nested package that is not a workspace member. Start with the default graph bounds; expand only when necessary. Follow freshness and coverage advice, and inspect FFI/generated bindings separately when relevant.
Xcode projects
Xcode projects need a build-server config so sourcekit-lsp gets compiler flags (SwiftPM packages need nothing):
brew install xcode-build-server
cd /path/to/App && xcode-build-server config -project App.xcodeproj -scheme App
echo buildServer.json >> .gitignore
Then build once in Xcode or with xcodebuild; the index is only as fresh as
the last build, and orient says so when a source file is newer. Saved
source edits are sent to open LSP documents before later queries, but Xcode
projects still need a new build to refresh their cross-file index.
Tools
| tool | what |
|---|---|
orient |
{symbol, profile?, project?, up?, down?, max_nodes?, include_body?, max_body_lines?} — the bundle above. symbol may be updateLocation, Engine.updateLocation, or path/File.swift:204:10. Ambiguous names come back as an error listing exact positions. |
scope |
{symbol, profile?, project?, up?, down?, max_nodes?} — the working set for a change to that symbol: the call-graph files from orient plus files that have historically changed in the same commits as the symbol's file or the call-graph files (from git history), each with its reason. Advisory: it lists what to read and check, not what is safe to ignore (measured coverage). |
status |
{profile?, project?} — what the server can see: the profile inventory and which one is selected, prerequisites such as a build-server config, index freshness, and which LSP features the server offers. Call this first if orient finds nothing. |
Planned: impacted_tests (the upward walk restricted to tests, as a
runnable selection).
Languages and configuration
| Profile | Language server | Prerequisites / scope |
|---|---|---|
swift |
sourcekit-lsp | Xcode or a Swift toolchain; SwiftPM, or Xcode with a build-server config |
rust |
rust-analyzer | Cargo.toml or rust-project.json; embedded/no_std/Wasm target settings supported; a project that pins a toolchain needs rustup component add rust-analyzer --toolchain <channel> (status says so) |
c |
clangd | C/C++; compile_commands.json or compile_flags.txt for accurate include paths and defines |
typescript |
typescript-language-server | TypeScript/JavaScript, TSX/JSX; server and TypeScript bundled as dependencies |
python |
Pyright | Python and stubs; bundled; configure interpreter/import paths for your environment |
wasm |
wat_server | WebAssembly .wat text; install the prebuilt server on PATH |
The server probes each language server's capabilities. When call hierarchy
is absent, orient reports references and enclosing symbols, without
claiming those references are calls. Native Rust/C sources compiled to
WebAssembly use rust/c; .wasm binaries need disassembly to .wat.
WAST test scripts, vendor assembly, indirect runtime dispatch and
cross-language FFI edges are not indexed as a unified graph.
Optional .rarefaction.json in the workspace root configures each profile.
Paths in project, profile root, and relative position queries are
relative to that workspace. A position query without project is answered
from the outermost Cargo workspace that takes the file's crate in (as a
member, a package.workspace pointer or a path dependency of the root
package), else from the nearest supported project marker. When that leaves
part of an enclosing project out, the answer carries a warning that says so
and which project to pass. TypeScript is the exception: the TypeScript
language server answers one tsconfig.json project at a time, so in an npm,
yarn or pnpm workspace with a tsconfig.json per package, callers in other
packages are not listed, with or without project, and the warning says
that too. The search stops at a directory holding .git, so a position in a
git worktree, submodule or other checkout nested inside the workspace is
answered from that checkout alone; give positions its path as a prefix, and
name it in project for bare names. Bare names in mixed workspaces need
profile or a configured default_profile:
{
"default_profile": "typescript",
"profiles": {
"rust": {
"root": "firmware/rust",
"initializationOptions": {
"cargo": { "target": "thumbv7em-none-eabihf", "features": ["board"] }
}
},
"c": { "args": ["--background-index", "-j=2", "--compile-commands-dir=/absolute/local/build"] },
"python": {
"initializationOptions": { "python": { "pythonPath": "/absolute/project/.venv/bin/python" } }
}
}
}
command, args, env, and initializationOptions may override each
profile's launch settings; initialization objects merge recursively.
args replaces the defaults. Rust cargo checks, build scripts and proc
macros are disabled by default to avoid incidental compilation; enable them
explicitly when your project needs generated/expanded code. After changing
this configuration, restart the MCP connection. Missing executables appear
in status with setup advice.
Graph output defaults to 50 nodes per direction, two caller levels, one
callee level and 80 body lines. Use max_nodes, up, down, or
include_body: false to adjust context size. Truncation is explicit. Name
lookup without a workspace index falls back to scanning at most 200 source
files; use an exact position or a smaller project when needed.
See embedded C, JieLi and WebAssembly setup for analysis compilation databases and target limitations.
Serena alongside Rarefaction
Serena complements this server with symbol navigation, diagnostics and semantic edits. docs/serena.md covers a pinned installation, a WAT adapter, project language settings, limitations and verification.
Privacy
Rarefaction runs entirely on your machine. It reads your project's files
and talks to language servers over local stdio; it makes no network
requests and collects no telemetry. The language servers it launches
behave as they do in your editor (for example, rust-analyzer runs
cargo metadata, which may fetch crate indexes). npx downloads the
package from npm on first use.
Development
npm ci && npm run build
npm test # unit + real LSP integration; external servers skipped if absent
claude plugin validate . # plugin and marketplace manifests
node scripts/verify-codex.mjs # exercise the registered MCP through Codex, no model turn
npx tsx scripts/try.ts --root fixtures/SampleTypeScript orient '{"symbol":"scale"}'
The logo and icon (Rosé Pine Moon) come from python3 tools/render_logo.py;
the README diagrams (Dawn for light, Moon for dark) from python3 tools/render_diagrams.py. The fixtures under fixtures/ are small
synthetic projects, one per language. CI runs the suite with clangd and
rust-analyzer installed. The Release workflow (a v* tag push, or "Run
workflow" on main) checks that every version field agrees (package.json,
server.json, both plugin manifests), publishes to npm and the MCP
Registry as
io.github.ip2k/rarefaction-lsp-mcp, then creates the GitHub release.
docs/measurement.md states the thresholds the project holds itself to;
docs/decisions.md records why things are the way they are.
Licence
Copyright (C) 2026 Sean (ip2k).
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. It is distributed WITHOUT ANY WARRANTY; see LICENSE for the full text.
Rarefaction MCP 질문
Rarefaction MCP를 Claude Code에 추가하려면 어떻게 하나요?
터미널에서 claude mcp add rarefaction -- npx -y rarefaction-lsp-mcp를 실행합니다. 모든 프로젝트에서 사용할 수 있게 하려면 --scope user를 추가합니다.
Rarefaction MCP를 Cursor에 추가하려면 어떻게 하나요?
~/.cursor/mcp.json를 열고 mcpServers 아래에 서버를 추가합니다. 위 설치 섹션에 표시된 Cursor 구성을 사용합니다.
Rarefaction MCP는 어떤 도구를 제공하나요?
3개 도구를 제공합니다. 예: orient, scope, status.
orient 도구는 어떤 정보를 제공하나요?
심볼의 시그니처, 문서, 본문, 호출자(테스트 포함), 피호출자, 구현체 및 변경 시 영향을 받는 파일 목록을 반환합니다.
지원되는 프로그래밍 언어는 무엇인가요?
Swift, Rust, C/C++, TypeScript/JavaScript, Python 및 WebAssembly text (WAT)를 지원합니다.
Rarefaction은 토큰 사용량을 어떻게 줄여주나요?
에이전트가 전체 파일을 읽거나 여러 번 검색할 필요 없이, 필요한 컨텍스트만 포함된 단일 제한 응답을 제공합니다.
Swift를 사용하려면 별도의 설치가 필요한가요?
네, Swift는 Xcode가 설치된 macOS 또는 sourcekit-lsp가 포함된 Swift 툴체인이 필요합니다.