Skip to main content

Integrum Logo

Integrum

Convert any Python module or library into a FastMCP Model Context Protocol server.

Integrum turns any Python module, library, function, or class into a Model Context Protocol (MCP) server powered by FastMCP.

Integrum uses Python reflection (inspect), regex filtering, and an in-memory Word-Based Object Store (playful_llama, swift_falcon) so that object-oriented libraries (such as scikit-learn, pandas, PyTorch) can be used naturally by LLMs across multi-turn conversations without token bloat.

Features

  • Module Reflection: Automatically introspects functions and classes using inspect.
  • Regex Filtering: Expose only what you need with --include and --exclude regex patterns.
  • Word-Based State Management: Object IDs are short, memorable words (e.g. playful_llama) to save tokens and avoid UUID hallucination.
  • Multi-User Isolation: Supports FastMCP Context sessions to partition objects per connecting client.
  • Docstring Instruction Injection: Transforms Python docstrings into LLM tool documentation and automatically injects state-handling instructions.
  • Dot-Notation Attribute Resolution: Pass swift_falcon.data or swift_falcon.target directly to subsequent tool calls like fit().
  • CLI & Python API: Run from the command line (integrum expose) or integrate directly into Python scripts.

Installation

uv pip install integrum
# or
pip install integrum

Quick Start (CLI)

Expose scikit-learn dataset loaders and RandomForestClassifier as an MCP server:

integrum expose sklearn.datasets.load_iris sklearn.ensemble.RandomForestClassifier

Preview what tools will be exposed:

integrum list sklearn.datasets.load_iris sklearn.ensemble.RandomForestClassifier

Filter functions and methods with regex:

integrum expose sklearn.datasets sklearn.ensemble \
  --include "^(load_iris|RandomForestClassifier)$"

Run with HTTP or SSE transport:

integrum expose sklearn.datasets.load_iris --transport http --port 8000

Python API

from integrum import IntegrumServer

server = IntegrumServer(name="ml-server")
server.expose(["sklearn.datasets.load_iris", "sklearn.ensemble.RandomForestClassifier"])

# Run over stdio (default for MCP desktop clients)
server.run(transport="stdio")

How State Management Works

When a class is exposed, Integrum registers:

  1. <ClassName>_create: Instantiates the class and stores it under a word ID (e.g., playful_llama).
  2. <ClassName>_<method>: Accepts a virtual parameter obj_id: str (e.g., obj_id="playful_llama"), resolves the underlying instance, and executes the method.

Returned objects (such as datasets or numpy arrays) are also registered in the store with word IDs, allowing subsequent tools to receive them as arguments.

Examples

Check out examples/gemma_sklearn_session.md and examples/gemma_sklearn_session.json for a complete, verified multi-turn transcript of Gemma 4 26B loading the Iris dataset, performing train_test_split, training a RandomForestClassifier, and evaluating accuracy.

Metadata

Release files for integrum 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for integrum 0.1.0
File Size Uploaded
integrum-0.1.0.tar.gz 297.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for integrum 0.1.0
File Interpreter ABI Platform
integrum-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 408.3 kB

Release files / integrum-0.1.0.tar.gz

Download URL integrum-0.1.0.tar.gz
Size 297.6 kB
Tags Source
SHA-256 checksum
How to use checksums
018e120ce95453559e4d429eca7c233941eddbd776863e584c0a05b92bc331dd
BLAKE2b-256 checksum
How to use checksums
7c2c57469bc747aefa674d1bc1a06cc9f337710772b71619488293a66a4a5afa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.12

Release files / integrum-0.1.0-py3-none-any.whl

Download URL integrum-0.1.0-py3-none-any.whl
Size 110.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2c125397ae55efef6c633666ed1bf2e8a4bb15c5b576200e84ac9bd5cd95d4b6
BLAKE2b-256 checksum
How to use checksums
10d99afe9c8813734361637ec503691639779fc5a2d73c2862d2df7fcb15aacf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.12

Release history Release notifications | RSS feed

0.1.1

2 release files

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page