Skip to main content
Glama

project-mcp-tools

開発者ツールを、MCP(Model Context Protocol)、REST APICLI の3つのプロトコルを通じて同時に公開するPythonフレームワークです。すべて単一の共有ツールレジストリから提供されます。

概要

project-mcp-tools は、異なるコンシューマーごとに別々のツールバックエンドを維持するという問題を解決します。@tool() デコレータを使ってツールを一度書くだけで、以下の環境で即座に利用できるようになります:

  • AIアシスタント — MCPプロトコル経由(FastMCP ベース)

  • HTTPクライアント — REST API経由(FastAPI + uvicorn ベース)

  • ターミナルユーザー — CLI経由(argparse ベース)

同梱のツールは、C++開発(コンパイル、静的解析、フォーマット、クラス/テストのスキャフォールディング、インクルードツリー解析)、Pythonフォーマット検証、git操作をカバーしており、すべてサブプロセス実行によるプロセス分離を備えています。

インストール

要件: Python 3.14+、uv パッケージマネージャー

# Clone the repository
git clone <repository-url>
cd project-mcp-tools

# Install dependencies
uv sync

使用方法

MCPサーバー

AIアシスタントが接続できるFastMCPサーバーを起動します:

uv run mcp-server

このサーバーを使用するようにMCPクライアントを設定します。たとえば、ホストプロジェクト(ツールを操作対象にしたいプロジェクト。project-mcp-tools ディレクトリ自体ではありません)のルートにある opencode.json で設定します:

{
  "mcp": {
    "project-mcp-tools": {
      "type": "local",
      "command": ["uv", "--directory", "project-mcp-tools", "run", "mcp-server", "--target-project", "../my-host-project"]
    }
  }
}

重要: --directory は、uvproject-mcp-tools パッケージ(pyproject.toml、依存関係、venv)の場所を指定します。--target-project は、MCPプロセスとそのすべてのサブプロセスの作業ディレクトリを設定します — これがツールが実際に操作するプロジェクトです。パスは project-mcp-tools/ からの相対パスとして解決されます(uv --directory が作業ディレクトリを変更するため)。この分離がないと、git/cpp/pythonツールはホストプロジェクトではなく project-mcp-tools/ 内で動作してしまいます。

REST APIサーバー

http://0.0.0.0:8000 でFastAPIサーバーを起動します:

uv run api --target-project ../my-host-project

各ツールは POST /tools/<tool_name> として公開されます。ツールの関数シグネチャのクエリパラメータは、JSONリクエストボディのフィールドになります。

リクエスト例:

curl -X POST http://localhost:8000/tools/git_quick_upload \
  -H "Content-Type: application/json" \
  -d '{"message": "my commit"}'

Swagger UIは http://localhost:8000/docs で利用できます。

CLI

ターミナルから任意のツールを呼び出します:

uv run cli --target-project ../my-host-project git_quick_upload --message "your commit message"

--target-project はツール名より前に指定する必要があります。ホストプロジェクトを参照しないツール(例:get_random_number)は、--target-project なしで呼び出すことができます。

ツールカタログ

一般

Tool

Signature

Description

create_image

(description: str, file_name: str | None = None) -> str

指定されたテキスト説明からGemini(モデル gemini-3.1-flash-lite-image)を使用して画像を生成します。resources/images/ に保存します

describe_image

(image_path: str, description: str) -> str

視覚機能を持たないモデルのために、Gemini vision(固定モデル gemini-flash-lite-latest)を使用してターゲットプロジェクトの画像を解釈します。image_path はターゲットプロジェクトからの相対パスです

debug

() -> str

環境のデバッグ情報(cwd、パス、環境変数)を返します

get_random_number

(start: int = 1, end: int = 100) -> str

startとendの間の乱数を返します

Git

Tool

Signature

Description

git_discard_changes

() -> str

すべての未コミットの変更を破棄し、追跡されていないファイルを削除します。HEADの状態に戻します

git_pull_submodules

() -> str

すべてのサブモジュールを最新のリモートコミットに更新します(クリーンなサブモジュールが必要)。ポインタの更新はコミットされずに残されます

git_quick_upload

(message: str) -> str

git pullgit add .git commit -m <message>git push を実行します

Python

Tool

Signature

Description

python_analyze

() -> str

ツールディレクトリ内のすべての *.py ファイルに python_code_verifier を適用します

python_clear

() -> str

現在のディレクトリ配下のすべての __pycache__ ディレクトリを削除します

python_code_verifier

(files: list[str]) -> str

指定されたファイルのPythonフォーマット規則を検証します

C++

Tool

Signature

Description

cpp_analyze

() -> str

すべての .cpp/.hpp ファイルにフォーマット修正を適用し、その後cppcheck静的解析を実行します

cpp_code_verifier

(files: list[str]) -> str

指定されたファイルのC++フォーマット規則を検証します

cpp_compile

() -> str

Clangを使用してC++プロジェクト全体を並列コンパイルします

cpp_create_class

(class_hierarchy: str, include_list: list[str] = [], using_list: list[str] = [], create_header_only: bool = False) -> str

階層文字列(例:"game/player")から新しいC++クラスをスキャフォールドします

cpp_create_test

(hierarchy: str, flg_adhoc: bool = False, include_list: list[str] = []) -> str

C++テストファイルをスキャフォールドします

cpp_analyze_include_tree

