Skip to main content
Glama
k-rister

ephemeral-buffer

by k-rister

Ephemeral Buffer MCP Server (ephemeral-buffer)

一个用于 AI 编码助手(Claude Code、Antigravity、Cursor 等)的临时内存命令输出捕获与混合搜索引擎(BM25 + 语义嵌入)。


🎯 解决的问题

当编码代理运行生成大量输出的命令时(数千行的构建日志、测试运行、堆栈跟踪、JSON 转储),代理会面临两种失败模式:

  1. 上下文污染: 摄入数兆字节的原始文本会突破 token 限制并降低模型推理能力。

  2. 盲目的 Bash 过滤: 代理浪费多轮时间运行 headtailgrepawk 来猜测错误模式。

Related MCP server: Qurio MCP Server

💡 解决方案

ephemeral-buffer 提供了一个带有双重混合索引的临时内存环形缓冲区:

  • BM25 词法搜索(SQLite FTS5): 用于错误码的精确匹配(NullPointerExceptionECONNREFUSEDexit 137、HTTP 502)。

  • 密集语义向量搜索(FastEmbed ONNX): 用于模糊概念查询("数据库连接池在哪里失败了?""为什么身份验证失败了?")。

  • 倒数排名融合(RRF): 融合词法和语义排名以实现高精度检索。

  • 环形缓冲区淘汰: 仅保留最近 $N$ 次捕获(默认:10),确保零持久存储累积或内存泄漏。


🏗 架构与流程

flowchart TD
    subgraph Ingestion["1. Ingestion Paths"]
        A["CLI Pipe: command 2>&1 | agy-cap"] --> D["Unix Socket (/tmp/ephemeral_buffer.sock)"]
        B["Agent Tool: execute_and_capture(cmd)"] --> E["Ephemeral Ring Buffer Engine"]
        C["Agent Tool: capture_text / capture_file"] --> E
        D --> E
    end

    subgraph Indexing["2. Dual Hybrid Indexing"]
        E --> F["SQLite FTS5 (BM25 Lexical)"]
        E --> G["FastEmbed ONNX (Dense Vectors)"]
    end

    subgraph Querying["3. Agent Query & Retrieval"]
        F & G --> H["Reciprocal Rank Fusion (RRF)"]
        H --> I["search_capture(query, mode='hybrid')"]
        I --> J["Precise Context Chunk + Line Numbers"]
    end

🚀 使用方法

1. 从终端(通过 agy-cap 的 CLI 管道)

您可以将命令输出直接管道传输到正在运行的 MCP 服务器:

# Pipe any command output into the buffer
pytest -v 2>&1 | agy-cap --label "pytest run"

# Or wrap command execution
agy-cap --label "backend build" -- cargo build --verbose

2. 通过 MCP 工具从 AI 代理使用

代理可以访问以下工具:

工具

用途

execute_and_capture(command, label)

执行 shell 命令,将所有输出捕获到缓冲区,并仅向代理上下文返回紧凑的诊断摘要(退出码、行数、信号)。

capture_text(content, label)

将文本直接摄入缓冲区。

capture_file(file_path, label)

从磁盘摄入日志/输出文件。

search_capture(query, mode, top_k, context_lines)

对捕获的输出进行混合/BM25/语义搜索。返回匹配的块以及周围的上下文行和精确行号。

get_capture_slice(start_line, end_line)

检索精确的行范围以检查完整的堆栈跟踪或日志。

get_capture_summary(capture_id)

诊断概览(行数、错误信号、head/tail 预览)。

list_captures()

列出环形缓冲区中的活动捕获。

clear_captures(capture_id)

清除缓冲区。


🛠 测试服务器

运行测试套件:

./venv/bin/python test_engine.py
A
license - permissive license
Not graded
quality - not tested
C
maintenance

Maintenance

UpdatingMaintainers
UpdatingResponse time
Release cycle
0Releases (12mo)
Commit activity

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

  • A
    license
    A
    quality
    D
    maintenance
    Provides persistent memory for AI agents using hybrid search (vector embeddings + BM25) with neural reranking, enabling storage and retrieval of insights, debugging solutions, and patterns across coding sessions.
    8
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI coding assistants to search and retrieve information from a locally ingested knowledge base using hybrid search, grounded in user-curated documentation.
    17
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables AI coding agents to retrieve and manage code context with hybrid search, project memory, and observability via MCP tools.
    29
    MIT
  • A
    license
    A
    quality
    A
    maintenance
    Provides persistent, searchable memory across AI coding agent and chat history (Claude Code, Codex, Gemini CLI, ChatGPT, and more) via retrieval-augmented generation, enabling semantic and hybrid search to retain context across sessions.
    5
    5
    MIT

View all related MCP servers

Related MCP Connectors

  • Search your knowledge bases from any AI assistant using hybrid RAG.

  • Long-term memory for AI assistants. Hybrid retrieval, query expansion, auto-topics.

  • Token-efficient search for coding agents over public and private documentation.

View all MCP Connectors

Latest Blog Posts

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/k-rister/ephemeral-buffer-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server