Ollama MCP Server
Ollama MCP 服务器
🚀 Ollama 和模型上下文协议 (MCP) 之间的强大桥梁,可将 Ollama 的本地 LLM 功能无缝集成到由 MCP 驱动的应用程序中。
🌟 功能
完成 Ollama 集成
完整的 API 覆盖:通过简洁的 MCP 界面访问所有必要的 Ollama 功能
OpenAI 兼容聊天:OpenAI 聊天完成 API 的直接替代品
Local LLM Power :在本地运行 AI 模型,并具有完全控制权和隐私
核心能力
🔄模型管理
从注册表中提取模型
将模型推送到注册表
列出可用模型
从模型文件创建自定义模型
复制和删除模型
🤖模型执行
使用可自定义的提示运行模型
具有系统/用户/助理角色的聊天完成 API
可配置参数(温度、超时)
原始模式支持直接响应
🛠服务器控制
启动和管理 Ollama 服务器
查看详细模型信息
错误处理和超时管理
Related MCP server: Ollama MCP Server
🚀 入门
先决条件
您的系统上已安装Ollama
Node.js 和 npm/pnpm
安装
安装依赖项:
pnpm install构建服务器:
pnpm run build配置
将服务器添加到您的 MCP 配置:
对于 Claude 桌面:
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" // Optional: customize Ollama API endpoint
}
}
}
}🛠 使用示例
拉取并运行模型
// Pull a model
await mcp.use_mcp_tool({
server_name: "ollama",
tool_name: "pull",
arguments: {
name: "llama2"
}
});
// Run the model
await mcp.use_mcp_tool({
server_name: "ollama",
tool_name: "run",
arguments: {
name: "llama2",
prompt: "Explain quantum computing in simple terms"
}
});聊天完成(兼容 OpenAI)
await mcp.use_mcp_tool({
server_name: "ollama",
tool_name: "chat_completion",
arguments: {
model: "llama2",
messages: [
{
role: "system",
content: "You are a helpful assistant."
},
{
role: "user",
content: "What is the meaning of life?"
}
],
temperature: 0.7
}
});创建自定义模型
await mcp.use_mcp_tool({
server_name: "ollama",
tool_name: "create",
arguments: {
name: "custom-model",
modelfile: "./path/to/Modelfile"
}
});🔧 高级配置
OLLAMA_HOST:配置自定义 Ollama API 端点(默认值: http ://127.0.0.1:11434 )模型执行的超时设置(默认值:60秒)
温度控制响应随机性(0-2范围)
🤝 贡献
欢迎贡献!请随意:
报告错误
建议新功能
提交拉取请求
📝 许可证
MIT 许可证 - 请随意在您自己的项目中使用!
用❤️为 MCP 生态系统打造
Available Tools
10 toolschat_completionB
OpenAI-compatible chat completion API
Inputs: model (required), messages (required), temperature, timeout.
cpC
Copy a model
Inputs: source (required), destination (required).
createC
Create a model from a Modelfile
Inputs: name (required), modelfile (required).
listC
List models
Inputs: no named parameters.
pullC
Pull a model from a registry
Inputs: name (required).
pushC
Push a model to a registry
Inputs: name (required).
rmC
Remove a model
Inputs: name (required).
runC
Run a model
Inputs: name (required), prompt (required), timeout.
serveB
Start Ollama server
Inputs: no named parameters.
showC
Show information for a model
Inputs: name (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 10 tools
Most tools have distinct purposes, such as list, pull, push, rm, and show, which clearly target different operations on models. However, 'run' and 'chat_completion' could be confused, as both involve executing models, though 'chat_completion' is more specific to API interactions. Overall, the descriptions help clarify boundaries, but there is some overlap in execution-related tools.
The naming is mixed with some inconsistencies: most tools use simple verb forms like list, pull, push, rm, run, and serve, which are consistent. However, 'chat_completion' uses snake_case and is more descriptive, while 'cp' and 'create' are shorter forms that deviate slightly. This creates a readable but not fully uniform pattern across all tools.
With 10 tools, the count is well-scoped for managing Ollama models, covering essential operations like listing, creating, pulling, pushing, removing, running, and serving. Each tool serves a clear purpose in the model lifecycle, making the set comprehensive without being overwhelming or too sparse for the domain.
The tool set provides complete coverage for Ollama model management, including CRUD operations (create, list, rm), lifecycle actions (pull, push, run, serve), and informational tools (show, chat_completion). There are no obvious gaps; agents can perform all core workflows from model acquisition to execution and maintenance seamlessly.
Maintenance
Related MCP Connectors
Connect MCP clients to 2,000+ AI models without managing provider API keys.
Talk to your public-facing AI from any MCP client — Claude, ChatGPT, Cursor, Cline, Windsurf.
Build and run AI workflows, agents, data tables and 1000+ API integrations from any MCP client.
Chat, image, video, and audio models from many vendors behind one remote MCP server and one key.
Related MCP Servers
- AlicenseAqualityCmaintenanceEnables seamless integration between Ollama's local LLM models and MCP-compatible applications, supporting model management and chat interactions.13812 npm178AGPL 3.0
- AlicenseCqualityDmaintenanceA bridge that integrates Ollama's local LLM capabilities into MCP-powered applications, enabling users to run, manage, and interact with AI models locally with full control and privacy.9518 npm6MIT
- AlicenseAqualityDmaintenanceIntegrates Ollama's local AI models with MCP clients, enabling listing models, viewing model details, and asking questions to models.3MIT
- AlicenseNot gradedqualityAmaintenanceEnables MCP-compatible clients to access local or cloud LLMs, manage and run models, generate completions and embeddings, chat with tool/function support, and use web search/fetch through Ollama Cloud.812 npmAGPL 3.0