Skip to main content
Glama
README.md
# mcpSkfolio
mcp server for the skfolio package
this server manages the context for LLMs to translate a prompt with a strategy into code and relavent backtests. The model context protocol connects LLMs with specific task related **tools**, **resources**, and example **prompts** to help the LLMs with the coding tasks.

As the computation will be handled by skfolio, the MCP will provide relavant **resources** and augmented **prompts** to the LLM for the coding task, and the **tools** will help locating which resources to look at and the prompt engineering.
The current implementation focuses on the B2B application, which means it functions as a coding agent that does not directly run computation but writes the code and test needed for idea implementation.

#### Resources
Documentation, examples, code implementation
#### Tools
Categorizing user requests and find the correct funtions and classes


## Prerequisites

Before using this MCP server, you need to install:

1. **Docker** - Download and install from [docker.com](https://www.docker.com/products/docker-desktop/)
2. **Cursor IDE** - This MCP is currently only compatible with Cursor

## Installation

[![Install MCP Server](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en/install-mcp?name=skfolio-context&config=eyJjb21tYW5kIjoiZG9ja2VyIHJ1biAtLXJtIC1pIG1veXVhbmNoZW5tb3l1YW4vc2tmb2xpby1tY3A6bGF0ZXN0IiwiZW52Ijp7fX0%3D)


## Example Prompt

Using skfolio, build a minimum variance portfolio with a target annual return of 15% with training data from 2010 - 2012 and backtest with data from 2012-2013.
<!-- \n+## Run this MCP server
\n+This repo includes an MCP server (`server.py`) that exposes read-only docs and prompts for coding with installed packages (like `skfolio`). It does not execute computations.
\n+- Dev mode (Inspector):
	- `uv run mcp dev server.py`
\n+- Install in Claude Desktop:
	- `uv run mcp install server.py --name "skfolio context"`
\n+### What it exposes
\n+- Resources
	- `pkg://{package}/index` — summarize public symbols in a package.
	- `symbol://{qualified}` — doc, signature, examples for a specific symbol.
\n+- Tools
	- `search_symbols(query, package, limit=10)` — find relevant symbols and short docs.
	- `build_augmented_prompt(task, package, limit=6)` — find symbols and return an augmented prompt plus references.
\n+- Prompts
	- `Code with curated package symbols` — template asking the LLM to only use provided symbols and include minimal tests/comments.
\n+### Typical flow
\n+1) Use `search_symbols` to find candidates in `skfolio` (or any installed package).
2) Load `symbol://...` resources to get concise docs/examples into context.
3) Use the prompt or `build_augmented_prompt` to get tailored instructions.
4) Have your agent write code and tiny tests using only the allowed symbols. -->