miniMCP
miniMCP
ローカルAIモデル(Ollamaを使用)を、Model Context Protocol (MCP) を介してカスタムツールと実装・接続する方法を示す軽量プロジェクトです。
このプロジェクトでは、AIがデータベースアシスタントとして機能し、CRUD操作(作成、読み取り、更新、削除)を使用してインメモリデータベースをクエリおよび管理できます。
プロジェクト構造
server.py:FastMCPで作成されたMCPサーバーです。インメモリデータベースを保持し、以下の操作を行うためのツール(tools)を公開します:アイテムの作成 (
create_item)個別アイテムの読み取り (
read_item)複数アイテムの読み取り (
read_multiple_items)アイテムの更新 (
update_item)アイテムの削除 (
delete_item)
client.py: ターミナルを介して対話するクライアントです。標準入出力(stdio)を通じてMCPサーバーに接続し、利用可能なツールを読み込み、ユーザーとOllamaのLLM(gemma4:e4b)とのチャットループを確立します。requirements.txt: プロジェクトの主要な依存関係が記載されたファイルです。
Related MCP server: Modular MCP Server with Python Tools
要件と依存関係
プロジェクトを開始する前に、以下がインストールされていることを確認してください:
Python 3.10+
Ollama がインストールされ、マシン上で実行されていること。
このリポジトリで使用するモデル(デフォルトは
gemma4:e4b)。以下のコマンドでダウンロードできます:ollama run gemma4:e4b
インストール
リポジトリをクローンし、フォルダに移動します:
git clone <url-del-repo> miniMCP cd miniMCP仮想環境を作成して有効化します(オプションですが、強く推奨します):
python -m venv .venv # En Windows: .\.venv\Scripts\activate # En macOS/Linux: source .venv/bin/activate必要な依存関係をインストールします:
pip install -r requirements.txt pip install gradio
使用方法
このプロジェクトはクライアント/サーバー構成になっていますが、クライアントが自動的にサーバーを起動するため、クライアントを実行するだけで済みます:
python client.pyコンソールに直接質問を入力してください。
対話例
AIに対して以下のように指示を出すことができます:
"ID 'tarea1'、内容 '牛乳を買う' でアイテムを作成して"
"'tarea1' の内容を表示して"
"'tarea1' を更新して、牛乳は低脂肪乳にするように伝えて"
"'tarea1' と 'tarea2' のアイテムを読み込んで"
"ID 'tarea1' を削除して"
AIは、あなたがコードや呼び出しを直接記述することなく、server.py のツールを自動的に実行します。
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP server for AI dialogue using various LLM models via AceDataCloud
Hosted MCP server connecting claude.ai, ChatGPT and other AI apps to your own computer
- mcpOAuthcom.gibsonai
GibsonAI MCP server: manage your databases with natural language
Cloud-hosted MCP server for durable AI memory
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceMCP-Server from your Database optimized for LLMs and AI-Agents. Supports PostgreSQL, MySQL, ClickHouse, Snowflake, MSSQL, BigQuery, Oracle Database, SQLite, ElasticSearch, DuckDB548Apache 2.0
- FlicenseNot gradedqualityDmaintenanceA demo MCP server that enables users to interact with various tools through natural language, including note management, weather queries, calculations, file operations, and shell commands. Uses Ollama for intent detection and structured command parsing from free text input.-
- FlicenseNot gradedqualityAmaintenanceAn MCP server that exposes relational databases (PostgreSQL/MySQL) to AI agents with natural language to SQL query support.19-
- FlicenseNot gradedqualityDmaintenanceEnables natural language database queries by combining Ollama's language models with SQLite database access through an MCP server.-