An MCP (Model Context Protocol) server that provides a front-end for F*'s --ide stdio protocol. This enables AI assistants to interact with F* for typechecking, symbol lookup, and other IDE features via the MCP standard.
- Session Management: One session per file path with automatic replacement
- Full F IDE Protocol Support*: Typechecking, symbol lookup, and more
- Proof Context: Access proof obligations and goals during typechecking
# Build the server
cargo build --release
# Run the server
./target/release/fstar-mcpCreate a new F* session. All arguments are optional with sensible defaults.
Parameters:
file_path(string, optional): Path to the F* file. If omitted, creates a temporary .fst file.fstar_exe(string, optional): Path to fstar.exe. Defaults to 'fstar.exe' in PATH.cwd(string, optional): Working directory for F*. Defaults to the file's directory.include_dirs(array of strings, optional): Include directories (--include paths).options(array of strings, optional): F* command-line options (e.g.,['--cache_dir', '.cache']).
Returns:
{
"session_id": "uuid",
"status": "ok" | "error",
"diagnostics": [...],
"fragments": [...],
"created_at": "2024-01-01T00:00:00Z"
}List all active F* sessions with status information.
Parameters: None
Returns:
{
"sessions": [...],
"count": 2
}Typecheck code in an existing F* session.
Parameters:
session_id(string): Session ID fromcreate_sessioncode(string): The F* code to typechecklax(boolean, optional): If true, use lax mode (admits all SMT queries). Shortcut for kind='lax'kind(string, optional): Typecheck kind -"full","lax","cache","reload-deps","verify-to-position","lax-to-position". Default:"full". Overridden by lax=trueto_line(integer, optional): Line to typecheck to (for position-based kinds)to_column(integer, optional): Column to typecheck to (for position-based kinds)
Returns:
{
"status": "ok" | "error",
"diagnostics": [...],
"fragments": [...]
}Add or update a file in F*'s virtual file system (vfs-add).
Parameters:
session_id(string): Session ID fromcreate_sessionfile_path(string): Path to the file in the virtual file systemcontents(string): Contents of the file
Returns:
{
"status": "ok" | "error"
}Look up type information, documentation, and definition location for a symbol.
Parameters:
session_id(string): Session ID fromcreate_sessionfile_path(string): Path to the file containing the symbolline(integer): Line number (1-based)column(integer): Column number (0-based)symbol(string): The symbol to look up
Returns:
{
"kind": "symbol" | "module" | "not_found",
"name": "FStar.List.map",
"type_info": "('a -> 'b) -> list 'a -> list 'b",
"documentation": "...",
"defined_at": {
"file": "...",
"start_line": 1,
"start_column": 0,
"end_line": 1,
"end_column": 10
}
}Get proof obligations and goals at a position. Returns proof states collected during last typecheck.
Parameters:
session_id(string): Session ID fromcreate_sessionline(integer, optional): Line number to get proof state at. If omitted, returns all proof states.
Returns:
{
"found": true,
"line": 10,
"proof_state": {...}
}Or when no line is specified:
{
"count": 3,
"proof_states": [...]
}Restart the Z3 SMT solver for a session.
Parameters:
session_id(string): Session ID fromcreate_session
Returns:
{
"status": "ok"
}Close an F* session and clean up resources.
Parameters:
session_id(string): Session ID fromcreate_session
Returns:
{
"status": "ok"
}# Run tests
cargo test
# Run with debug logging
RUST_LOG=fstar_mcp=debug cargo runMIT