PyBaMM MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@PyBaMM MCP Serversearch PyBaMM docs for single particle model"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
PyBaMM MCP Server
This project exposes PyBaMM documentation and source code through a local MCP server so an LLM-enabled IDE can search docs and open files directly from tools.
What This Server Does
At startup, the project prepares three things:
A local clone of the PyBaMM repository (
./PyBaMM)Built plain-text docs (
PyBaMM/docs/_build/text)A full-text SQLite index (
pybamm_docs.db)
Then server.py starts an MCP stdio server that provides these tools:
search_pybamm_docs(query): full-text search across PyBaMM docsread_doc_page(filepath): read one docs text page from search resultsread_pybamm_source_code(module_path): open source files from the cloned repo
Related MCP server: Code Search MCP
Prerequisites
Docker workflow
Docker
Docker Compose v2 (
docker compose)
Local (non-Docker) workflow
Python 3.11+
Git
makepandoc
Install And Run With Docker
From this repository root:
docker compose build
docker compose run --rm --no-deps -T pybamm-mcpNotes:
The first build can take a while because it builds PyBaMM docs.
Transport is stdio (no HTTP/TCP port).
Rebuild after changing
Dockerfile,requirements.txt,build_index.py, orserver.py:
docker compose build --no-cacheInstall And Run Locally
From this repository root:
python -m venv .venv
source .venv/bin/activate
pip install --upgrade pip setuptools wheel
pip install -r requirements.txt
git clone --depth 1 --branch main https://github.com/pybamm-team/PyBaMM.git PyBaMM
pip install -e ./PyBaMM
make -C PyBaMM/docs text
python build_index.py
python server.pyNotes:
server.pyexpects paths relative to this repo root. Run it from here.If
PyBaMM/already exists, skip the clone command.Rebuild docs/index after updating the PyBaMM checkout:
make -C PyBaMM/docs text
python build_index.pyConfigure Your IDE MCP Client
Most MCP-enabled IDEs use a JSON server entry with:
a command to run
args
optional
cwd
Add one of the following entries in your IDE MCP settings.
Option A: Docker-backed server (recommended for consistency)
{
"mcpServers": {
"pybamm-docs": {
"command": "docker",
"args": [
"compose",
"-f",
"/absolute/path/to/pybamm_mcp_server/docker-compose.yml",
"run",
"--rm",
"--no-deps",
"-T",
"pybamm-mcp"
]
}
}
}Option B: Local virtualenv server (fastest startup after setup)
{
"mcpServers": {
"pybamm-docs": {
"command": "/absolute/path/to/pybamm_mcp_server/.venv/bin/python",
"args": ["/absolute/path/to/pybamm_mcp_server/server.py"],
"cwd": "/absolute/path/to/pybamm_mcp_server"
}
}
}Option C: IDE running on Windows, server in WSL
If your IDE launches commands in Windows but your project is in WSL:
{
"mcpServers": {
"pybamm-docs": {
"command": "wsl",
"args": [
"-e",
"bash",
"-lc",
"cd /absolute/path/to/pybamm_mcp_server && .venv/bin/python server.py"
]
}
}
}Verify IDE Connection
After adding the server config:
Restart your IDE MCP service (or the IDE itself).
Confirm
pybamm-docsshows as connected.Run a quick tool call, for example:
search_pybamm_docs("single particle model").
If the server fails to start, most issues are one of:
wrong absolute path in MCP config
missing docs/index (
make textandpython build_index.pynot run)wrong working directory (must be this repo root for local mode)
This server cannot be deployed
Maintenance
Related MCP Connectors
Code intelligence for LLMs. Analyze, search, and retrieve code from any public git repository.
Search arXiv/Semantic Scholar/OpenAlex + medical evidence (PubMed/Europe PMC) + LaTeX/PDF tools.
Versioned documentation registry and semantic search for AI tools and coding assistants.
Search GitHub, npm, PyPI, StackOverflow, ArXiv from one MCP — built for coding agents.
Related MCP Servers
- AlicenseNot gradedqualityNot gradedmaintenanceEnables access to scientific simulation documentation and code snippets for simulators like PyBaMM and Cantera. Provides AI-powered search and retrieval of simulation examples and documentation through natural language queries.MIT
- FlicenseNot gradedqualityDmaintenanceEnables LLMs to perform high-performance code search and analysis across multiple languages using symbol indexing, regex text search, and structural AST pattern matching. It also provides tools for technology stack detection and dependency analysis with persistent caching for optimized performance.8-
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to access and search MkDocs documentation through tools for full-text search, page navigation, and code block extraction. It serves documentation pages as readable resources and provides structural outlines to help LLMs navigate documentation content.MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to explore, search, and read codebase repositories and API specifications efficiently, with support for file searching, content search via ripgrep, and reading API specs.13 npmISC