Skip to content

Commit 1d7c48a

Browse files
committed
refactor(docs): update readme
1 parent 88c2eb0 commit 1d7c48a

File tree

12 files changed

+3188
-97
lines changed

12 files changed

+3188
-97
lines changed

README.md

Lines changed: 122 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
1-
<!--suppress HtmlDeprecatedAttribute -->
21
<div align="center">
32
<h1 align="center">
43
<br>
54
<a href="#"><img src="assets/COVER.png" alt="MCPStack Tool" width="100%"></a>
65
<br>
7-
MCPStack Tool Builder
6+
MCPStack MIMIC MCP
87
<br>
98
</h1>
10-
<h4 align="center">A Template To Fasten The Creation of MCP-Stack MCP Tools</h4>
9+
<h4 align="center">Let Your Favourite LLM Dealing With The SQLs!</h4>
1110
</div>
1211

1312
<div align="center">
@@ -17,167 +16,194 @@
1716
</a>
1817
<img alt="ruff" src="https://img.shields.io/badge/Ruff-lint%2Fformat-9C27B0?style=for-the-badge&logo=ruff&logoColor=white">
1918
<img alt="python" src="https://img.shields.io/badge/Python-3.9%2B-3776AB?style=for-the-badge&logo=python&logoColor=white">
19+
<img alt="pytest coverage" src="https://img.shields.io/badge/Coverage-65%25-brightgreen?style=for-the-badge&logo=pytest">
2020
<img alt="license" src="https://img.shields.io/badge/License-MIT-success?style=for-the-badge">
2121

2222
</div>
2323

