Skip to content

Ollama

Ollama is a local LLM server — it serves models but does not consume MCP tools directly. To use AllMCP with a local Ollama model, pair Ollama with a framework that supports both a custom LLM backend and MCP.


Both approaches below connect a locally served Ollama model to AllMCP. Choose the one that matches your stack.

LangChain + Ollama + AllMCP

install
pip install langchain-mcp-adapters langchain-ollama langgraph
agent.py
import asyncio
from langchain_mcp_adapters.client import MultiServerMCPClient
from langchain_ollama import ChatOllama
from langgraph.prebuilt import create_react_agent
async def main():
client = MultiServerMCPClient({
"allmcp": {
"url": "https://go.allmcp.co/mcp/",
"transport": "streamable_http",
"headers": {"X-API-Key": "YOUR_API_KEY"},
}
})
tools = await client.get_tools()
llm = ChatOllama(
model="llama3.2",
base_url="http://localhost:11434",
)
agent = create_react_agent(llm, tools)
result = await agent.ainvoke({
"messages": [{"role": "user", "content": "List my Bitrix24 contacts"}]
})
print(result["messages"][-1].content)
asyncio.run(main())

AllMCP tools work best with models that have strong function-calling support:

ModelTool use quality
llama3.2Good
llama3.1Good
mistral-nemoGood
qwen2.5Good
phi3Limited