
MCP Server Security Checklist: Pin, Lock and Limit Access
An MCP server security checklist: why pinning a version isn't enough, how lock files and hashes help, and 8 steps to limit what AI agents can reach.
Model Context Protocol servers are the hands of your AI assistant. They let a coding agent query a database, open a ticket, read a firewall config or push to a repo, which means they often run with your credentials and your network reach. That makes MCP server security a supply chain problem as much as an AI problem. This guide walks through the practical steps to lock MCP servers down, starting with a lesson from fresh research published on November 13: pinning a version does not always pin the code you run.
Quick Picks: the MCP security moves that matter most
- Freeze the full dependency tree, not just the server's version: install from a hash-pinned lock file and launch the installed copy directly
- Avoid "latest" and one-line package runners in production configs, since they can pull new code from a public registry at launch
- Give each server its own narrow credentials with the smallest scopes that work
- Keep a human approval step for any tool that writes, deletes, pays or deploys
- Log what servers connect to, so drift and surprises show up quickly
- Re-lock on a schedule and review the diff, because frozen code ages too
What Is an MCP Server, and Why Is It a Security Boundary?
MCP is an open protocol that lets AI clients such as coding assistants and chat apps call external tools in a standard way. An MCP server wraps a capability, like "search this codebase" or "list open incidents," and exposes it to the model. Some run locally on your workstation, often started by the assistant itself; others are remote services reached over HTTP with OAuth.
Either way, the server sits between a model that can be manipulated and systems that matter. If a malicious web page or document persuades the model to do something odd, the MCP server is what actually carries out the action. And if the server's own code is compromised, the attacker inherits everything the server can touch. We covered the first risk in our prompt injection defense guide; this guide focuses on the second, plus the permissions that limit the blast radius of both.
Why Isn't Pinning an MCP Server Version Enough?
This is the most useful new lesson of the week. Corelight's James Lagermann told Help Net Security that an MCP server configured to run one fixed release on an administrator's workstation actually ran with 15 different sets of dependencies over five weeks, with the configuration never changing. Twenty-three of the server's 69 packages changed versions in that period, including the cryptography library, the JSON Web Token library and the MCP SDK itself.
The cause was the launcher. The assistant started its servers with uvx, a convenience command that downloads a Python package and runs it from a single line of configuration. The uv documentation explains that uvx runs a tool in a temporary, isolated environment. In Corelight's case, the launcher installed from the package's declared dependencies rather than the project's hash-pinned lock file, so roughly 60 packages underneath were resolved fresh from the Python Package Index whenever the environment was rebuilt. The cache held 19 builds of the same release in a week, about one every couple of days.
Why does that matter? A hijacked package release may only be live on a registry for minutes or hours before it is pulled. Every fresh resolve is another roll of the dice. Help Net Security notes that a Shai-Hulud worm variant hit MCP-themed PyPI packages in June 2026 and went after AI coding assistant keys, and the same workstation's servers made more than 1,600 connections in a week to 11 management systems, including the firewall and the SIEM.
Corelight also reviewed 35 MCP servers from two vendor catalogs and its lab, and found that 23 had a recommended install that would pull dependencies from a public registry on every launch, install or image build. The good news is that the fix worked: five servers frozen to a commit and installed once from a hash-pinned lock file were started 457 times over two weeks, and every installed package list matched install day.
How Do I Freeze an MCP Server's Dependencies?
The goal is simple: install once, from a lock file with hashes, then run that exact environment until you deliberately update it.
For Python-based MCP servers
- Prefer servers that ship a lock file, and pin the server itself to a specific Git commit rather than a moving tag
- Install into a dedicated virtual environment once, then point your assistant's config at that environment's executable instead of a one-line runner
- With uv, the docs describe a --locked option that refuses to run if the lock file is out of date, and a --frozen option that uses the lock file as-is. The uv docs also note that a lock file is not considered outdated when new package versions are released, so updates only happen when you ask for them
- If you use pip, its hash-checking mode (--require-hashes) refuses any package whose hash does not match the requirements file, and pip's documentation stresses that every requirement must be hashed for the protection to hold
For Node-based MCP servers
- Commit a package-lock.json and install with npm ci, which the npm documentation describes as a clean install that errors out if the lock file and package.json disagree and never rewrites the lock file
- Avoid launching servers with a package runner and an "@latest" tag in your assistant config; install to a fixed directory and run it from there
For containerized servers
- Build the image from a lock file, tag it by digest rather than "latest," and run that digest. A container that rebuilds on every deploy has the same drift problem as a one-line launcher
What Permissions Should an MCP Server Have?
Dependency hygiene limits the odds of running bad code. Permissions limit the damage if it happens anyway. The official MCP Security Best Practices document is worth reading in full, and several of its themes translate directly into a checklist:
- Scope minimization: request the narrowest permissions a server needs, and add more only when a task truly requires them. A read-only ticket search should not hold a token that can delete projects
- No token passthrough: a server should not accept tokens that were issued for some other service and forward them on. Tokens should be issued for the MCP server itself
- Per-client consent for proxies: servers that proxy third-party APIs must get explicit user consent for each client, protect the consent page against CSRF and clickjacking, and validate OAuth redirect URIs and state values exactly
- Treat local servers as code execution: a local server runs with your user's privileges, so only install servers from sources you trust and review what command a one-click install will actually run
Practical extras that fit the same spirit:
- Use a separate service account or API key per server so you can revoke one without breaking the rest
- Keep secrets out of config files and repositories; our guide to keeping MCP credentials out of Git history covers the cleanup steps
- Where possible, run local servers in a container or sandbox with no access to your home directory and only the network routes they need
How Do I Monitor MCP Servers for Drift?
You cannot defend what you cannot see. Corelight spotted the drift because it watched what its servers installed and where they connected. A lightweight version of that is achievable for most teams:
- Record the installed package list (pip freeze or npm ls) right after install and compare it on each launch or on a daily schedule
- Log outbound connections from the machines that run MCP servers and alert on new destinations, especially management systems
- Keep an inventory of every MCP server in use, who owns it, which credentials it holds and which commit it runs
- Watch the server maintainers' security advisories and changelogs
Frozen Code Ages Too: How Often Should I Re-Lock?
Freezing is not "set and forget." When Corelight froze one community server, 40 of its packages were already older than what the launcher would have pulled that day, some of them security-sensitive. The answer is a deliberate update rhythm. Lagermann recommends following each server maintainer's update guidance, and says the servers he maintains are reviewed nightly for vulnerabilities and updated the next morning with a changelog when one is found.
A sensible routine for most teams:
- Re-lock on a fixed schedule, such as weekly or with each sprint, and immediately when an advisory affects a dependency
- Review the lock-file diff like any other code change, paying attention to new packages and new maintainers
- Test the updated server in a non-production profile before promoting it to the assistant configs your team uses daily
The MCP Server Security Checklist
Print this, pin it, and walk through it for every server your assistants can reach:
- Pin the server to a specific commit or release from a source you trust
- Install once from a hash-pinned lock file into a dedicated environment
- Launch the installed copy directly; no "latest" tags or on-the-fly package runners
- Give the server its own credentials with minimal scopes, issued for that server
- Require human approval for destructive or financial actions
- Sandbox local servers and restrict their network reach
- Log installs and outbound connections, and alert on changes
- Re-lock on a schedule and review every dependency diff
The Bottom Line on MCP Security
MCP is one of the most useful ideas in agentic AI because it gives assistants a standard, inspectable way to use tools. The same standardization makes good security habits easy to apply across every server you run. Lock the code, limit the keys, keep a human in the loop for anything risky and watch for drift. Corelight's research also has a constructive ending: Lagermann notified the maintainers of the affected public servers, one agent marketplace updated its review process to check for this issue, and one vendor is repackaging its server.
For deeper reading, the NSA's guidance we summarized in its first MCP security playbook pairs well with this checklist. Explore more defensive guides in our AI security section.
Sources: Help Net Security: Your pinned MCP server may not be as pinned as you think — November 13, 2026; Model Context Protocol: Security Best Practices — accessed November 13, 2026; uv documentation: Locking and syncing — accessed November 13, 2026; uv documentation: Using tools — accessed November 13, 2026; pip documentation: Secure installs — accessed November 13, 2026; npm documentation: npm ci — accessed November 13, 2026.
More Ai Security Stories

Apple Secure Exclaves: How Your Camera Data Stays Private
Apple's Secure Exclaves keep raw camera and mic data away from the main OS, apps and Apple itself. Here is how the 3-part design protects ambient sensing.

Daybreak Red Team and Defense Factory: How AI Pen Tests Work
OpenAI's Daybreak Red Team and Defense Factory pair AI pen testing with automated patching. Here's how the 2 new security agents find, fix and retest.

Project Zero Full 90 Policy: What Faster Disclosure Means
Google Project Zero's Full 90 policy drops the 30-day patch grace period and moves to 60 days in 2027 and 30 in 2028. Here's what defenders should do.
