Pin an MCP Server Version in Claude and Cursor

To keep a local MCP server reproducible, install it in a dedicated environment, lock its dependencies, and point Claude Desktop or Cursor directly at its executable. Treat updates as a separate maintenance step rather than something your launch command can resolve implicitly.

This walkthrough uses the official Fetch reference server. You’ll replace its convenient uvx mcp-server-fetch launch command with a persistent, locked installation, then test an update and prepare a rollback. For first-time client registration, use the existing MCP installation guide.

Use a locked environment instead of an unversioned launcher

The Fetch README documents uvx mcp-server-fetch as a launch method. That’s useful for getting started. However, an unversioned command doesn’t record the exact package and dependency versions that your working setup used.

Caching means that command doesn’t necessarily download a new release on every launch. The reproducibility problem appears when you rebuild a machine, refresh an environment, or otherwise resolve the package again. Astral documents these behaviors in its uv tools documentation.

Use this workflow when you want deliberate updates:

StageWhat you keep or runWhat it establishes
Resolveuv add mcp-server-fetchA declared dependency and a lockfile
Installuv sync --lockedAn environment synchronized from that lockfile
LaunchAbsolute path to the installed executableA client launch without dependency resolution
VerifyOne explicit Fetch tool callEvidence that the client can use the installation
Updateuv lock --upgrade-package mcp-server-fetchA deliberate dependency change to review
Roll backRestore the previous project files and syncThe previous locked dependency set

This locks the Python dependency resolution. It doesn’t freeze your operating system, Python distribution, remote websites, or client behavior.

Create a dedicated Fetch runtime

Before installing a different server, use AllMCPs to find and inspect candidates. Then check the chosen server’s own documentation for its package name, launch command, required credentials, and tool permissions. The commands below are specific to Fetch; don’t assume another server uses the same package or executable name.

Install uv using Astral’s installation instructions, then confirm it’s available:

bash
uv --version

Create the runtime outside your application repositories. A dedicated directory prevents a project cleanup or dependency change from removing the environment your MCP client needs.

On macOS or Linux:

bash
mkdir -p "$HOME/mcp-runtimes/fetch"
cd "$HOME/mcp-runtimes/fetch"
uv init --name mcp-fetch-runtime
uv add mcp-server-fetch
uv sync --locked

On Windows, use PowerShell:

powershell
New-Item -ItemType Directory -Force "$HOME\mcp-runtimes\fetch"
Set-Location "$HOME\mcp-runtimes\fetch"
uv init --name mcp-fetch-runtime
uv add mcp-server-fetch
uv sync --locked

The directory should be new when you run uv init. These commands create a uv project, add Fetch as a dependency, and install the resolved dependency set. The workflow is documented in uv’s project guide.

Keep these files:

  • pyproject.toml declares the project and its dependency requirements.
  • uv.lock records the resolved dependencies.
  • .python-version records the Python version request created by uv init.

The .venv directory contains the installed environment. Don’t copy it between machines or commit it to Git. Recreate it with uv on the destination machine; virtual environments contain machine-specific paths.

uv sync --locked refuses to proceed if the lockfile needs updating. That makes an accidental mismatch between the project requirements and lockfile visible rather than silently resolving a different dependency set. See uv’s locking and syncing documentation.

Before configuring a client, check that the installed executable exists. On macOS or Linux:

bash
test -x "$HOME/mcp-runtimes/fetch/.venv/bin/mcp-server-fetch"

On Windows:

powershell
Test-Path "$HOME\mcp-runtimes\fetch\.venv\Scripts\mcp-server-fetch.exe"

Stop if that check fails. A client configuration can’t repair an incomplete package installation.

Point each client at the installed executable

Both clients will launch the same installed Fetch executable. Each connection still starts its own server process; they don’t share one running process merely because the executable path matches.

For this local connection, the client starts the server and communicates through standard input and standard output, as defined by the MCP stdio transport. You don’t need a listening port or a separate terminal that keeps Fetch running.

The examples below assume macOS or Linux. Replace /Users/YOU with your actual home directory. On Linux, that might be /home/YOU. JSON doesn’t expand shell expressions such as $HOME, so use the full path.

Claude Desktop

Claude Desktop can launch the installed executable through its developer configuration. This fits a local Fetch installation managed independently from the desktop application.

