Skip to main content
Model Context Protocol (MCP) is an open standard for exposing tools to AI clients. Mellea integrates with MCP via FastMCP: wrap any Mellea function as an MCP tool and call it from Claude Desktop, Cursor, or any MCP-compatible client.
Looking to call tools from an MCP server? See MCP tools in Tools and Agents.
Prerequisites: pip install mellea, pip install "mcp[cli]", Ollama running locally.

Creating an MCP server

Decorate any function with @mcp.tool(). The docstring becomes the tool description visible to the AI client.
Each @mcp.tool() function becomes a callable tool. Mellea’s requirements and sampling strategies work exactly as they do in regular code — the MCP layer just wraps the result.

Multiple tools in one server

A single FastMCP server can expose multiple tools, resources, and prompts:
Note: Each tool invocation creates a new MelleaSession. For high-throughput servers, consider initializing sessions at module level and reusing them across calls.

Running the server

Start the MCP dev UI to test interactively:
This opens a browser-based inspector at http://localhost:5173 where you can call tools, inspect arguments, and see outputs. To run the server directly:
Full example: docs/examples/notebooks/mcp_example.ipynb
See also: Backends and Configuration