Skip to main content
Glama

CodeSavant

MCP-コードサヴァント

CodeSavant は現在進行中のプロジェクトです。

CodeSavantは、コード操作、実行、バージョン管理機能を提供するModel Context Protocol(MCP)サーバーです。AIアシスタントが変更履歴を維持しながらコードの読み取り、書き込み、実行を行うことを可能にします。

特徴

  • 行単位の操作でコードファイルを読み書きする
  • 複数のプログラミング言語(Python、Node.js)でコードを実行する
  • 制御された環境でシェルコマンドを実行する
  • バージョン管理でコードの変更を追跡および管理する
  • コードファイル内を検索
  • 以前のバージョンのコードに戻す

インストール

  1. リポジトリをクローンします。
git clone https://github.com/twolven/mcp-codesavant.git cd mcp-codesavant
  1. 必要な依存関係をインストールします。
pip install -r requirements.txt
  1. Claude Desktop の config.json にサーバー構成を追加します。
{ "mcpServers": { "codesavant": { "command": "python", "args": ["path/to/codesavant.py"] } } }

ディレクトリ構造

サーバーは次のディレクトリ構造を作成および管理します。

workspaces/ ├── project1/ │ ├── .code_history.json │ └── [code files] ├── project2/ │ ├── .code_history.json │ └── [code files] └── ...

ツールリファレンス

詳細な使用方法

1. コードファイルを読む

コード ファイルの内容を読み取り、オプションで特定のセクションを検索します。

{ "project": "string", // Project name "path": "string", // Path to file relative to project workspace "search": "string" // (Optional) Text/pattern to search for in file }

応答:

{ "success": true, "timestamp": 1234567890, "data": { "content": "string", // File content "start_line": number, // (Only if search used) Starting line of found section "end_line": number // (Only if search used) Ending line of found section } }
2. コードファイルの書き込み

コード ファイル内の特定の行を書き込むか更新します。

{ "project": "string", // Project name "path": "string", // Path to file relative to workspace "content": "string", // Content to write (just the lines being changed) "start_line": number, // Starting line number for the change "end_line": number // (Optional) Ending line number for the change }

応答:

{ "success": true, "timestamp": 1234567890, "data": { "diff": { "changes": [ // List of changes made [string, number, number, number, number] // (type, old_start, old_end, new_start, new_end) ], "timestamp": number // When the change was made } } }
3. コード履歴を取得する

コード ファイルの変更履歴を取得します。

{ "path": "string" // Path to file relative to workspace }

応答:

{ "success": true, "timestamp": 1234567890, "data": { "history": [ { "changes": [ // List of changes made [string, number, number, number, number] ], "timestamp": number } ] } }
4. コードコマンドの実行

コード関連のシェル コマンドを実行します。

{ "command": "string", // Shell command to execute "timeout": number // (Optional) Command timeout in seconds (default: 30) }

応答:

{ "success": true, "timestamp": 1234567890, "data": { "state": "success|error|timeout|cancelled", "output": "string", // Command output "error": "string", // Error message if any "runtime": number, // Execution time in seconds "exit_code": number // Command exit code } }
5. 実行コード

指定された言語でコードを実行します。

{ "code": "string", // Code to execute "language": "string", // Programming language ("python" or "node") "timeout": number // (Optional) Execution timeout in seconds (default: 30) }

応答:

{ "success": true, "timestamp": 1234567890, "data": { "state": "success|error|timeout|cancelled", "output": "string", // Code execution output "error": "string", // Error message if any "runtime": number, // Execution time in seconds "exit_code": number // Execution exit code } }
6. バージョンに戻す

コード ファイルを特定のバージョンに戻します。

{ "path": "string", // Path to file relative to workspace "timestamp": number // Timestamp of version to revert to }

応答:

{ "success": true, "timestamp": 1234567890, "data": { "diff": { "changes": [ // List of changes made [string, number, number, number, number] ], "timestamp": number // When the reversion was made } } }
7. コードファイルの行を読み取る

コード ファイルから特定の行を読み取ります。

{ "project": "string", // Project name "path": "string", // Path to file relative to project workspace "start_line": number, // Starting line number to read "end_line": number // (Optional) Ending line number to read }

応答:

{ "success": true, "timestamp": 1234567890, "data": { "content": "string" // Content of the specified lines } }

エラー処理

サーバーは、次の形式で詳細なエラー応答を提供します。

{ "success": false, "timestamp": 1234567890, "data": null, "error": "Error message" }

エラーの種類は次のとおりです:

  • CodeFileError : ファイル操作エラー
  • CodeValidationError : コード検証エラー
  • CodeExecutionError : コード実行エラー

言語サポート

現在コード実行にサポートされている言語:

  • Python (システム Python インタープリタを使用)
  • Node.js (node コマンドを使用)

各言語の実行では、ワークスペース ディレクトリに一時ファイルが作成され、適切なインタープリターで実行されます。

貢献

  1. リポジトリをフォークする
  2. 機能ブランチを作成する
  3. 変更をコミットする
  4. ブランチにプッシュする
  5. 新しいプルリクエストを作成する

ライセンス

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

著者

トッド・ウルブン - ( https://github.com/twolven )

謝辞

  • Anthropicのモデルコンテキストプロトコル(MCP)を使用して構築
  • アントロピックのクロードとの使用のために開発されました
-
security - not tested
A
license - permissive license
-
quality - not tested

local-only server

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

コード操作、実行、バージョン管理機能を提供します。AIアシスタントは、変更履歴を維持しながらコードの読み取り、書き込み、実行を行うことができます。

  1. 特徴
    1. インストール
      1. ディレクトリ構造
        1. ツールリファレンス
          1. 詳細な使用方法
        2. エラー処理
          1. 言語サポート
            1. 貢献
              1. ライセンス
                1. 著者
                  1. 謝辞

                    Related MCP Servers

                    • A
                      security
                      A
                      license
                      A
                      quality
                      Shell and file edit capabilities tightly coupled to provide a powerful coding experience. You can work with different modes: architect and code-writer for separate plan and implementation phase. You can get it to invoke any cli command, e.g., compiling, type checking, linting, github cli, python
                      Last updated -
                      6
                      554
                      Python
                      Apache 2.0
                      • Apple
                      • Linux
                    • -
                      security
                      A
                      license
                      -
                      quality
                      Transform your local machine into a powerful code command center. Automate file handling, run terminal commands, and leverage AI to enhance your development workflows—all securely and instantly, without cloud latency.
                      Last updated -
                      11
                      Python
                      MIT License
                    • -
                      security
                      F
                      license
                      -
                      quality
                      A powerful interface for extending AI capabilities through remote control, calculations, email operations, knowledge search, and more.
                      Last updated -
                      34
                      Python
                    • -
                      security
                      F
                      license
                      -
                      quality
                      A personal AI coding assistant that connects to various development environments and helps automate tasks, provide codebase insights, and improve coding decisions by leveraging the Model Context Protocol.
                      Last updated -
                      Python
                      • Apple
                      • Linux

                    View all related MCP servers

                    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/twolven/mcp-codesavant'

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