Features
MCP server
Let your coding assistant search VBT docs, look up the API, and run code over MCP
Can your own AI coding assistant use VBT directly? The VBT MCP server connects any client that supports the Model Context Protocol, such as Claude Code, Codex, or Cursor, to your installation, so the assistant can search the documentation, look up the API, read source code, and run Python backtests. Keep working in your editor while the assistant checks VBT examples and tests changes against your installed package.
vbt mcp config claude-code
claude mcp add --transport stdio vectorbtpro -- /path/to/python -m vectorbtpro.mcp_serverAsked to add a 5% stop loss and a 10% take profit to a moving average crossover, an assistant
connected to the server makes calls like these. The tools are Python functions in vbt.mcp, so the
same calls run without a server:
import json
from vectorbtpro import mcp
found = mcp.search(
"stop loss and take profit in from_signals",
asset_names=["docs"],
n=3,
)
for result in json.loads(found):
print(result["name"])Stop signals
Discretionary Signal Backtesting
High-level VBTprint(mcp.resolve_refnames(["vbt.PF.from_signals"])) OK vbt.PF.from_signals vectorbtpro.portfolio.base.Portfolio.from_signalsprint(mcp.run_code("""
data = vbt.YFData.pull("BTC-USD", start="2020-01-01", end="2025-01-01")
fast = data.close.vbt.rolling_mean(20)
slow = data.close.vbt.rolling_mean(50)
pf = vbt.PF.from_signals(
data,
fast.vbt.crossed_above(slow),
fast.vbt.crossed_below(slow),
sl_stop=0.05,
tp_stop=0.10,
fees=0.001,
)
print(pf.stats(["total_return", "max_dd", "total_trades", "win_rate"]))
""")) Total Return [%] -18.880116
Max Drawdown [%] 38.686652
Total Trades 19
Win Rate [%] 26.315789
dtype: objectThe assistant found the tutorial on stop signals, confirmed the method, and ran a real backtest in your environment. You get the code and calculated statistics together, ready to inspect the trades, adjust the settings, and run the next comparison.
From a question to a tested backtest
The connection is useful throughout a research project. You can ask your assistant to:
- Find the VBT method and examples for a strategy idea before writing the code.
- Read the relevant API and source to investigate an error in your backtest.
- Compare fees, slippage, or stop settings and show the resulting statistics.
- Use walk-forward validation to test chosen parameters on later data.
For example, after the backtest above, ask it to compare the same strategy with and without stops
while keeping fees and signals fixed. The persistent kernel keeps data, fast, slow, and pf
available for follow-up calls, so the assistant can reuse the loaded data and inspect the trades.
You can also give it a member page URL and ask it to read the page. The server retrieves the text from the release's knowledge assets, using your configured GitHub access. It does not need to control your browser or use its sign-in session. Long pages can be read section by section, and community answers can be opened as whole threads.
Agent skills for research tasks
VBT ships with step-by-step instructions for common tasks, including backtesting, indicators,
parameter optimization, and cross-validation. The assistant can discover them through list_skills
and read the relevant instructions with get_skill. This gives it a procedure to follow alongside
the API reference and code examples.
For a parameter search, for example, the cross-validation skill covers train and test periods, indicator warmup, and what happens to open positions when parameters change. The members-only skills pages show the procedures available to your assistant.
Server
The server runs on your machine with your VBT installation, so API and source lookups use the
version you have installed. Clients usually start it themselves over stdio. To run it in another
environment, such as a container or WSL, start it over HTTP with
vbt mcp serve --transport streamable-http --port 8000 and register its /mcp address in the
client. Over HTTP, the server binds to the local machine by default. run_code, which executes
code, is available only over stdio.
Over stdio, run_code uses a persistent Jupyter kernel in your VBT environment. Your client's
approval controls let you decide which code the assistant runs. The setup guide below covers
installation and client configuration.
get_environment reports the Python interpreter and the Python and VBT versions, so an assistant
can check its setup first. The first search after starting the server loads the knowledge assets,
which takes the most time, and later searches reuse them. When embeddings for some documents are
missing, search ranks them by keywords instead of generating the embeddings first. Tools support
token budgets and pagination, so the assistant can request a focused result and read more when
needed.
Tools
| Tool | What it does |
|---|---|
search | Ranks documentation, API, examples, and community answers for a query |
find | Returns the material about specific objects, such as vbt.PF.from_signals |
resolve_refnames | Turns names like vbt.Data into fully qualified names |
get_page, get_message, get_message_block, get_message_thread | Read a page, a message, consecutive messages from one author, or a whole discussion by its link |
find_concepts, get_concept | Search the concept map and see how concepts relate |
get_attrs, get_source | List an object's attributes, read its source code |
list_skills, get_skill | Read the agent skills that ship with VBT |
run_code | Runs Python with VBT in a persistent Jupyter kernel |
get_environment | Reports the Python interpreter and the Python and VBT versions |
Every tool also runs from the terminal, as in vbt mcp search "rolling Sharpe ratio", and from
Python through vbt.mcp. The server exposes these functions as MCP tools, including the tools that
read documentation. You can also use them from the
AI research assistant inside Python.
Guide
The members-only Using AI guide sets up the server for each client, serves it over HTTP, and lists prompts to try.
Related pages
- AI research assistantChat with an assistant grounded in VBT docs and examples, with tools and reasoning
- Knowledge searchSearch docs, API, examples, and community answers with keyword and embedding ranking
- Features › AIGet help with Python backtests, search VBT knowledge, and connect your coding assistant
- Research toolkit › Developer toolsSearch the API, read source, draw reference graphs, and extend classes with factories
Copyright © 2021–2026 Oleg Polakow. All rights reserved.
Site content and documentation are provided for using and evaluating VectorBT PRO and for educational purposes. Any other use, including building or supporting competing products or services, requires prior written consent.