# Ollama — how to use (mcp.ai)

Connect your Ollama account and use 8 tools for AI models straight from your AI agent. Connect with your own API key. Run large language models locally or in the cloud with Ollama.

## Option A — via MCP (recommended)
Remote MCP endpoint (HTTP, streamable): `https://api.mcp.ai/p_ollama?ms=1787296020000`
Add it as a custom/remote MCP connector in your client (Claude, Cursor, VS Code…), then authenticate when prompted. Once connected, ask the agent to use the server's tools (e.g. `ollama_chat`).

## Option B — via direct REST API
Base URL: `https://api.mcp.ai/api/ollama`
Auth: `Authorization: Bearer sk_live_…` — create a workspace API key at https://mcp.ai/settings/api-keys
Discover endpoints: `GET https://api.mcp.ai/api/ollama/_endpoints`

### Endpoints
- `POST https://api.mcp.ai/api/ollama/chat` — Tool to send a chat message with conversation history to Ollama. Use when you need to have a multi-turn conversation with an LLM model.
  - body: { model: string, think?: boolean|string, tools?: object[], format?: string|object, stream?: boolean, options?: object, logprobs?: boolean, messages: object[], keep_alive?: string|integer, top_logprobs?: integer }
- `POST https://api.mcp.ai/api/ollama/generate` — Tool to generate text responses from Ollama models with optional raw mode. Use raw=true to bypass prompt templating when you need full control over the prompt for debugging or custom processing. Note 
  - body: { raw?: boolean, model: string, think?: boolean|string, format?: string|object, images?: string[], prompt?: string, stream?: boolean, suffix?: string, system?: string, options?: object, logprobs?: boolean, keep_alive?: string|integer, top_logprobs?: integer }
- `POST https://api.mcp.ai/api/ollama/list/models` — Tool to list all available Ollama models and their details. Use when you need to fetch installed models with metadata including name, size, last modified timestamp, digest, and format information.
- `POST https://api.mcp.ai/api/ollama/open/ai/chat/completions` — Tool to create OpenAI-compatible chat completions using Ollama models. Use when you need conversational AI responses with OpenAI API format compatibility.
  - body: { n?: integer, seed?: integer, stop?: string|string[], user?: string, model: string, tools?: object[], top_p?: number, stream?: boolean, messages: object[], logit_bias?: object, max_tokens?: integer, temperature?: number, tool_choice?: string, stream_options?: object, response_format?: object, presence_penalty?: number, frequency_penalty?: number }
- `POST https://api.mcp.ai/api/ollama/open/ai/completions` — Tool to create OpenAI-compatible text completions using Ollama models. Use when you need text generation with OpenAI API format compatibility beyond chat-based interactions.
  - body: { n?: integer, echo?: boolean, seed?: integer, stop?: string|string[], user?: string, model: string, top_p?: number, prompt: string, stream?: boolean, suffix?: string, best_of?: integer, logprobs?: integer, logit_bias?: object, max_tokens?: integer, temperature?: number, stream_options?: object, presence_penalty?: number, frequency_penalty?: number }
- `POST https://api.mcp.ai/api/ollama/open/ai/list/models` — Tool to list available models using OpenAI-compatible API format. Use when you need to retrieve locally available Ollama models with metadata following OpenAI's model list format.
- `POST https://api.mcp.ai/api/ollama/show` — Tool to show comprehensive information about an Ollama model. Use when you need to retrieve model details, parameters, template, license, or system prompt.
  - body: { model: string, verbose?: boolean }
- `POST https://api.mcp.ai/api/ollama/version` — Tool to get the version of Ollama running locally. Use to check which version of Ollama is currently installed.

## Example prompts
- "What can I do in Ollama?"
- "Show me a summary of my Ollama account"

## More
- Page: https://mcp.ai/ollama
- Agent spec (llms.txt): https://mcp.ai/ollama/llms.txt
- Postman collection: https://mcp.ai/ollama/postman.json
