mcpstack-mimic


Namemcpstack-mimic JSON
Version 0.0.1 PyPI version JSON
download
home_pageNone
SummaryMIMIC-IV MCPStack tool (standalone package) with pluggable SQLite/BigQuery backends.
upload_time2025-08-20 03:11:54
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseNone
keywords mcp mcpstack mimic-iv tool healthcare bigquery sqlite
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div align="center">
  <h1 align="center">
    <br>
    <a href="#"><img src="assets/COVER.png" alt="MCPStack Tool" width="100%"></a>
    <br>
    MCPStack MIMIC MCP
    <br>
  </h1>
  <h4 align="center">Let Your Favourite LLM Dealing With The SQLs!</h4>
</div>

<div align="center">

<a href="https://pre-commit.com/">
  <img alt="pre-commit" src="https://img.shields.io/badge/pre--commit-enabled-1f6feb?style=for-the-badge&logo=pre-commit">
</a>
<img alt="ruff" src="https://img.shields.io/badge/Ruff-lint%2Fformat-9C27B0?style=for-the-badge&logo=ruff&logoColor=white">
<img alt="python" src="https://img.shields.io/badge/Python-3.9%2B-3776AB?style=for-the-badge&logo=python&logoColor=white">
<img alt="pytest coverage" src="https://img.shields.io/badge/Coverage-65%25-brightgreen?style=for-the-badge&logo=pytest">
<img alt="license" src="https://img.shields.io/badge/License-MIT-success?style=for-the-badge">

</div>

