sage-mcp
로컬 지식 베이스 및 코드베이스에 대한 하이브리드 의미론적 검색(밀집 벡터 + BM25)을 제공합니다.
스택: LlamaIndex · Qdrant (로컬 임베디드) · OpenAI 임베딩 · FastMCP
설정
uv venv # creates .venv with Python 3.11 per .python-version
source .venv/bin/activate
uv pip install -e ".[mcp]"
cp config-example.yaml config.yaml
# edit config.yaml — add your KB paths
echo "OPENAI_API_KEY=sk-..." > .envuv는 Python 3.11이 설치되어 있지 않은 경우 자동으로 다운로드합니다.
Related MCP server: RAG In A Box MCP Server
인덱싱
# Index all configured KBs
sage index
# Index one KB only
sage index --kb homelab
# Force full re-index (ignore cache)
sage index --force상태
# Diff KB files vs cache without embedding
sage status
# Single KB
sage status --kb homelab검색
# Hybrid search across all KBs
sage search "pihole DNS configuration"
# Limit to one KB
sage search "pihole" --kb homelab
# Filter by frontmatter fields
sage search "storage" --filter type=lxc --filter status=running
# More results
sage search "networking" --top-k 20
# Dense-only (no BM25)
sage search "pihole" --no-hybrid
# JSON output (for scripting / agent use)
sage search "pihole" --json
# Markdown output with full file paths (default template: blockquote)
sage search "pihole" --markdown
# Markdown table layout
sage search "pihole" --markdown --template table
# Custom Jinja2 template
sage search "pihole" --markdown --template ~/my-template.md.j2마크다운 템플릿
--markdown 플래그는 Jinja2 템플릿을 통해 결과를 렌더링합니다.
두 가지 내장 템플릿이 포함되어 있습니다:
이름 | 설명 |
| 각 청크를 |
| 점수, KB, 전체 파일 경로, 잘린 발췌문이 포함된 간결한 마크다운 표 |
사용자 지정 템플릿을 작성하려면 sage_mcp/templates/에서 내장 템플릿을 복사하고 --template을 통해 파일 경로를 전달하세요. 다음 변수를 사용할 수 있습니다:
변수 | 타입 | 설명 |
|
| 검색 쿼리 |
|
| 각 항목은 |
|
| 필터링된 중복 청크 수 |
각 결과의 text_safe는 줄바꿈을 공백으로 축소하고 파이프 문자를 이스케이프 처리한 청크 텍스트로, 마크다운 표 셀 내부에서 사용하기에 안전합니다. 원본 서식을 유지해야 하는 인용문이나 코드 블록 렌더링에는 text를 사용하세요.
KB 목록
sage list-kbsMCP (AI 에이전트 액세스)
MCP 클라이언트 설정에 추가하세요 (절대 경로 사용):
{
"mcpServers": {
"sage-mcp": {
"command": "/path/to/sage-mcp/.venv/bin/sage-mcp",
"args": ["--config", "/path/to/sage-mcp/config.yaml"]
}
}
}--config 플래그는 선택 사항입니다. 이 플래그가 없으면 서버는 작업 디렉토리에서 config.yaml을 찾습니다.
노출된 도구:
search_kb(query, kb?, top_k?, filter_type?, filter_status?)—{results: [...], duplicates_removed: N}반환list_knowledge_bases()— 구성된 KB 목록 나열
설정
config.yaml을 편집하여 KB를 추가하거나 임베딩 백엔드를 전환하세요. config-example.yaml을 템플릿으로 사용하세요.
Ollama로 전환 (nomic-embed-text가 GPU 가속으로 실행 중인 경우):
embedding:
provider: ollama
model: nomic-embed-text
base_url: http://<ollama-ip>:11434그런 다음 sage index --force를 실행하여 모든 항목을 다시 임베딩하세요.
증분 업데이트
인덱서는 pipeline_cache/<kb-name>/hashes.json에서 파일별 콘텐츠 해시를 추적합니다.
sage index를 다시 실행하면 변경된 파일만 다시 임베딩됩니다. cron이나 inotify 감시에서 실행해도 안전합니다.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- 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/ltaysh0/sage-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
