This guide explains how to use fsi-mcp-server in your Neovim setup for F# development.
fsi-mcp-server is an enhanced F# Interactive (FSI) server that provides Model Context Protocol (MCP) capabilities, offering better integration and features compared to the standard dotnet fsi.
First, you need to install fsi-mcp-server. You can typically install it via:
# Using dotnet tool (if available)
dotnet tool install -g fsi-mcp-server
# Or via npm (if it's packaged that way)
npm install -g fsi-mcp-serverCheck if it's installed correctly:
fsi-mcp-server --versionYour Neovim configuration now automatically detects and prefers fsi-mcp-server when available:
-
Automatic Detection: When you send F# code to the REPL (using
<M-CR>), Neovim checks:- Is
fsi-mcp-serveravailable? → Use it - Otherwise → Fall back to standard
dotnet fsivia Ionide
- Is
-
Manual Terminal Control: You can explicitly open FSI terminals:
<leader>tf- Auto-detect and use best available FSI<leader>tm- Force use of fsi-mcp-server<leader>td- Force use of standard dotnet fsi
<M-CR>(Alt+Enter) in normal mode: Send current line to FSI REPL<M-CR>(Alt+Enter) in visual mode: Send selected lines to FSI REPL
These now prefer fsi-mcp-server when available!
<leader>tf: Toggle FSI REPL (auto-detects best option)<leader>tm: Toggle FSI-MCP REPL (forces fsi-mcp-server)<leader>td: Toggle Dotnet FSI REPL (forces standard fsi)
- Open an F# file (
.fsor.fsx) - Press
<leader>tfto open the FSI REPL (will use fsi-mcp-server if installed) - Write some F# code:
let add x y = x + y let result = add 5 3
- In normal mode, put cursor on a line and press
<Alt-Enter>to send it to REPL - Or select multiple lines in visual mode and press
<Alt-Enter>to evaluate them
If you want to test with standard FSI even when fsi-mcp-server is installed:
- Press
<leader>tdto open standard dotnet fsi - Then use
<Alt-Enter>as usual (will use the open terminal)
The following files were created/modified:
-
lua/plugins/fsi-mcp.lua(NEW)- Core functionality for fsi-mcp-server integration
- Auto-detection logic
- Terminal management
- Send-to-REPL functions
-
lua/config/keymaps.lua(MODIFIED)- Updated
<M-CR>mappings to prefer fsi-mcp-server - Falls back gracefully to Ionide's FSI if fsi-mcp-server isn't available
- Updated
This means the executable isn't in your PATH. To fix:
- Install fsi-mcp-server (see Installation section)
- Ensure it's in your PATH:
$env:PATH - Restart Neovim
This is expected if fsi-mcp-server isn't installed. The setup gracefully falls back to standard FSI.
Ensure you have .NET SDK installed:
dotnet --versionWhen using fsi-mcp-server over standard FSI, you get:
- Better integration with MCP-compatible tools
- Enhanced REPL capabilities
- Improved code completion context
- Better error reporting
If you want to completely disable fsi-mcp-server preference:
- Edit
lua/config/keymaps.lua - Find the lines checking
vim.fn.executable("fsi-mcp-server") - Comment them out to always use Ionide's standard FSI
Or simply don't install fsi-mcp-server - the configuration will automatically use standard FSI.
- Ionide Documentation
- F# Interactive:
dotnet fsi --help - Your Ionide config:
lua/plugins/ionide.lua