๐Ÿฆ™ ollama-mcpo-adapter

๐Ÿฆ™ ollama-mcpo-adapter

Adapter to expose MCPO, the MCP-to-OpenAPI proxy server, tools in Ollama-compatible format

tappi287

Developer Tools
Visit Server

README

๐Ÿฆ™ ollama-mcpo-adapter

Expose MCPO, the MCP-to-OpenAPI proxy server, tools as Ollama-compatible functions using a simple Python adapter and optional runtime service.


โœจ Features

  • ๐Ÿ”Œ Connect to a MCPO instance
  • โš™๏ธ Launch your own MCPO server programmatically via MCPOService
  • ๐Ÿ” List MCP tools exposed via OpenAPI as Ollama-compatible tool functions

๐Ÿš€ Quickstart

1. Install

pip install ollama-mcpo-adapter

Usage with Existing MCPO Instance

Assuming you have MCPO running like this:

uvx mcpo --port 5090 --config /path/to/mcp_config.json

You can get all available functions in Ollama ToolCall format with the adapter:

from ollama_mcpo_adapter import OllamaMCPOAdapter

adapter = OllamaMCPOAdapter(host="localhost", port=5090, config_path="/path/to/mcp_config.json")
# Gets tool descriptions from MCPO FastAPI /docs
tools = adapter.list_tools_ollama()

You can omit the config path. But discovery of MCP server names is more reliable with a provided config. Otherwise, the server names will be read from the automatically generated OpenAPI docs MCPO provides which might change in the future.


Usage with Local MCPO Service

You can start a MCPO service with this extension:

from ollama_mcpo_adapter import MCPOService

# Provide your mcp config as JSON file or dictionary
mcp_config = {
    "mcpServers": {
        "time": {"command": "uvx", "args": ["mcp-server-time", "--local-timezone=Europe/Berlin"]}
    }
}
mcpo = MCPOService("127.0.0.1", 4090, config=mcp_config,
                   # -OR- from an existing mcp_config file 
                   config_path="path/to/mcp_config.json")
# MCPOSService class handles MCPO server start-up and shutdown and in a subprocess
mcpo.start(wait=True)
...
mcpo.stop()

Then get all available tools with the adapter:

from ollama_mcpo_adapter import OllamaMCPOAdapter
adapter = OllamaMCPOAdapter("127.0.0.1", 4090)
tools = adapter.list_tools_ollama()

Send this to Ollama:

from ollama import Client
# Send a prompt to Ollama using discovered tools
client = Client(host="http://127.0.0.1:11434")
response = client.chat(
    model="qwen2.5-coder:14b-instruct-q4_K_M",
    messages=[{"role": "user", "content": "Write a file..."}],
    tools=tools,
)

And finally call the tools:

# Handle any tool calls
if response.message.tool_calls:
    adapter.call_tools_from_response(response.message.tool_calls)

Env

  • MS Windows npx path, you can overwrite npx with a path to npx in the config parser

    example: WIN_NODEJS_NPX_PATH=C:\Program Files\nodejs\npx.cmd


๐Ÿงช Running Tests

pytest

๐Ÿ“‚ Project Structure

ollama_mcpo_adapter/
โ”œโ”€โ”€ adapter.py        # Tool discovery + Ollama integration
โ”œโ”€โ”€ service.py        # Optional: launch MCPO programmatically
โ”œโ”€โ”€ service_runner.py # MCPO subprocess control
โ”œโ”€โ”€ config_parser.py  # MCP config parsing helpers
โ”œโ”€โ”€ dispatcher.py     # Dispatch tool calls

๐Ÿ“œ License

MIT. See LICENSE.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
MCP Package Docs Server

MCP Package Docs Server

Facilitates LLMs to efficiently access and fetch structured documentation for packages in Go, Python, and NPM, enhancing software development with multi-language support and performance optimization.

Featured
Local
TypeScript
Claude Code MCP

Claude Code MCP

An implementation of Claude Code as a Model Context Protocol server that enables using Claude's software engineering capabilities (code generation, editing, reviewing, and file operations) through the standardized MCP interface.

Featured
Local
JavaScript
@kazuph/mcp-taskmanager

@kazuph/mcp-taskmanager

Model Context Protocol server for Task Management. This allows Claude Desktop (or any MCP client) to manage and execute tasks in a queue-based system.

Featured
Local
JavaScript
Linear MCP Server

Linear MCP Server

Enables interaction with Linear's API for managing issues, teams, and projects programmatically through the Model Context Protocol.

Featured
JavaScript
mermaid-mcp-server

mermaid-mcp-server

A Model Context Protocol (MCP) server that converts Mermaid diagrams to PNG images.

Featured
JavaScript
Jira-Context-MCP

Jira-Context-MCP

MCP server to provide Jira Tickets information to AI coding agents like Cursor

Featured
TypeScript
Linear MCP Server

Linear MCP Server

A Model Context Protocol server that integrates with Linear's issue tracking system, allowing LLMs to create, update, search, and comment on Linear issues through natural language interactions.

Featured
JavaScript
Sequential Thinking MCP Server

Sequential Thinking MCP Server

This server facilitates structured problem-solving by breaking down complex issues into sequential steps, supporting revisions, and enabling multiple solution paths through full MCP integration.

Featured
Python