ScalaSemantic
Maven Central
Release
CI
Docs
License: MIT
ScalaSemantic은 AI 코딩 에이전트에게 컴파일러가 생성한 SemanticDB로부터 컴파일러가 해석한 Scala 사실(facts) — 정확한 심볼(symbols), 타입(types), 상속(inheritance), 사용처(usages), implicits, 호출 경로(call paths) — 를 제공하는 MCP 서버입니다. 에이전트들은 소스 텍스트를 검색(grepping)하는 대신, 컴파일러가 이미 알고 있는 정보를 질의합니다.
Scala 2.13.* 및 3.., 모든 sbt/Mill/Gradle 프로젝트, 그리고 모든 MCP 호환 에이전트 (Claude Code, Codex, Gemini CLI, Cline, Roo Code, Continue…)와 함께 작동합니다.
왜 필요한가 (Why)
에이전트들은 텍스트를 검색하여 Scala를 탐색합니다. 이 방식은 이름이 변경된 import, re-exports, 추론된 타입(inferred types), 그리고 호출된 given들을 놓치며, 컨텍스트를 잘못된 결과로 범람시킵니다. ScalaSemantic은 컴파일러가 이미 해석한 것에서 답변을 제공합니다:
agent → find_usages("com.acme.Repo#save().")
← 4 exact call sites (uri:line:col), no comments, no same-named look-alikes
읽고 필터링해야 할 수십 개의 텍스트 일치 항목 대신, 간결하고 정확한 하나의 답변을 얻을 수 있습니다. 심볼 관련 질문의 경우 토큰 사용량이 약 90% 적은 것으로 측정되었습니다 (자세히 보기 benchmarks).
간편 설치 방법 (Quick setup)
java만 필요합니다. 하나의 명령으로 서버를 사용자에게 등록하여, 해당 머신에 있는 모든 Scala 프로젝트가 이를 사용할 수 있게 합니다:
curl -fsSL https://raw.githubusercontent.com/MercurieVV/ScalaSemantic/master/scripts/scalasemantic-mcp.sh | sh
프로젝트 루트에서 --project 옵션과 함께 실행하면 SemanticDB를 활성화하고, 에이전트 스티어링 파일(agent steering files)을 작성하며, Claude 가드 훅(Claude guard hook)을 설치할 수도 있습니다. 재실행은 안전합니다:
curl -fsSL https://raw.githubusercontent.com/MercurieVV/ScalaSemantic/master/scripts/scalasemantic-mcp.sh | sh -s -- --project
powershell
iwr https://raw.githubusercontent.com/MercurieVV/ScalaSemantic/master/scripts/scalasemantic-mcp.ps1 -OutFile scalasemantic-mcp.ps1; .\scalasemantic-mcp.ps1 setup
Launcher, plain jar 및 로깅: 통합 (Integration). 선택적 가드 훅 (guard hook)은 .scala 파일에 대한 grep/cat/Read를 거부하고 에이전트를 MCP 도구로 안내합니다. 이는 기본적으로 설치되지 않습니다.
| 그룹 | 도구 |
|---|
| Find | find_symbol · find_usages · find_overloads · search_text |
| ... | |
| What each does, 그리고 심볼 문법: 도구 참조 (Tool reference). | |
셸 훅 또는 MCP 세션을 열어둘 수 없는 스크립트의 경우, scalasemantic-mcp call <tool> '<json-args>' [root] [classpath]를 실행하여 하나의 도구를 실행하고 그 JSON 결과를 출력합니다.
SemanticDB 대 grep
문서화 (Documentation)
전체 문서: mercurievv.github.io/ScalaSemantic
라이선스 (License)
MIT