(file_path: str = None) -> str

C++ファイルの再帰的なインクルード依存ツリーを表示します。デフォルトはプロジェクトのメインファイルです

cpp_generate_opengl_html

() -> str

OpenGL 4.6コアプロファイルの単一ファイルHTMLツリービューである opengl.htm を生成します。ターゲットプロジェクトから include/glad/snake_case.hpp を読み取り、公式のKhronosリファレンスページを /tmp/generate-opengl-html に取得し、出力をターゲットプロジェクトのルートに書き込みます

セッション

Tool

Signature

Description

session_context_usage

(session_id: str | None = None, context_limit: int | None = None) -> str

現在のopencodeチャットセッションがモデルのコンテキストウィンドウをどのくらい使用しているかを報告します(context_usedcontext_percent、モデル制限)。opencodeデータベースを直接読み取り、ターゲットプロジェクト内のアクティブなセッションを自動検出します。opencodeナレッジ を参照してください

プロジェクト構造

project-mcp-tools/
├── main.py                    # Entry point — builds tool_manager, starts servers
├── pyproject.toml             # Project config, dependencies, entry points
├── tools/                     # Core engine package
│   ├── __init__.py
│   ├── tool_manager.py        # Core orchestrator — shared registry, tool folder loading, subprocess dispatch, CLI/API/MCP exposure
│   ├── tool.py                # @tool() decorator, ToolInfo/ParameterInfo models, response contract helpers
│   ├── path_manager.py        # Project/target root resolution — injectable, no global state
│   └── folder_scanner.py      # Auto-discovers @tool-decorated functions in directories
├── general/                    # General-purpose tools (no host project dependency)
│   ├── create_image.py         # Gemini image generation tool
│   ├── describe_image.py       # Gemini image interpretation tool
│   ├── debug.py                # Environment debugging tool
│   └── get_random_number.py    # Random number generator
├── sak/
│   ├── common.py              # Utilities (process creation, JSON, assertions)
│   └── fso/                   # File system objects
├── lib/
│   ├── base_verifier.py       # Abstract regex-based code formatter
│   ├── project_config.py      # Global project configuration
│   ├── project_file.py        # Abstract source file with license header management
│   └── template.py            # Jinja-like template engine with imports and lists
├── cpp/
│   ├── analyze.py             # C++ full analysis tool
│   ├── code_verifier.py       # C++ formatting verification tool
│   ├── compile.py             # C++ parallel compilation tool
│   ├── create_class.py        # C++ class scaffolding tool
│   ├── create_test.py         # C++ test scaffolding tool
│   ├── include_tree.py        # C++ include dependency tree tool
│   └── cpp_lib/               # C++ domain library (compiler, model, verifier, build)
├── python/
│   ├── analyze.py             # Python full analysis tool
│   ├── code_verifier.py       # Python formatting verification tool
│   └── python_lib/            # Python domain library (model, verifier, config)
├── session/
│   ├── context_usage.py       # opencode session context usage tool
│   └── session_lib/           # Session domain library (opencode database reader)
├── git/
│   ├── discard_changes.py     # Git reset + clean tool
│   └── quick_upload.py        # Git pull/add/commit/push tool
├── resources/
│   └── images/               # Generated images (from create_image tool)
├── .agents/
│   └── skills/               # AI assistant skills (compliance audit, uv package manager)
└── docs/
    ├── templates/             # Template files for class/test scaffolding (user zone)
    ├── example/               # Usage examples (e.g. google-genai.py) (user zone)
    └── agent/                 # AI-managed knowledge base (architecture, guides, workflows, status)
        ├── architecture.md    # System architecture and design decisions
        ├── development/       # Tool development guide
        ├── style-guide/       # Coding style guides
        ├── workflow/          # Workflow documentation
        └── status.md          # Agent task status

アーキテクチャ

システムは、共有ツールレジストリを保持し、3つのトランスポート(CLI、REST API、MCP)すべてを処理する中央の tool_manager オブジェクトを中心に構築されています。

システムアーキテクチャの詳細、設計上の決定、ターゲットプロジェクトの仕組みについては、システムアーキテクチャ ガイドを参照してください。

新しいツールの追加

新しいツールを追加するには、既存のツールフォルダ(または新しいフォルダ)にPythonファイルを作成し、関数を @tool() でデコレートします。

ステップバイステップのチュートリアルと、ツール層およびドメインライブラリの構造に関するガイドラインについては、ツール開発ガイド を参照してください。

設定

グローバル設定とドメイン固有の設定はコードベース内に一元化されています。設定キーと値の完全なリストについては、システムアーキテクチャ - 一元化された設定 を参照してください。

コーディング規約

このプロジェクトのすべてのコードは、すべての識別子での snake_case の排他的使用や特定のスペース規則など、厳格なガイドラインに従う必要があります。完全なガイドラインについては、Pythonスタイルガイド を参照してください。

ライセンス

GNU General Public License v3.0 — 詳細については、ソースファイルのライセンスヘッダーを参照してください。

-
license - not tested
-
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (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 Connectors

  • Package intelligence MCP for AI agents — 22 tools, 19 ecosystems, AGPL SDK, free.

  • Free public MCP for AI agents — 193 tools, 44 workflows. No API key.

  • AI Reasoning Cache & Consensus Layer with 11 MCP tools via Streamable HTTP.

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/maxwellaguiarsilva/project-mcp-tools'

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