logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Ollama-mcp-adapter

Facilitates the connection of Ollama's locally-hosted generative AI models with the Model Context Protocol (MCP) framework. This component ensures secure, private execution of local language models via a standardized interface for resource administration and task execution.

Author

Ollama-mcp-adapter logo

NightTrek

No License

Quick Info

GitHub GitHub Stars 71
NPM Weekly Downloads 0
Tools 1
Last Updated 2026-02-19

Tags

ollamanighttrekservicesollama mcpollama locallocal ai

Ollama MCP Server Bridge

Overview

This repository furnishes a robust intermediary layer, connecting the capabilities of the Ollama local Large Language Model (LLM) runtime directly into applications leveraging the Model Context Protocol (MCP). It permits self-contained, privacy-preserving AI operations.

Key Features & Functionality

Deep Ollama Interfacing

  • Comprehensive Protocol Mapping: Exposes the majority of Ollama's core API endpoints through the structured MCP tooling layer.
  • OpenAI Compatibility Mode: Offers a seamless drop-in replacement mechanism for OpenAI Chat Completion specifications.
  • Local Sovereignty: Facilitates the deployment and inference of AI models entirely within the user's local environment, guaranteeing data confidentiality.

Management Toolkit

  • Artifact Lifecycle Control

    • Retrieving models from remote repositories (pull)
    • Uploading local models to registries (push)
    • Inventory listing of resident models
    • Custom artifact creation using Modelfile definitions
    • Duplication and purging of existing artifacts
  • Inference Engine Operations

    • Executing models with user-defined input sequences (prompts)
    • Structured dialogue handling incorporating system, user, and assistant conversational turns
    • Tuning inference variables (e.g., temperature, maximum wait time)
    • Support for outputting raw, non-structured data streams
  • System Oversight

    • Initiating and monitoring the underlying Ollama service process
    • Detailed inspection of loaded model metadata
    • Robust error trapping and temporal constraint enforcement

Getting Started Guide

Prerequisites

  1. Installation of the Ollama application on the host machine.
  2. A working Node.js runtime environment, accessible via npm or pnpm package managers.

Setup Procedure

  1. Install required packages: bash pnpm install

  2. Compile the server artifact: bash pnpm run build

Integration Configuration

Incorporate this server component into your primary MCP configuration file:

Configuration Path Reference:

MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%/Claude/claude_desktop_config.json

{ "mcpServers": { "ollama": { "command": "node", "args": ["/path/to/ollama-server/build/index.js"], "env": { "OLLAMA_HOST": "http://127.0.0.1:11434" // Modify if Ollama listens elsewhere } } } }

Practical Application Examples

Model Acquisition and Execution

typescript // Fetch a specific model artifact await mcp.use_mcp_tool({ server_name: "ollama", tool_name: "pull", arguments: { name: "codellama:7b" } });

// Initiate processing using the acquired model await mcp.use_mcp_tool({ server_name: "ollama", tool_name: "run", arguments: { name: "codellama:7b", prompt: "Write a brief Python script for calculating Fibonacci numbers." } });

Conversational API Invocation (OpenAI Standard)

typescript await mcp.use_mcp_tool({ server_name: "ollama", tool_name: "chat_completion", arguments: { model: "mistral", messages: [ { role: "system", content: "You are an expert technical writer." }, { role: "user", content: "Detail the core concepts of distributed consensus algorithms." } ], temperature: 0.55 } });

Defining a New Artifact

typescript await mcp.use_mcp_tool({ server_name: "ollama", tool_name: "create", arguments: { name: "my-custom-ai", modelfile: "./config/CustomRecipe.txt" } });

Configuration Variables

  • OLLAMA_HOST: Specifies the network address where the Ollama daemon is reachable (Default: http://127.0.0.1:11434).
  • Inference Timeout: Adjustable setting to govern the maximum allowable time for model response generation (Default: 60 seconds).
  • Temperature Scalar: Parameter controlling the stochastic nature of the model output (Range: 0.0 to 2.0).

Community Engagement

We welcome community contributions to enhance this adapter: * Flagging defects or anomalies. * Proposing enhancements or new features. * Submitting vetted code changes via pull requests.

Intellectual Property

Distributed under the MIT License. Free for incorporation into your private or commercial endeavors.


Developed with dedication for the MCP framework.

WIKIPEDIA CONTEXT: Cloud Computing, as defined by ISO, describes a consumption model providing ubiquitous, on-demand access to a shared pool of configurable computing assets, allowing for agile provisioning and oversight.

== NIST Essential Attributes == In 2011, the National Institute of Standards and Technology established five cardinal traits for services classified as 'cloud':

  1. Self-Service Provisioning: Users can acquire resources instantly without provider intervention.
  2. Ubiquitous Network Access: Service availability across various network-enabled devices via standard protocols.
  3. Resource Pooling (Multi-tenancy): Provider resources are aggregated and dynamically allocated to meet fluctuating consumer demands.
  4. Elasticity: Scalability is rapid, both expanding capacity quickly to meet peak needs and contracting when demand subsides, often appearing infinite to the user.
  5. Measured Service: Utilization is automatically tracked, logged, and reported, ensuring transparency regarding consumed processing, storage, and bandwidth.

== Historical Context == The foundational concepts underpinning cloud computing date back to the 1960s, rooted in mainframe time-sharing systems where users submitted batch jobs for processing. The graphical representation of 'the cloud' in networking diagrams was adopted in 1994 by General Magic for their Telescript environment. The term 'cloud computing' gained broader recognition in business contexts around 1996 when Compaq explored future internet infrastructure plans, suggesting a massive shift toward centralized, virtualized infrastructure.

See Also

`