Skip to content

Latest commit

 

History

History
481 lines (355 loc) · 14.5 KB

File metadata and controls

481 lines (355 loc) · 14.5 KB

MCP Client Support in MCPServer

This document explains how MCPServer supports different MCP client applications and how to install MCP servers into them.

Overview

MCPServer works with any MCP client that supports the stdio server transport. The server communicates via standard input/output using JSON-RPC messages, which is the most common transport mechanism for local MCP servers.

For convenience, InstallMCPServer and UninstallMCPServer functions are provided to automatically configure several popular client applications. These functions handle the different configuration file formats and locations used by each client.

Clients with InstallMCPServer Support

The following clients have built-in support for automatic configuration via InstallMCPServer:

Client Canonical Name Aliases Config Format Project Support
Claude Code "ClaudeCode" JSON Yes
Claude Desktop "ClaudeDesktop" "Claude" JSON No
Cline "Cline" JSON No
Copilot CLI "CopilotCLI" "Copilot" JSON No
Cursor "Cursor" JSON No
Gemini CLI "GeminiCLI" "Gemini" JSON No
Antigravity "Antigravity" "GoogleAntigravity" JSON No
Codex CLI "Codex" "OpenAICodex" TOML No
OpenCode "OpenCode" JSON Yes
Visual Studio Code "VisualStudioCode" "VSCode" JSON Yes
Windsurf "Windsurf" "Codeium" JSON No
Zed "Zed" JSON Yes

Usage

Basic Installation

Install an MCP server into a client application:

InstallMCPServer["ClaudeDesktop"]

This installs the default MCP server into Claude Desktop's configuration file.

Installing a Specific Server

InstallMCPServer["ClaudeCode", "WolframLanguage"]

Project-Level Installation

For clients that support project-level configuration, use a {name, directory} specification:

InstallMCPServer[{"ClaudeCode", "/path/to/project"}]

This creates a .mcp.json file in the specified project directory.

Installing to a Custom File

InstallMCPServer[File["/custom/path/config.json"]]

For TOML files (Codex), the format is auto-detected from the .toml extension.

Uninstalling

UninstallMCPServer["ClaudeDesktop"]              (* Remove all servers *)
UninstallMCPServer["ClaudeDesktop", "Wolfram"]   (* Remove specific server *)
UninstallMCPServer[myServerObject]               (* Remove from all locations *)

Client Configuration Details

Claude Desktop

OS Config Location
macOS ~/Library/Application Support/Claude/claude_desktop_config.json
Windows %APPDATA%\Claude\claude_desktop_config.json

Format:

{
    "mcpServers": {
        "ServerName": {
            "command": "...",
            "args": ["..."],
            "env": { ... }
        }
    }
}

Claude Code

Scope Config Location
Global ~/.claude.json
Project .mcp.json (in project root)

Format: Same as Claude Desktop (mcpServers key).

Cline

Cline stores its configuration in VS Code's extension global storage.

OS Config Location
macOS ~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
Windows %APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json
Linux ~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json

Format:

{
    "mcpServers": {
        "ServerName": {
            "command": "...",
            "args": ["..."],
            "env": { ... },
            "disabled": false,
            "autoApprove": []
        }
    }
}

Note: Cline uses the standard mcpServers format with additional disabled and autoApprove fields. InstallMCPServer automatically adds these defaults.

Copilot CLI

Scope Config Location
Global ~/.copilot/mcp-config.json

Format:

{
    "mcpServers": {
        "ServerName": {
            "command": "...",
            "args": ["..."],
            "env": { ... },
            "tools": ["*"]
        }
    }
}

Note: Copilot CLI requires the tools field to specify which tools to enable. InstallMCPServer automatically adds "tools": ["*"] to enable all tools.

Cursor

Scope Config Location
Global ~/.cursor/mcp.json

Format: Same as Claude Desktop (mcpServers key).

Gemini CLI

Scope Config Location
Global ~/.gemini/settings.json

Format: Same as Claude Desktop (mcpServers key).

Antigravity

Scope Config Location
Global ~/.gemini/antigravity/mcp_config.json

Format: Same as Claude Desktop (mcpServers key).

Codex CLI

Scope Config Location
Global ~/.codex/config.toml

Format (TOML):

[mcp_servers.ServerName]
command = "..."
args = ["..."]
enabled = true

