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.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
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
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Access Pollinations models and API capabilities through agent tools.
Connect your AI agent to 300+ methods and 100+ live tools
AI-callable tools for API mocking, testing, monitoring, security, and automation.
Discover, compare, route, and execute machine-accessible capabilities for AI agents.
Related MCP Servers
- AlicenseNot gradedqualityAmaintenanceExposes the complete Ollama SDK as MCP tools, enabling MCP-compatible applications to manage and run local or cloud models, generate text, chat, create embeddings, and use web search/fetch.812 npmAGPL 3.0
- AlicenseNot gradedqualityAmaintenanceExposes the complete Ollama SDK as MCP tools, enabling MCP-compatible applications to manage local and cloud models, chat and generate text, create embeddings, and perform web search and fetch.812 npmAGPL 3.0
- AlicenseNot gradedqualityAmaintenanceExposes the complete Ollama SDK as MCP tools, enabling MCP-compatible assistants to manage local and cloud models, run chats, generations, and embeddings, and perform web search and fetch operations.812 npmAGPL 3.0
- AlicenseNot gradedqualityAmaintenanceEnables MCP-compatible clients to interact with local and cloud Ollama models by exposing Ollama SDK functionality as tools for model management, text generation, chat, embeddings, and web search/fetch.812 npmAGPL 3.0