2424
> [!IMPORTANT]
2525
> If you have not been across the MCPStack main orchestrator repository, please start
26-
> there: [View Org](https://github.com/MCP-Pipeline)
26+
> there: [View MCPStack](https://github.com/MCP-Pipeline/MCPStack)
2727
28-
## <a id="about-the-project"></a>💡 About The Project
28+
## <a id="about-the-project"></a>💡 About The MCPStack MIMIC Tool
2929

30-
`MCPStack Tool Builder` is a template repository designed to streamline the creation of `MCPStack` MCP Tools.
31-
As in, you are using the `MCPStack` main orchestrator repository and wish to create a new MCP tool to pipeline with.
32-
You can always start from scratch, but certainly, our `MCPStack Tool Builder` will help you get started quickly with a
33-
solid foundational skeleton builder.
30+
`MCPStack MIMIC` is an MCP tool that connects the **MIMIC-IV clinical database** (with either SQLite or BigQuery backends)
31+
into your **MCPStack pipelines**.
3432

35-
**Wait, what is a Model Context Protocol (MCP) & `MCPStack` — In layman's terms ?**
33+
In layman's terms:
34+
* MIMIC-IV is a large, de-identified database of ICU patient records, commonly used for healthcare research.
35+
* This tool makes that dataset accessible to an LLM in a controlled way.
36+
* 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.
3637

37-
The Model Context Protocol (MCP) standardises interactions with machine learning (Large Language) models,
38-
enabling tools and libraries to communicate successfully with a uniform workflow.
38+
### What is MCPStack, in layman's terms?
3939

40-
On the other hand, `MCPStack` is a framework that implements the protocol, and most importantly, allowing
41-
developers to create pipelines by stacking MCP tools of interest and launching them all in Claude Desktop.
42-
This allows the LLM to use all the tools stacked, and of course, if a tool is not of interest, do not include it in the
43-
pipeline and the LLM won't have access to it.
40+
The **Model Context Protocol (MCP)** standardises how tools talk to large language models.
41+
`MCPStack` is the orchestrator: it lets you **stack multiple MCP tools together** into a pipeline and then expose them
42+
inside an LLM environment (like Claude Desktop).
4443

45-
## Installation
44+
Think of it like **scikit-learn pipelines, but for LLMs**:
4645

47-
> [!NOTE]
48-
> As this repository is a template, you can always create a new repository from this template. Use
49-
> the "Use this template" button on the top right of the GitHub UI to create a new repository based on this template.
46+
* In scikit-learn: you chain `preprocessors`, `transformers`, `estimators`.
47+
* In MCPStack: you chain MCP tools (like MIMIC, Jupyter Notebook MCP, etc).
5048

51-
Meanwhile, you may alos clone this repository and install it locally to start building your own `MStack` MCP tool.
5249

53-
### Clone the repository
50+
>[!IMPORTANT]
51+
> This MCP has been made possible thanks to the `M3` original work by @rafiattrach, @rajna-fani, @MoreiraP12
52+
> Under Dr. Leo Celi's supervision at MIT Lab for Computational Physiology. Following a first pull request of
53+
> MCPStack to `M3`, we realised that we needed to externalise MCPStack to make it more modular and reusable
54+
> across different use-cases. As such, MCPStack MIMIC is a copy of the original `M3` codebase, with adjustments
55+
> only based on how how MCPStack works, and how it is structured.
5456
55-
```bash
56-
git clone https://github.com/MCP-Pipeline/MCPStack-Tool-Builder.git
57-
cd MCPStack-Tool-Builder
58-
```
57+
---
58+
59+
## Installation
5960

60-
### Install dependencies
61+
You can install the MIMIC tool as a standalone package. Thanks to `pyproject.toml` entry points, MCPStack
62+
will auto-discover it.
6163

62-
Using `UV` (recommended —— See official [UV documentation for installation of UV](https://uv.dev/docs/)):
64+
### PyPI Installation Via `UV`
6365

6466
```bash
65-
uv sync
67+
uv add mcpstack_mimic
6668
```
6769

68-
Using `pip`:
70+
### PyPI Installation Via `pip`
6971

7072
```bash
71-
pip install -e .[dev]
73+
pip install mcpstack-mimic
7274
```
7375

74-
### Install pre-commit hooks
75-
76-
Via `UV`:
76+
### Install pre-commit hooks (optional, for development)
7777

78-
```bash
78+
```bash
7979
uv run pre-commit install
80-
```
80+
# or pip install pre-commit
81+
```
8182

82-
Via `pip`:
83+
### Run Unit Tests (optional, for development)
8384

8485
```bash
85-
pre-commit install
86+
uv run pytest
8687
```
8788

88-
## Create Your Tool's Skeleton
89+
---
8990

90-
Once dependencies are installed, you can use the `mcpstack_tool` CLI to bootstrap and customise your tool’s skeleton.
91-
Every commands is run with `uv run mcpstack_tool.py` or `python mcpstack_tool.py` if you are not using `UV`, followed by the command you want to run; as follows:
91+
## 🔌 Using With MCPStack
9292

93-
<img src="assets/readme/help.gif" width="61.8%" align="left" style="border-radius: 10px;"/>
93+
The `MIMIC` tool is auto-registered in MCPStack through its entry points:
9494

95-
### `Help` Banner
96-
97-
Run with `--help` or `-h` to display the banner and see all available commands.
98-
99-
```bash
100-
uv run mcpstack_tool.py --help
95+
```toml
96+
[project.entry-points."mcpstack.tools"]
97+
mimic = "mcpstack_mimic.tools.mimic.mimic:MIMIC"
10198
```
10299

103-
<br clear="left">
104-
105-
<br />
100+
That means MCPStack will “see” it without any extra configuration.
106101

107-
<img src="assets/readme/init.gif" width="61.8%" align="right" style="border-radius: 10px;"/>
102+
### Initialise the database
108103

109-
### `Init`
104+
For SQLite (demo dataset by default):
110105

111-
init starts an interactive prompt command-line-based process to generate your tool configuration.
112-
It will ask you for values like `tool_slug`, `class_name`, and `env_prefix`.
113-
114-
115-
<br clear="right">
116-
117-
<br />
106+
```bash
107+
uv run mcpstack tools mimic init --dataset mimic-iv-demo
108+
```
118109

119-
<img src="assets/readme/preview.gif" width="61.8%" align="left" style="border-radius: 10px;"/>
110+
This downloads and prepares the dataset locally.
120111

121-
### `Preview`
112+
### Configure the tool
122113

123-
preview shows you the replacements that would be applied across the codebase and displays an example diff.
124-
Note this could be also run from the `init`.
114+
Pick a backend (SQLite or BigQuery):
125115

126-
<br clear="left">
116+
```bash
117+
uv run mcpstack tools mimic configure --backend sqlite --db-path ./mimic.db
118+
```
127119

128-
<br />
120+
or
129121

130-
<img src="assets/readme/apply.gif" width="61.8%" align="right" style="border-radius: 10px;"/>
122+
```bash
123+
uv run mcpstack tools mimic configure --backend bigquery --project-id <YOUR_GCP_PROJECT>
124+
```
131125

132-
### `Apply`
126+
This generates a `mimic_config.json` you can later feed into pipelines.
133127

134-
Once happy, use apply to perform replacements and rename the package directory. Note this could be also run from the `init`.
128+
### Check status
135129

136-
<br clear="right">
130+
```python
131+
uv run mcpstack tools mimic status
132+
```
137133

138-
<br />
134+
>[!NOTE]
135+
> We favourite `uv` for running MCPStack commands, but you can also use `mcpstack` directly if installed globally
136+
> with `pip install mcpstack`.
139137
140-
<img src="assets/readme/validate.gif" width="61.8%" align="left" style="border-radius: 10px;"/>
138+
---
141139

142-
### `Validate`
140+
## 🖇️ Build A Pipeline With MIMIC
143141

144-
Run validate to ensure placeholders were replaced correctly (or to check if any remain).
142+
Now that the tool is installed and configured, add it to your pipeline:
145143

146-
<br clear="left">
144+
### Default MIMIC Pipeline (Runs with demo MIMIC dataset)
147145

148-
<br />
146+
```bash
147+
uv run mcpstack pipeline mimic --new-pipeline my_pipeline.json
148+
```
149149

150-
<img src="assets/readme/reset.gif" width="61.8%" align="right" style="border-radius: 10px;"/>
150+
### Create a new pipeline and add MIMIC previously custom-configured
151151

152-
### `Reset` (Optional)
152+
```bash
153+
uv run mcpstack pipeline mimic --new-pipeline my_pipeline.json --tool-config mimic_config.json
154+
```
153155

154-
Need to start fresh? Restore everything back from the scaffold with reset.
156+
Or append to an existing pipeline
155157

156-
> [!CAUTION]
157-
> ⚠️ Use --hard to overwrite files directly.
158+
```bash
159+
uv run mcpstack pipeline mimic --to-pipeline existing_pipeline.json --tool-config mimic_config.json
160+
```
158161

159-
<br clear="right">
162+
### Run it inside Claude Desktop
160163

161-
<br />
164+
```bash
165+
uv run mcpstack build --pipeline my_pipeline.json
166+
```
162167

163-
<img src="assets/readme/doctor.gif" width="61.8%" align="left" style="border-radius: 10px;"/>
168+
Your LLM can now use the MIMIC tool in conversation, with secure access to the clinical dataset.
169+
Open Claude Desktop, and tada!
170+
171+
---
172+
173+
## 📖 Programmatic API
174+
175+
```python
176+
from mcpstack_mimic.tools.mimic.mimic import MIMIC
177+
from mcpstack_mimic.tools.mimic.backend.backends.sqlite import SQLiteBackend
178+
from mcpstack.stack import MCPStackCore
179+
180+
pipeline = (
181+
MCPStackCore() #define =config if needed
182+
.with_tool(MIMIC(
183+
backends=[
184+
SQLiteBackend("<path_to_your_mimic.db>") # SQLite backend with local MIMIC-IV database
185+
])
186+
# Here you can add as many as new `.with_tool(.)` of interest to play with.
187+
).build(
188+
type="fastmcp",
189+
save_path="my_mimic_pipeline.json",
190+
).run()
191+
)
192+
```
164193

165-
### `Doctor`
194+
>[!IMPORTANT]
195+
> 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.
196+
> Pull Requests are more than welcome to minimise the tech debts and improve the documentation.
166197
167-
Finally, check the health of your repository with doctor.
168-
It reports `package dirs`, `entry points`, and `placeholder` status.
198+
---
169199

170-
<br />
171-
<br />
172-
<br />
200+
## 📽️ Video Demo
173201

174-
Here you go! 🎉 You now have a working `MCPStack` tool skeleton ready to customise.
175-
From here, edit `src/mcpstack_<your_tool_name>/tool.py` with the actions your MCP is aimed to be doing,
176-
and `cli.py` to implement your configurability logic. Remove a couple of files and folders not necessary as per the template
177-
and you may be good to go to submit this to the org or to play with it yourself!
202+
<iframe width="560" height="315" src="https://github.com/MCP-Pipeline/mcpstack-mimic/blob/main/assets/readme/pres.mp4" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
178203

179-
Refer to the `MCPStack` documentation for more details on how to implement your tool logic.
204+
---
180205

181-
## 🔐 License
206+
🔐 License
182207

183208
MIT — see **[LICENSE](LICENSE)**.
209+

assets/COVER.png

-664 KB
Loading

assets/readme/apply.gif

-8.9 MB
Binary file not shown.

assets/readme/doctor.gif

-2.32 MB
Binary file not shown.

assets/readme/help.gif

-5.92 MB
Binary file not shown.

assets/readme/init.gif

-4.93 MB
Binary file not shown.

assets/readme/pres.mp4

3.21 MB
Binary file not shown.

assets/readme/preview.gif

-1.64 MB
Binary file not shown.

assets/readme/reset.gif

-1.42 MB
Binary file not shown.

assets/readme/validate.gif

-2.4 MB
Binary file not shown.

0 commit comments

Comments
 (0)