> [!IMPORTANT]
> If you have not been across the MCPStack main orchestrator repository, please start
> there: [View MCPStack](https://github.com/MCP-Pipeline/MCPStack)

## <a id="about-the-project"></a>💡 About The MCPStack MIMIC Tool

`MCPStack MIMIC` is an MCP tool that connects the **MIMIC-IV clinical database** (with either SQLite or BigQuery backends)
into your **MCPStack pipelines**.

In layman's terms:
* MIMIC-IV is a large, de-identified database of ICU patient records, commonly used for healthcare research.
* This tool makes that dataset accessible to an LLM in a controlled way.
* It provides actions like *listing available tables*, *showing table structure with sample data*, and *running queries*; all exposed through MCP so your model can reason with healthcare data securely.

### What is MCPStack, in layman's terms?

The **Model Context Protocol (MCP)** standardises how tools talk to large language models.
`MCPStack` is the orchestrator: it lets you **stack multiple MCP tools together** into a pipeline and then expose them
inside an LLM environment (like Claude Desktop).

Think of it like **scikit-learn pipelines, but for LLMs**:

* In scikit-learn: you chain `preprocessors`, `transformers`, `estimators`.
* In MCPStack: you chain MCP tools (like MIMIC, Jupyter Notebook MCP, etc).


>[!IMPORTANT]
> This MCP has been made possible thanks to the `M3` original work by @rafiattrach, @rajna-fani, @MoreiraP12
> Under Dr. Leo Celi's supervision at MIT Lab for Computational Physiology. Following a first pull request of
> MCPStack to `M3`, we realised that we needed to externalise MCPStack to make it more modular and reusable
> across different use-cases. As such, MCPStack MIMIC is a copy of the original `M3` codebase, with adjustments
> only based on how how MCPStack works, and how it is structured.

---

## Installation

You can install the MIMIC tool as a standalone package. Thanks to `pyproject.toml` entry points, MCPStack
will auto-discover it.

### PyPI Installation Via `UV`

```bash
uv add mcpstack_mimic
```

### PyPI Installation Via `pip`

```bash
pip install mcpstack-mimic
```

### Install pre-commit hooks (optional, for development)

```bash
uv run pre-commit install
# or pip install pre-commit
```

### Run Unit Tests (optional, for development)

```bash
uv run pytest
```

---

## 🔌 Using With MCPStack

The `MIMIC` tool is auto-registered in MCPStack through its entry points:

```toml
[project.entry-points."mcpstack.tools"]
mimic = "mcpstack_mimic.tools.mimic.mimic:MIMIC"
```

That means MCPStack will “see” it without any extra configuration.

### Initialise the database

For SQLite (demo dataset by default):

```bash
uv run mcpstack tools mimic init --dataset mimic-iv-demo
```

This downloads and prepares the dataset locally.

### Configure the tool

Pick a backend (SQLite or BigQuery):

```bash
uv run mcpstack tools mimic configure --backend sqlite --db-path ./mimic.db
```

or

```bash
uv run mcpstack tools mimic configure --backend bigquery --project-id <YOUR_GCP_PROJECT>
```

This generates a `mimic_config.json` you can later feed into pipelines.

### Check status

```python
uv run mcpstack tools mimic status
```

>[!NOTE]
> We favourite `uv` for running MCPStack commands, but you can also use `mcpstack` directly if installed globally
> with `pip install mcpstack`.

---

## 🖇️ Build A Pipeline With MIMIC

Now that the tool is installed and configured, add it to your pipeline:

### Default MIMIC Pipeline (Runs with demo MIMIC dataset)

```bash
uv run mcpstack pipeline mimic --new-pipeline my_pipeline.json
```

### Create a new pipeline and add MIMIC previously custom-configured

```bash
uv run mcpstack pipeline mimic --new-pipeline my_pipeline.json --tool-config mimic_config.json
```

Or append to an existing pipeline

```bash
uv run mcpstack pipeline mimic --to-pipeline existing_pipeline.json --tool-config mimic_config.json
```

### Run it inside Claude Desktop

```bash
uv run mcpstack build --pipeline my_pipeline.json
```

Your LLM can now use the MIMIC tool in conversation, with secure access to the clinical dataset.
Open Claude Desktop, and tada!

---

## 📖 Programmatic API

```python
from mcpstack_mimic.tools.mimic.mimic import MIMIC
from mcpstack_mimic.tools.mimic.backend.backends.sqlite import SQLiteBackend
from mcpstack.stack import MCPStackCore

pipeline = (
    MCPStackCore() #define =config if needed
    .with_tool(MIMIC(
        backends=[
            SQLiteBackend("<path_to_your_mimic.db>")  # SQLite backend with local MIMIC-IV database
        ])
    # Here you can add as many as new `.with_tool(.)` of interest to play with.
    ).build(
        type="fastmcp",
        save_path="my_mimic_pipeline.json",
    ).run()
)
```

>[!IMPORTANT]
> The current repository has (1) technical debts, as in it would benefit from a refactor to make it maybe less messy; for instance, organising the actions into specific files. (2) a lack of documentation, the readme could deserve more in depth exploration of all the possible configurations, explore the code if you are a developer ; it is a little codebase.
> Pull Requests are more than welcome to minimise the tech debts and improve the documentation.

---

## 📽️ Video Demo

<video src="https://github.com/user-attachments/assets/e13c4a56-0fe9-41be-b789-407355fe1f4a" width="320" height="240" controls></video>

🔐 License

MIT — see **[LICENSE](LICENSE)**.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "mcpstack-mimic",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": "mcp, mcpstack, mimic-iv, tool, healthcare, bigquery, sqlite",
    "author": null,
    "author_email": "Provost Simon <s.g.provost@kent.ac.uk>",
    "download_url": "https://files.pythonhosted.org/packages/93/5c/9c1c28c90f807cf3cb7543a48c165208fa1f06fb49f57cba6303fd949132/mcpstack_mimic-0.0.1.tar.gz",
    "platform": null,
    "description": "<div align=\"center\">\n  <h1 align=\"center\">\n    <br>\n    <a href=\"#\"><img src=\"assets/COVER.png\" alt=\"MCPStack Tool\" width=\"100%\"></a>\n    <br>\n    MCPStack MIMIC MCP\n    <br>\n  </h1>\n  <h4 align=\"center\">Let Your Favourite LLM Dealing With The SQLs!</h4>\n</div>\n\n<div align=\"center\">\n\n<a href=\"https://pre-commit.com/\">\n  <img alt=\"pre-commit\" src=\"https://img.shields.io/badge/pre--commit-enabled-1f6feb?style=for-the-badge&logo=pre-commit\">\n</a>\n<img alt=\"ruff\" src=\"https://img.shields.io/badge/Ruff-lint%2Fformat-9C27B0?style=for-the-badge&logo=ruff&logoColor=white\">\n<img alt=\"python\" src=\"https://img.shields.io/badge/Python-3.9%2B-3776AB?style=for-the-badge&logo=python&logoColor=white\">\n<img alt=\"pytest coverage\" src=\"https://img.shields.io/badge/Coverage-65%25-brightgreen?style=for-the-badge&logo=pytest\">\n<img alt=\"license\" src=\"https://img.shields.io/badge/License-MIT-success?style=for-the-badge\">\n\n</div>\n\n> [!IMPORTANT]\n> If you have not been across the MCPStack main orchestrator repository, please start\n> there: [View MCPStack](https://github.com/MCP-Pipeline/MCPStack)\n\n## <a id=\"about-the-project\"></a>\ud83d\udca1 About The MCPStack MIMIC Tool\n\n`MCPStack MIMIC` is an MCP tool that connects the **MIMIC-IV clinical database** (with either SQLite or BigQuery backends)\ninto your **MCPStack pipelines**.\n\nIn layman's terms:\n* MIMIC-IV is a large, de-identified database of ICU patient records, commonly used for healthcare research.\n* This tool makes that dataset accessible to an LLM in a controlled way.\n* It provides actions like *listing available tables*, *showing table structure with sample data*, and *running queries*; all exposed through MCP so your model can reason with healthcare data securely.\n\n### What is MCPStack, in layman's terms?\n\nThe **Model Context Protocol (MCP)** standardises how tools talk to large language models.\n`MCPStack` is the orchestrator: it lets you **stack multiple MCP tools together** into a pipeline and then expose them\ninside an LLM environment (like Claude Desktop).\n\nThink of it like **scikit-learn pipelines, but for LLMs**:\n\n* In scikit-learn: you chain `preprocessors`, `transformers`, `estimators`.\n* In MCPStack: you chain MCP tools (like MIMIC, Jupyter Notebook MCP, etc).\n\n\n>[!IMPORTANT]\n> This MCP has been made possible thanks to the `M3` original work by @rafiattrach, @rajna-fani, @MoreiraP12\n> Under Dr. Leo Celi's supervision at MIT Lab for Computational Physiology. Following a first pull request of\n> MCPStack to `M3`, we realised that we needed to externalise MCPStack to make it more modular and reusable\n> across different use-cases. As such, MCPStack MIMIC is a copy of the original `M3` codebase, with adjustments\n> only based on how how MCPStack works, and how it is structured.\n\n---\n\n## Installation\n\nYou can install the MIMIC tool as a standalone package. Thanks to `pyproject.toml` entry points, MCPStack\nwill auto-discover it.\n\n### PyPI Installation Via `UV`\n\n```bash\nuv add mcpstack_mimic\n```\n\n### PyPI Installation Via `pip`\n\n```bash\npip install mcpstack-mimic\n```\n\n### Install pre-commit hooks (optional, for development)\n\n```bash\nuv run pre-commit install\n# or pip install pre-commit\n```\n\n### Run Unit Tests (optional, for development)\n\n```bash\nuv run pytest\n```\n\n---\n\n## \ud83d\udd0c Using With MCPStack\n\nThe `MIMIC` tool is auto-registered in MCPStack through its entry points:\n\n```toml\n[project.entry-points.\"mcpstack.tools\"]\nmimic = \"mcpstack_mimic.tools.mimic.mimic:MIMIC\"\n```\n\nThat means MCPStack will \u201csee\u201d it without any extra configuration.\n\n### Initialise the database\n\nFor SQLite (demo dataset by default):\n\n```bash\nuv run mcpstack tools mimic init --dataset mimic-iv-demo\n```\n\nThis downloads and prepares the dataset locally.\n\n### Configure the tool\n\nPick a backend (SQLite or BigQuery):\n\n```bash\nuv run mcpstack tools mimic configure --backend sqlite --db-path ./mimic.db\n```\n\nor\n\n```bash\nuv run mcpstack tools mimic configure --backend bigquery --project-id <YOUR_GCP_PROJECT>\n```\n\nThis generates a `mimic_config.json` you can later feed into pipelines.\n\n### Check status\n\n```python\nuv run mcpstack tools mimic status\n```\n\n>[!NOTE]\n> We favourite `uv` for running MCPStack commands, but you can also use `mcpstack` directly if installed globally\n> with `pip install mcpstack`.\n\n---\n\n## \ud83d\udd87\ufe0f Build A Pipeline With MIMIC\n\nNow that the tool is installed and configured, add it to your pipeline:\n\n### Default MIMIC Pipeline (Runs with demo MIMIC dataset)\n\n```bash\nuv run mcpstack pipeline mimic --new-pipeline my_pipeline.json\n```\n\n### Create a new pipeline and add MIMIC previously custom-configured\n\n```bash\nuv run mcpstack pipeline mimic --new-pipeline my_pipeline.json --tool-config mimic_config.json\n```\n\nOr append to an existing pipeline\n\n```bash\nuv run mcpstack pipeline mimic --to-pipeline existing_pipeline.json --tool-config mimic_config.json\n```\n\n### Run it inside Claude Desktop\n\n```bash\nuv run mcpstack build --pipeline my_pipeline.json\n```\n\nYour LLM can now use the MIMIC tool in conversation, with secure access to the clinical dataset.\nOpen Claude Desktop, and tada!\n\n---\n\n## \ud83d\udcd6 Programmatic API\n\n```python\nfrom mcpstack_mimic.tools.mimic.mimic import MIMIC\nfrom mcpstack_mimic.tools.mimic.backend.backends.sqlite import SQLiteBackend\nfrom mcpstack.stack import MCPStackCore\n\npipeline = (\n    MCPStackCore() #define =config if needed\n    .with_tool(MIMIC(\n        backends=[\n            SQLiteBackend(\"<path_to_your_mimic.db>\")  # SQLite backend with local MIMIC-IV database\n        ])\n    # Here you can add as many as new `.with_tool(.)` of interest to play with.\n    ).build(\n        type=\"fastmcp\",\n        save_path=\"my_mimic_pipeline.json\",\n    ).run()\n)\n```\n\n>[!IMPORTANT]\n> The current repository has (1) technical debts, as in it would benefit from a refactor to make it maybe less messy; for instance, organising the actions into specific files. (2) a lack of documentation, the readme could deserve more in depth exploration of all the possible configurations, explore the code if you are a developer ; it is a little codebase.\n> Pull Requests are more than welcome to minimise the tech debts and improve the documentation.\n\n---\n\n## \ud83d\udcfd\ufe0f Video Demo\n\n<video src=\"https://github.com/user-attachments/assets/e13c4a56-0fe9-41be-b789-407355fe1f4a\" width=\"320\" height=\"240\" controls></video>\n\n\ud83d\udd10 License\n\nMIT \u2014 see **[LICENSE](LICENSE)**.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "MIMIC-IV MCPStack tool (standalone package) with pluggable SQLite/BigQuery backends.",
    "version": "0.0.1",
    "project_urls": null,
    "split_keywords": [
        "mcp",
        " mcpstack",
        " mimic-iv",
        " tool",
        " healthcare",
        " bigquery",
        " sqlite"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "bb4a99abb002a01a58f6864ee682bd34f46a652480224ca6a93b6e5437be6a8a",
                "md5": "74fde777dffc6a27ae9ff809be8d9b65",
                "sha256": "e1b08454cfc5db58c354eaaae638045d45d7bc504d53c7279ee196ce7b24a69c"
            },
            "downloads": -1,
            "filename": "mcpstack_mimic-0.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "74fde777dffc6a27ae9ff809be8d9b65",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 26853,
            "upload_time": "2025-08-20T03:11:52",
            "upload_time_iso_8601": "2025-08-20T03:11:52.906073Z",
            "url": "https://files.pythonhosted.org/packages/bb/4a/99abb002a01a58f6864ee682bd34f46a652480224ca6a93b6e5437be6a8a/mcpstack_mimic-0.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "935c9c1c28c90f807cf3cb7543a48c165208fa1f06fb49f57cba6303fd949132",
                "md5": "28f99528f68b2ec0be65e01d7d270c84",
                "sha256": "2839bd61a5615bf359ae0eeff5fbab8df061e6ec517520daff42e46077d86cb6"
            },
            "downloads": -1,
            "filename": "mcpstack_mimic-0.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "28f99528f68b2ec0be65e01d7d270c84",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 29786,
            "upload_time": "2025-08-20T03:11:54",
            "upload_time_iso_8601": "2025-08-20T03:11:54.502250Z",
            "url": "https://files.pythonhosted.org/packages/93/5c/9c1c28c90f807cf3cb7543a48c165208fa1f06fb49f57cba6303fd949132/mcpstack_mimic-0.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-20 03:11:54",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "mcpstack-mimic"
}
        
Elapsed time: 1.42551s