mcp-histfile

local-only server

The server can only run on the client’s local machine because it depends on local resources.

Integrations

  • Allows searching command history for Git operations, helping users retrieve previously executed Git commands like 'git commit'.

  • Provides access to shell command history, enabling users to search, explore, and retrieve previously executed commands from Bash and other shell environments.

  • Supports reading command history from Zsh, allowing users to access and search their Zsh command history through the MCP interface.

MCPコマンド履歴

MCP(Model Control Protocol)インターフェースを介してシェルコマンド履歴を探索、検索、管理するための強力なツールです。このプロジェクトを使用すると、以前に実行したシェルコマンドに簡単にアクセス、検索、取得できます。

特徴

  • コマンド履歴アクセス: プログラムでシェルのコマンド履歴にアクセスする
  • 強力な検索: テキストクエリを使用してコマンド履歴を検索します
  • 最近実行したコマンド: 最近実行したコマンドを素早く取得します
  • MCP統合:カーソルやその他のMCP互換ツールとシームレスに統合します

インストール

前提条件

  • Python 3.6以上
  • 履歴サポート付きのシェル (Bash、Zsh など)

ソースからインストール

# Clone the repository git clone https://github.com/yourusername/mcp-cmd-history.git cd mcp-cmd-history # Install dependencies pip install -r requirements.txt

使用法

サーバーの起動

python mcp_history_server.py

デフォルトでは、サーバーはHISTFILE環境変数で指定された場所からシェル履歴を読み取るか、 ~/.bash_historyにフォールバックします。

カーソルの使用

サーバーが実行される場合は、Cursor で次の MCP ツールを使用できます。

  1. 最近のコマンドを取得:
    Please show me my most recent shell commands.
  2. コマンド履歴の検索:
    Please search my command history for 'git commit' and show me the results.
  3. 特定のコマンドの取得: 最近のコマンドを検索または一覧表示した後、ID で特定のコマンドを取得できます。

APIリファレンス

MCPツール

  • search_commands(query: str) : シェル履歴内のコマンドを検索する
  • get_recent_commands(limit: int = 10) : 履歴から最新のコマンドを取得します。
  • get_command(command_id: int) : IDで特定のコマンドを取得する

MCPリソース

  • history://recent/{limit} : 最近のコマンドを取得する (HTTP エンドポイント)
  • history://search/{query} : コマンドの検索(HTTPエンドポイント)

貢献

貢献を歓迎します!ガイドラインについてはCONTRIBUTING.mdをご覧ください。

ライセンス

このプロジェクトは MIT ライセンスに基づいてライセンスされています - 詳細についてはLICENSEファイルを参照してください。

-
security - not tested
A
license - permissive license
-
quality - not tested

MCP(Model Control Protocol)インターフェースを介してシェルコマンド履歴を探索、検索、管理するための強力なツールです。このプロジェクトを使用すると、以前に実行したシェルコマンドに簡単にアクセス、検索、取得できます。

  1. Features
    1. Installation
      1. Prerequisites
      2. Install from Source
    2. Usage
      1. Starting the Server
      2. Using with Cursor
    3. API Reference
      1. MCP Tools
      2. MCP Resources
    4. Contributing
      1. License
        ID: f4rg1dkjmw