Skip to content

MCP client configuration

FsLangMCP is a standard MCP stdio server. This page covers per-client wiring. All clients use the same executable (fslangmcp) and the same set_project first-call pattern; only the config file location and format differ.

Prerequisite: install FsLangMCP first — see Getting started.

Claude Code

Add with the CLI:

claude mcp add --scope project fslangmcp -- fslangmcp

Or create / edit .mcp.json in the project root (committed to the repo so all contributors share it):

{
  "mcpServers": {
    "fslangmcp": { "command": "fslangmcp" }
  }
}

To pre-load a project at startup, pass it as an argument:

{
  "mcpServers": {
    "fslangmcp": {
      "command": "fslangmcp",
      "args": ["--project", "/absolute/path/to/App.fsproj"]
    }
  }
}

--project runs the same project-load/readiness pipeline as the MCP set_project tool before the server starts reading stdio. Startup fails rather than serving with a half-loaded context. When --project is omitted, call set_project once at the start of the session.

Cursor

Create or edit .cursor/mcp.json in the repo root:

{
  "mcpServers": {
    "fslangmcp": { "command": "fslangmcp" }
  }
}

With a pre-loaded project:

{
  "mcpServers": {
    "fslangmcp": {
      "command": "fslangmcp",
      "args": ["--project", "/absolute/path/to/App.fsproj"]
    }
  }
}

When no --project argument is configured, call set_project as the first tool call. Add the tool-discipline rule to .cursorrules so Cursor's agent knows to use find and check instead of grep — the snippet is in Agent integration guide.

Codex (OpenAI)

Add FsLangMCP from the command line:

codex mcp add fslangmcp -- fslangmcp

Codex also reads MCP server configuration from ~/.codex/config.toml, or from .codex/config.toml in a trusted project. Each server is a [mcp_servers.<name>] table:

[mcp_servers.fslangmcp]
command = "fslangmcp"
args    = []

Codex's config schema is evolving — see Codex's MCP documentation for the current exact key names if the above doesn't match your installed version.

Put the tool-discipline rules in AGENTS.md at the repo root (Codex's equivalent of CLAUDE.md). The snippet from the Agent integration guide applies unchanged.

GitHub Copilot CLI

Add FsLangMCP to the user configuration at ~/.copilot/mcp-config.json:

copilot mcp add fslangmcp -- fslangmcp

For a shared project configuration, create .github/mcp.json:

{
  "mcpServers": {
    "fslangmcp": {
      "type": "local",
      "command": "fslangmcp",
      "args": []
    }
  }
}

Copilot CLI also reads a repository-level .mcp.json, but its local-server schema includes "type": "local"; do not copy the Claude Code example without adding that field. Project-level servers are loaded only after the repository folder is trusted. See GitHub's current Copilot CLI MCP documentation for precedence and trust details.

VS Code with GitHub Copilot

Create .vscode/mcp.json in the workspace:

{
  "servers": {
    "fslangmcp": {
      "type": "stdio",
      "command": "fslangmcp"
    }
  }
}

See the current VS Code MCP documentation for user-profile, remote-workspace, and sandbox options.

Add tool-discipline instructions to .github/copilot-instructions.md (Copilot's project-rules file). The AGENT_INTEGRATION.md snippet applies.

Generic MCP stdio

Any MCP client that supports stdio transport can run FsLangMCP. The minimal server entry is:

{
  "command": "fslangmcp"
}

or with explicit args:

{
  "command": "fslangmcp",
  "args": ["--project", "/absolute/path/to/App.fsproj"]
}

Place it under whatever key your client uses for MCP server definitions (commonly mcpServers, mcp.servers, or servers).

First-call pattern — all clients

Unless the server was started with --project (or FSA_PROJECT_PATH), the first tool call in every agent session must be set_project:

set_project { "projectPath": "/absolute/path/to/App.sln" }

The LSP-proxy tools (textDocument_*, fsharp_signature_data) require project preload to have completed and readiness.lsp to be true before they return data. Their responses are bound to activeProjectPath and sessionGeneration.

Parallel agent usage

When multiple agents target the same FsLangMCP instance but different projects, pass projectPath explicitly on every FCS tool call. FCS caches project-wide results per resolved .fsproj, so agents targeting different projects share no stale caches:

{ "path": "/abs/path/File.fs", "projectPath": "/abs/path/App.fsproj" }

FSAC itself still has exactly one active project context. A request for a file or project outside it returns context_mismatch; switching a live FSAC to another project with restartLsp=false returns restart_required without changing the active context.

Concurrency limits:

  • FSLANGMCP_MAX_CONCURRENT_FCS=2
  • LSP tools are always serialized because FSAC owns one mutable workspace.

Local dev (without global install)

If you're developing FsLangMCP itself or want to run an uninstalled build:

{
  "mcpServers": {
    "fslangmcp": {
      "command": "dotnet",
      "args": [
        "run", "--project", "/path/to/FsLangMcp.fsproj",
        "--", "--project", "/absolute/path/to/App.fsproj"
      ]
    }
  }
}

Runtime options

All clients can pass these args in the args array:

ArgPurpose
--project <path> / -p <path>Pre-load a project on startup
--fsac-command <cmd>Override the fsautocomplete executable
--fsac-args "<args>"Pass extra args to FSAC
--bootstrap-toolsInstall/downgrade the exact supported global FSAC/ProjInfo/Fantomas versions from the release's embedded manifest
--versionPrint the packaged FsLangMCP version and exit

Environment variable fallbacks and limits:

VariableDefaultPurpose
FSAC_COMMANDfsautocompleteFSAC executable
FSAC_ARGSemptyExtra FSAC arguments
FSA_PROJECT_PATHunsetPre-load this project/workspace through the same pipeline as --project
FSLANGMCP_MAX_CONCURRENT_FCS2Maximum concurrent FCS tool calls
FSLANGMCP_LSP_STARTUP_TIMEOUT_MS60000initialize / workspaceLoad RPC timeout
FSLANGMCP_LSP_REQUEST_TIMEOUT_MS30000Live LSP request/notification timeout
FSLANGMCP_PROJ_INFO_TIMEOUT_MS120000ProjInfo child-process, evaluated-project, and readiness-probe timeout
FSLANGMCP_BOOTSTRAP_TIMEOUT_MS300000Per-command --bootstrap-tools timeout
FSLANGMCP_PROCESS_OUTPUT_LIMIT_CHARS4194304Maximum retained characters per child stdout/stderr stream; excess is still drained

LSP concurrency is deliberately fixed at one. Increasing parallelism around a single mutable FSAC workspace can mix document versions or dispose an RPC during set_project; the bridge therefore serializes lifecycle, document sync, and invocation internally.

Edit this page