mcp-server
Ollama を使用したローカルMCPサーバー
Ollama 言語モデルを MCP サーバーに接続するローカル Python プロジェクトです。モデルはサーバーのツールを検出し、いつツールを呼び出すかを判断し、結果を受け取り、簡潔な最終応答を生成できます。
flowchart TD
U["User question"] --> C["Python MCP client"]
C --> O["Ollama llama3.2:3b"]
O --> C
C --> S["Local MCP server"]
S --> D["Student JSON data"]利用可能なツール
ツール | 目的 |
| 明示的に指定された 2 つの数値を加算します |
| 組み込みのデモ用学生プロフィールを返します |
|
|
Related MCP server: py-mcp-students
必要条件
Python 3.11+
Ollama がインストールされ、実行中であること
Ollama モデル
llama3.2:3b
Windows のセットアップ
python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt
ollama pull llama3.2:3b
python client.pyクライアントは、アクティブな Python インタープリターを通じて server.py を自動的に起動します。別のターミナルでサーバーを起動する必要はありません。
質問の例
What is 10 + 20?Tell me about Pranay.Where is Anaya studying?What is Saraya studying?
プロジェクト構造
mcp-server/
├── client.py
├── server.py
├── files/
│ └── students.json
├── tests/
│ └── test_server.py
└── requirements.txtツール結果の修正
Ollama は、ツール結果メッセージに実行された tool_name が含まれていることを期待します。クライアントはこのフィールドを含め、利用可能なツール定義を後続の呼び出しに渡すことで、MCP ツールの実行後にモデルが最終応答を生成できるようにします。
データに関する注意
files/students.json はデモ用データです。このプロジェクトを公開または本番環境で使用する前に、架空のデータまたは同意を得たデータに置き換えてください。
This server cannot be deployed
Maintenance
Related MCP Connectors
Gateway between LLM agents and world data through eight tools and a bundled endpoint catalog.
PDF, image, video, OCR, screenshot, SQL, QR and text tools for agents. No API key, no signup.
Search and run data, text, code, PDF and web APIs. Requests not stored. Network tools need a key.
Discover, inspect and run 63,000+ agent tools from one balance. Pay per call, no subscriptions.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceExposes custom Python functions as tools and integrates with Ollama for tool calling.4MIT
- FlicenseNot gradedqualityDmaintenanceEnables LLMs to manage student records through natural language by wrapping a simple HTTP student server's endpoints as MCP tools.-
- FlicenseAqualityCmaintenanceEnables arithmetic calculation, current time lookup, and attendance retrieval through natural language tool calls.3-
- FlicenseAqualityCmaintenanceEnables an LLM client to perform basic arithmetic on two numbers — addition, subtraction, multiplication, and division — plus reverse a supplied text string, through five simple tools exposed over stdio. Inputs and structured text results follow JSON schemas, with invalid operations such as division by zero surfaced as tool errors.5-