[mcp_servers.ServerName.env]
KEY = "value"

OpenCode

Scope Config Location
Global ~/.config/opencode/opencode.json
Project opencode.json (in project root)

Format:

{
    "mcp": {
        "ServerName": {
            "type": "local",
            "command": ["...", "arg1", "arg2"],
            "enabled": true,
            "environment": { ... }
        }
    }
}

Note: OpenCode uses a different format where the command and args are combined into a single command array.

Visual Studio Code

OS Config Location
macOS ~/Library/Application Support/Code/User/settings.json
Windows %APPDATA%\Code\User\settings.json
Linux ~/.config/Code/User/settings.json
Project .vscode/settings.json

Format:

{
    "mcp": {
        "servers": {
            "ServerName": {
                "command": "...",
                "args": ["..."],
                "env": { ... }
            }
        }
    }
}

Note: VS Code nests servers under mcp.servers rather than mcpServers.

Windsurf

OS Config Location
macOS/Linux ~/.codeium/windsurf/mcp_config.json
Windows %USERPROFILE%\.codeium\windsurf\mcp_config.json

Format: Same as Claude Desktop (mcpServers key).

Zed

Scope Config Location
Global (macOS/Linux) ~/.config/zed/settings.json
Global (Windows) %APPDATA%\Zed\settings.json
Project .zed/settings.json

Format:

{
    "context_servers": {
        "ServerName": {
            "command": "...",
            "args": ["..."],
            "env": { ... }
        }
    }
}

Note: Zed uses context_servers instead of mcpServers. The inner server entry format is the same as Claude Desktop.

Using Other MCP Clients

MCPServer can be used with any MCP client that supports the stdio transport. If your client is not listed above, you can manually configure it using the server's command, arguments, and environment variables.

Server Configuration

The basic configuration requires:

Field Value
Command /full/path/to/wolfram (or wolfram.exe on Windows)
Arguments -run PacletSymbol["Wolfram/MCPServer","StartMCPServer"][] -noinit -noprompt

Environment Variables

Include these environment variables for proper operation:

Variable Description
MCP_SERVER_NAME Name of the MCP server to run (e.g. "WolframLanguage", optional)
WOLFRAM_BASE Path to Wolfram base directory ($BaseDirectory)
WOLFRAM_USERBASE Path to user's Wolfram files ($UserBaseDirectory)
APPDATA (Windows only) Path to application data (typically ParentDirectory[$UserBaseDirectory])
MCP_APPS_ENABLED Set to "false" to disable MCP Apps UI resources (optional)
MCP_TOOL_OPTIONS JSON string of tool option overrides, set automatically by "ToolOptions" (optional)

Getting the Configuration

You can generate the JSON configuration for manual use:

MCPServerObject["Wolfram"]["JSONConfiguration"]

This returns a JSON string with the complete server configuration that you can adapt to your client's format.

Setup Instructions

For clients not listed here, consult the MCP documentation or your client's documentation for instructions on configuring stdio-based MCP servers.

Options

DevelopmentMode

Controls how the MCP server is started:

Value Behavior
False (default) Uses the installed paclet via PacletSymbol
True Uses Scripts/StartMCPServer.wls from the current paclet location
"path/to/directory" Uses Scripts/StartMCPServer.wls from the specified directory

This is useful for testing local changes without reinstalling the paclet:

InstallMCPServer["ClaudeCode", "DevelopmentMode" -> True]

ProcessEnvironment

Specifies additional environment variables to include in the configuration:

InstallMCPServer["ClaudeCode", ProcessEnvironment -> <|"MY_VAR" -> "value"|>]

By default, InstallMCPServer includes:

  • MCP_SERVER_NAME
  • WOLFRAM_BASE
  • WOLFRAM_USERBASE
  • APPDATA (Windows only)

EnableMCPApps

Controls whether MCP Apps UI resources are enabled for the installed server:

Value Behavior
True (default) MCP Apps are enabled; the server will negotiate UI support with compatible clients
False MCP Apps are disabled; sets MCP_APPS_ENABLED=false in the server environment
InstallMCPServer["ClaudeDesktop", "EnableMCPApps" -> False]

ToolOptions

Customizes the behavior of built-in MCP tools at install time. The value is an association mapping tool names to their option overrides:

