> For the complete documentation index, see [llms.txt](https://docs.allmcp.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.allmcp.co/documentation/agent-frameworks/ollama.md).

# 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.

{% hint style="info" icon="globe" %}
**Local model, remote tools.** Ollama runs the LLM on your machine; AllMCP always runs remotely at `https://go.allmcp.co/mcp/`. You bridge the two with a framework that speaks both.
{% endhint %}

***

## Pick a framework

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

{% tabs %}
{% tab title="LangChain (recommended)" %}
**LangChain + Ollama + AllMCP**

{% code title="install" %}

```bash
pip install langchain-mcp-adapters langchain-ollama langgraph
```

{% endcode %}

{% code title="agent.py" overflow="wrap" %}

```python
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())
```

{% endcode %}
{% endtab %}

{% tab title="PydanticAI" %}
**PydanticAI + Ollama + AllMCP**

{% code title="install" %}

```bash
pip install 'pydantic-ai-slim[mcp]' ollama
```

{% endcode %}

{% code title="agent.py" overflow="wrap" %}

```python
from pydantic_ai import Agent
from pydantic_ai.mcp import MCPServerStreamableHTTP
from pydantic_ai.models.openai import OpenAIModel
from openai import AsyncOpenAI

# Ollama's OpenAI-compatible endpoint
ollama_client = AsyncOpenAI(base_url="http://localhost:11434/v1", api_key="ollama")
model = OpenAIModel("llama3.2", openai_client=ollama_client)

allmcp = MCPServerStreamableHTTP(
    url="https://go.allmcp.co/mcp/",
    headers={"X-API-Key": "YOUR_API_KEY"},
)

agent = Agent(model, toolsets=[allmcp])
```

{% endcode %}
{% endtab %}
{% endtabs %}

***

## Model compatibility

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

| Model          | Tool use quality |
| -------------- | ---------------- |
| `llama3.2`     | Good             |
| `llama3.1`     | Good             |
| `mistral-nemo` | Good             |
| `qwen2.5`      | Good             |
| `phi3`         | Limited          |

{% hint style="warning" %}
**Smaller models can struggle.** Models under 7B parameters may struggle with complex multi-step tool calls.
{% endhint %}

{% hint style="info" icon="globe" %}
**Where your data is processed.** AllMCP itself always runs remotely at `https://go.allmcp.co/mcp/`. Only the LLM runs locally via Ollama — your CRM data is processed by the AllMCP cloud service.
{% endhint %}

***

## Keep exploring

{% content-ref url="/pages/uBaUeZYQpupBMd5c1BY0" %}
[Overview](/documentation/agent-frameworks/frameworks.md)
{% endcontent-ref %}

<table data-view="cards"><thead><tr><th></th><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><h4><i class="fa-table-cells" style="color:$primary;">:table-cells:</i></h4></td><td><strong>Browse providers</strong></td><td>See every provider you can connect and the tools each one offers.</td><td><a href="https://docs.allmcp.co/documentation/providers">https://docs.allmcp.co/documentation/providers</a></td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.allmcp.co/documentation/agent-frameworks/ollama.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