Best for: Keeping Claude Desktop on an explicitly maintained Fetch environment.

Open Settings → Developer → Edit Config. For a new configuration, use:

config.json
{
  "mcpServers": {
    "fetch": {
      "command": "/Users/YOU/mcp-runtimes/fetch/.venv/bin/mcp-server-fetch"
    }
  }
}

If fetch already exists, replace its old launch definition. Remove the old args value containing mcp-server-fetch; that argument belonged to the uvx launcher.

Save the file, fully quit Claude Desktop, and reopen it. The official local-server guide documents the configuration workflow.

Cursor

Cursor can launch the same executable from a project or global MCP configuration. This fits an environment you want to maintain separately from the repository currently open in the editor.

Best for: Reusing one locked Fetch installation across Cursor projects.

For a personal installation, put this in ~/.cursor/mcp.json:

config.json
{
  "mcpServers": {
    "fetch": {
      "command": "/Users/YOU/mcp-runtimes/fetch/.venv/bin/mcp-server-fetch"
    }
  }
}

For a project-specific installation, use .cursor/mcp.json in that project instead. Cursor documents both locations in its MCP documentation.

Choose one location for this exercise, save the file, and restart Cursor. A personal absolute path isn’t portable, so don’t commit it as a supposedly ready-to-use team configuration.

Windows path substitution

On Windows, substitute the executable path in either example with an escaped JSON string:

json
"command": "C:\\Users\\YOU\\mcp-runtimes\\fetch\\.venv\\Scripts\\mcp-server-fetch.exe"

Don’t add PowerShell syntax or activation commands. The client launches the executable directly. For merging entries into an existing file, use the MCP configuration JSON guide.

Prove the client uses the locked installation

Start a new conversation and request a specific tool call:

Use the fetch tool from the Fetch MCP server to retrieve https://modelcontextprotocol.io/docs/develop/connect-local-servers. Report the page title and one installation step from the returned content. Don’t substitute built-in web browsing.

Inspect the tool call rather than judging only the final answer. Confirm the Fetch server was selected, the URL argument matches, and the result contains retrieved page content. Approve the call if the client requests approval.

Then record the installed dependency set from the runtime directory:

bash
uv pip freeze

Keep that output with your test notes. It’s useful evidence when you compare two installations, but uv.lock remains the file you use to recreate the dependency resolution.

A successful response proves the connection worked for that request. It doesn’t prove which executable launched by itself. Also inspect the client’s configured command and confirm it points at the dedicated .venv, rather than an older uvx entry under another server name.

Update deliberately and keep a rollback point

First, record the working project files in Git. Run these commands inside the dedicated runtime directory, assuming Git is installed and your author identity is configured:

bash
git init
git add pyproject.toml uv.lock .python-version
git commit -m "Record working Fetch runtime"
git tag fetch-known-good

Don’t add .venv or credentials. This example requires no service API key, as documented in the Fetch README.

Before updating, fully quit every client that uses this environment. That avoids leaving an old process running while its installed files change, and avoids open-file conflicts on Windows.

Then request an update:

bash
uv lock --upgrade-package mcp-server-fetch
git diff -- pyproject.toml uv.lock
uv sync --locked

The upgrade operates within the dependency requirements in pyproject.toml. Review the lockfile diff for Fetch and any dependency changes the resolver required. Astral documents targeted upgrades in its locking and syncing documentation.

Reopen one client and repeat the explicit Fetch test. If it succeeds, test the other client before recording the update as accepted.

If you need to roll back, quit both clients again and run:

bash
git restore --source=fetch-known-good -- pyproject.toml uv.lock .python-version
uv sync --locked

Reopen the clients and repeat the same test. Restoring only the lockfile on disk doesn’t change an already running server process.

For subsequent accepted updates, create a new descriptive Git tag. Keep the previous known-good tag until you no longer need that rollback point.

Recreate the installation on another machine

Transfer the tracked project files, then run uv sync --locked in the destination runtime directory. Update each client’s absolute executable path for that machine and repeat the tool-call test.

A lockfile can contain platform-specific dependency resolutions, but it can’t guarantee every dependency supports every operating system. If synchronization fails, investigate that failure before editing client settings.

The practical acceptance criterion is straightforward: a fresh environment synchronizes without changing the lockfile, the client launches its installed executable, and the explicit Fetch request succeeds. Record all three before retiring the old installation.