miniMCP
miniMCP
A lightweight project that shows how to connect a local AI model (using Ollama) to custom tools through the Model Context Protocol (MCP).
The AI acts as a music assistant. It can manage a small album and track library (stored in a JSON file) and control playback through Soloist (a Spotify CLI player).
Project Structure
server/server.py: The MCP server, built withMCPServer. It exposes the following tools:Albums:
register_album,get_album_by_name,get_album_by_uri,get_all_albums,update_album,delete_albumTracks:
register_track,get_track_by_name,get_track_by_uri,update_track,delete_trackSoloist process:
start_soloist,stop_soloist,activate_soloist,get_statusPlayback:
manage_playback(play,pause,next,prev,seek),set_volume,set_shuffle,set_repeat,get_now_playing,get_queue,add_to_queueUtilities:
get_local_datetime
server/helpers.py: Helpers for reading and writing the album file and for running Soloist commands.server/schemas.py: Pydantic models (Album,Track).server/config.py: Settings loaded from the environment /.envfile.server/albums.json: The album and track library.client/stdio_client.py/client/http_client.py: Terminal clients. The first connects to the MCP server through standard input/output (stdio), the second through HTTP (streamable-http). Both load the available tools and start a chat loop between the user and the Ollama LLM.requirements.txt: The project's main dependencies.
Related MCP server: Modular MCP Server with Python Tools
Requirements
Before starting, make sure you have:
Python 3.12+
Ollama installed and running on your machine.
The model this repository uses,
gemma4:e4bby default. Or any model that supports tool usage. You can download it with:ollama pull <model_name>Soloist available in your
PATH, and aSOLOIST_API_KEY(set in.envor the environment; the server requires it to start).
Soloist can be downloaded from https://developer.spotify.com/documentation/soloist/reference/downloads-and-updates
A Soloist API key can be obtained from https://developer.spotify.com/dashboard/soloist
Note: Stopping the server does not stop Soloist: when the server starts, it looks for a Soloist that is already running and takes control of it, so music keeps playing across server restarts. Use the stop_soloist tool to stop it.
Installation
Clone the repository and move into its folder:
git clone <repo-url> miniMCP cd miniMCPCreate and activate a virtual environment (optional but highly recommended):
python -m venv .venv # On Windows: .\.venv\Scripts\activate # On macOS/Linux: source .venv/bin/activateInstall the dependencies:
pip install -r requirements.txtCopy
.env.exampleto.envand adjust it to your setup.
Configuration
Settings are read from environment variables or from the .env file in the project root.
Variable | Used by | Description | Default |
| server |
|
|
| server | Host to bind to when using HTTP |
|
| server | Port to bind to when using HTTP |
|
| server | Route of the MCP endpoint when using HTTP (normalized: |
|
| server | Album library file (relative paths are resolved against |
|
| server | API key used to start Soloist | none (required; the server will not start without it) |
| HTTP client | URL of the MCP server. Must match |
|
| clients | Ollama model to use |
|
| HTTP client | URL of the Ollama server |
|
| HTTP client | Context window size |
|
| HTTP client | Start Ollama automatically ( |
|
The HTTP client prints the model and the LLM URL at startup, and the MCP server URL once connected.
Validation
Albums and tracks are validated by the Pydantic models:
nameandartistcannot be empty, and URIs must start withspotify:album:/spotify:track:.Albums with a duplicate URI or name are rejected.
Tool parameters are described in the generated schemas, and numeric ones are bounded (
volume0-100,get_queuelimit1-50,seekms>= 0).If
albums.jsoncontains an invalid entry, the tools report an error instead of skipping it, so no data is silently lost.
Usage
There are two clients, depending on the MCP transport you want to use.
stdio (the client launches the server itself):
python client/stdio_client.pyHTTP (streamable HTTP; the server runs separately):
# Terminal 1: server at http://127.0.0.1:8000/mcp
python server/server.py
# Terminal 2: client
python client/http_client.pyType your questions to the model directly in the console.
Example Interaction
You can try telling the AI:
"Create an album called 'For Lovers' by Lamp with the URI 'spotify:album:0gwS2D9sukMLXNvleEnYr2'"
"Add the track 'Rainy Tapestry' to that album"
"Find the track 'moon'"
"Start Soloist and play that album"
"Set the volume to 40, turn on shuffle and show me the queue"
The AI will run the tools in server/server.py automatically, so you don't need to write the code or the calls yourself.
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
MCP server for AI dialogue using various LLM models via AceDataCloud
Text-to-SQL MCP server: read-only queries on PostgreSQL, MySQL and SQL Server with your real schema
Cloud-hosted MCP server for durable AI memory
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceMCP-Server from your Database optimized for LLMs and AI-Agents. Supports PostgreSQL, MySQL, ClickHouse, Snowflake, MSSQL, BigQuery, Oracle Database, SQLite, ElasticSearch, DuckDB550Apache 2.0
- FlicenseNot gradedqualityDmaintenanceA demo MCP server that enables users to interact with various tools through natural language, including note management, weather queries, calculations, file operations, and shell commands. Uses Ollama for intent detection and structured command parsing from free text input.-
- FlicenseNot gradedqualityBmaintenanceAn MCP server that exposes relational databases (PostgreSQL/MySQL) to AI agents with natural language to SQL query support.19-
- FlicenseNot gradedqualityDmaintenanceEnables natural language database queries by combining Ollama's language models with SQLite database access through an MCP server.-