InstallMCPServer["ClaudeCode", "WolframLanguage",
    "ToolOptions" -> <|
        "WolframLanguageEvaluator" -> <|"Method" -> "Local", "TimeConstraint" -> 120|>,
        "WolframLanguageContext"   -> <|"MaxItems" -> 20|>
    |>
]

Options are serialized to the MCP_TOOL_OPTIONS environment variable and read by the server at startup. See tools.md for the full list of per-tool options.

Unrecognized tool names or option names generate warnings but do not prevent installation (for forward compatibility).

VerifyLLMKit

Controls whether to check LLMKit subscription requirements:

Value Behavior
True (default) Warns or errors if tools require LLMKit subscription
False Skips the LLMKit check

ApplicationName

Specifies which MCP client the configuration file belongs to:

Value Behavior
Automatic (default) Auto-detects the client from the file path or content
"ClientName" Explicitly specifies the target client

This option works with both InstallMCPServer and UninstallMCPServer. It is useful when installing to a File[...] target where the client cannot be auto-detected from the path:

InstallMCPServer[File["config.json"], "ApplicationName" -> "Cline"]
UninstallMCPServer[File["config.json"], "ApplicationName" -> "Cline"]

Querying Supported Clients

The public variable $SupportedMCPClients provides an association of all supported client metadata. It can be used to programmatically query which clients are supported and inspect their configuration details.

(* List all supported client names *)
Keys[$SupportedMCPClients]
(* {"Antigravity", "ClaudeCode", "ClaudeDesktop", "Cline", "Codex", ...} *)

(* Get metadata for a specific client *)
$SupportedMCPClients["ClaudeDesktop"]
(* <|"Aliases" -> {"Claude"}, "ConfigFormat" -> "JSON", "ConfigKey" -> {"mcpServers"}, ...|> *)

Adding Support for New Clients

All client configuration is centralized in $supportedMCPClients in Kernel/SupportedClients.wl. To add support for a new MCP client, add an entry to this association.

Client Entry Structure

Each entry is keyed by the canonical client name and contains an association with the following fields:

Field Required Description
"DisplayName" Yes Human-readable name shown to users
"Aliases" Yes List of alternative names (can be empty { })
"ConfigFormat" Yes File format: "JSON" or "TOML"
"ConfigKey" Yes Key path to the servers section (e.g. {"mcpServers"} or {"mcp", "servers"})
"URL" Yes Client's website or download page
"InstallLocation" Yes Config file path(s) per OS (see below)
"ProjectPath" No Relative path components for project-level config
"ServerConverter" No Function to transform the standard server entry into a client-specific format

Example Entry

"NewClient" -> <|
    "DisplayName"     -> "New Client",
    "Aliases"         -> { "NC" },
    "ConfigFormat"    -> "JSON",
    "ConfigKey"       -> { "mcpServers" },
    "URL"             -> "https://newclient.example.com",
    "ProjectPath"     -> { ".newclient.json" },
    "InstallLocation" -> <|
        "MacOSX"  :> { $HomeDirectory, ".newclient", "config.json" },
        "Windows" :> { $HomeDirectory, "AppData", "Roaming", "NewClient", "config.json" },
        "Unix"    :> { $HomeDirectory, ".config", "newclient", "config.json" }
    |>
|>

If the install location is the same on all platforms, use a single RuleDelayed instead of a per-OS association:

"InstallLocation" :> { $HomeDirectory, ".newclient", "config.json" }

Custom Server Converters

If the client uses a non-standard server entry format, provide a "ServerConverter" function. This function receives a standard server association (with "command", "args", "env" keys) and should return the client-specific format. For example, Cline adds "disabled" and "autoApprove" fields:

convertToClineFormat[ server_Association ] := Enclose[
    Module[ { result },
        result = ConfirmBy[ server, AssociationQ, "Server" ];
        result[ "disabled" ] = False;
        result[ "autoApprove" ] = { };
        result
    ],
    throwInternalFailure
];

Related Files

  • Kernel/SupportedClients.wl - Supported MCP client definitions and format converters
  • Kernel/InstallMCPServer.wl - Installation and uninstallation implementation
  • Kernel/CreateMCPServer.wl - Server creation and JSON configuration generation
  • Kernel/MCPServerObject.wl - Server object structure