custom-mcp-server
Provides tools that can be used with Ollama's tool calling API, enabling AI agents to invoke custom functions through the Ollama chat interface.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@custom-mcp-serverEcho this message 'Hello, world!'"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Ollama MCP Demo
This demo shows how to create a custom MCP server to expose custom Python functions as tools. It also demonstrates how a custom MCP client class can be used to integrate the MCP server with Ollama. Both, the MCP server and Ollama are independent and can be run on different machines.
Add Tools to your MCP Server
To add new tools to the MCP server, simply create Python functions in mcp_server/tools. Once created, add them to the TOOLS tuple in mcp_server/__main__.py which is used to register them to the MCP server.
# mcp_server/__main__.py
from mcp_server.tools import echo
...
SERVER = FastMCP(name="custom-mcp-server", **SERVER_CONFIG)
TOOLS = (echo,) # add functions here
...Related MCP server: Ollama MCP Server
Running the MCP Server
(Optional) Configure the environments in the
docker-compose.ymlfile (ports, ollama configs, ...).Start the services. This spins up an Ollama instance and the MCP server.
docker compose up -d(Optional) To download ollama models once the containers are running, use
docker compose exec ollama ollama pull <your model>
The Ollama server can then be accessed at http://localhost:11434 and the MCP server at http://localhost:7777/mcp (replace ports with your configuration).
MCP Client Usage
Install the dependencies used for the MCP client
uv syncYou can then use the mcp_client.client.MCPClient class to communicate with the MCP server like this:
from mcp_client.client import MCPClient
mcp_client = MCPClient(host="localhost", port=7777)
# list available tools
tools = await mcp_client.list_tools()
...
# call a tool
result = await mcp_client.call_tool(tool_name="some_tool", arguments={"some_arg": "value"})
...Integrating it with Ollama can be done like so:
from mcp_client.client import MCPClient
from ollama import Client as OllamaClient
mcp_client = MCPClient(host="localhost", port=7777)
ollama_client = OllamaClient("http://localhost:11434")
# invoke llm
response = ollama_client.chat(
model="qwen3:4b",
messages=[{"role": "user", "content": "Echo this message 'Hi, Alice!'"}],
tools=await mcp_client.list_tools(),
)
print(response.message.content)
# handle tool calls
if tool_calls := response.message.tool_calls:
for tool_call in tool_calls:
tool_name = tool_call.function.name
arguments = tool_call.function.arguments
print("Calling", tool_name, "with arguments", arguments)
tool_result = await mcp_client.call_tool(tool_name, arguments)
print("Result: ", tool_result)Helpful Links
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityDmaintenanceProvides a standardized protocol for tool invocation, enabling an AI system to search the web, retrieve information, and provide relevant answers through integration with LangChain, RAG, and Ollama.2MIT
- Alicense-qualityDmaintenanceExposes local Ollama instances as tools for Claude Code, allowing users to offload code generation, text drafting, and embedding tasks to local GPUs. It supports multi-turn conversations and model management through the Model Context Protocol.MIT
- AlicenseAqualityBmaintenanceEnables dynamic creation and execution of custom tools/functions in multiple programming languages at runtime, exposing them to MCP clients like Claude.41043MIT
- FlicenseBqualityBmaintenanceEnables AI agents to interact with local Ollama models for text generation and tool calling with prompt injection protection.5
Related MCP Connectors
Gateway between LLM agents and world data through eight tools and a bundled endpoint catalog.
Universal AI API Orchestrator — 1,554 tools, 96 services. One install.
Bounded tools for rendering, extraction, RAG, enrichment, local discovery and review analysis.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/dakofler/ollama-mcp-demo'
If you have feedback or need assistance with the MCP directory API, please join our Discord server