Is @modelcontextprotocol/sdk safe?
What @modelcontextprotocol/sdk does
@modelcontextprotocol/sdk is the TypeScript SDK for the Model Context Protocol, used to build MCP servers and clients with tools, resources, prompts, transports and OAuth helpers. The npm author field lists Anthropic, PBC, with source in modelcontextprotocol/typescript-sdk. The README says this is the v1.x maintenance line, which still receives bug fixes and security updates, while newer spec support ships in the v2 packages @modelcontextprotocol/server and @modelcontextprotocol/client. As a library, what it accesses depends on the server or client you build with it. Before installing, choose between v1.x and v2, and note the required zod peer dependency.
- Node.js shell/command execution
- Node.js network egress
- npm prepare-time hook
What to do: Nothing here argues against installing it. Grant the capabilities it lists only if you expect the tool to need them.
@modelcontextprotocol/sdk is an npm package analyzed by SkillTotal's deterministic static scanner. The scan found no malicious indicators. It can: delegated authentication, install time execution, mcp tools detected, network egress and shell execution — capabilities are what the code can do, not a verdict on intent. Risk score 0/100 (low).
@modelcontextprotocol/ sdk 1.32.2
Get notified when this component changes
Change alerts aren't live yet. Leave your email and we'll let you know when they launch. We use it only for this and delete it on request.
Automated static-analysis result. It can contain false positives and false negatives, and is not a claim about the intent of @modelcontextprotocol/sdk's authors. Report a false positive.
Behavioral traits
How this component maps to the CSA agentic threat model. Descriptive — it never affects the risk score.
Findings (5)
The component can run operating-system commands or spawn processes.
import { IOType } from 'node:child_process';const cross_spawn_1 = __importDefault(require("cross-spawn"));import { IOType } from 'node:child_process';import spawn from 'cross-spawn';
Why it matters: Powerful and often legitimate — confirm the commands aren't built from untrusted input.
Fix: Confirm the command and its arguments are fully controlled and not derived from untrusted input; prefer execFile with an argument array.
package.json has a 'prepare' script (runs on git/local installs and before publishing).
"prepack": "npm run build:esm && npm run build:cjs",
Why it matters: Usually a build step, but confirm it doesn't fetch or run remote code.
Fix: Usually a legitimate build step; confirm it only builds and does not fetch or execute remote code.
The component makes outbound network requests.
import { IncomingMessage, ServerResponse } from 'node:http';import { IncomingMessage, ServerResponse } from 'node:http';import { IncomingMessage, ServerResponse } from 'node:http';import { IncomingMessage, ServerResponse } from 'node:http';Why it matters: Usually legitimate, but confirm the destinations are expected and no sensitive data leaves.
Fix: Confirm the destination hosts are expected and that no sensitive data is sent off-host.
An OAuth 2.0 / OpenID Connect delegated-authentication flow was detected (authorization-code / refresh-token / token-exchange grant, an OIDC authorize/discovery endpoint or id_token, or a delegation library). Tools authenticate with the end user's delegated, scoped credentials rather than a long-lived embedded service credential. (25 occurrence(s) shown as evidence).
url: new URL(`/.well-known/openid-configuration`, url.origin),
url: new URL(`/.well-known/openid-configuration${pathname}`, url.origin),url: new URL(`${pathname}/.well-known/openid-configuration`, url.origin),authorizationUrl = new URL(metadata.authorization_endpoint);
grant_type: 'authorization_code',
grant_type: 'refresh_token',
grant_type: 'authorization_code',
grant_type: 'refresh_token',
const authorization_endpoint = '/authorize';
authorization_endpoint: new URL(authorization_endpoint, baseUrl || issuer).href,
router.use(new URL(oauthMetadata.authorization_endpoint).pathname, (0, authorize_js_1.authorizationHandler)({ provider: options.provider, ...options.authorizationOptions }));authorization_endpoint: z.ZodURL;
authorization_endpoint: z.ZodURL;
authorization_endpoint: z.ZodURL;
id_token: z.ZodOptional<z.ZodString>;
authorization_endpoint: exports.SafeUrlSchema,
authorization_endpoint: exports.SafeUrlSchema,
id_token: z.string().optional(), // Optional for OAuth 2.1, but necessary in OpenID Connect
url: new URL(`/.well-known/openid-configuration`, url.origin),
url: new URL(`/.well-known/openid-configuration${pathname}`, url.origin),url: new URL(`${pathname}/.well-known/openid-configuration`, url.origin),authorizationUrl = new URL(metadata.authorization_endpoint);
grant_type: 'authorization_code',
grant_type: 'refresh_token',
grant_type: 'authorization_code',
Fix: Delegated auth is a lower-blast-radius execution context than an embedded static credential. Confirm the requested scopes are minimal and that tokens are never logged or forwarded off-host.
An MCP tool surface (manifest or tool definitions) was found.
this.server = new Server(serverInfo, options);
this.server.setRequestHandler(ListToolsRequestSchema, () => ({this.server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {Why it matters: Just context — review which tools it offers and their permissions.
Fix: Review the declared MCP tools and their permissions.
How attackers abuse these capabilities
Interactive labs on the attack class behind the rules above. They show the technique, not anything found in @modelcontextprotocol/sdk.
Maintain @modelcontextprotocol/sdk?
The free Claude Code plugin scans each npm, PyPI or MCP package with this report's open-source engine before the install command runs. It runs on your machine and needs no account.
Check your own component
Run the same evidence-backed scan on any MCP server, agent skill, or package.
Scan your own componentHow we determine this: deterministic static analysis (regex + AST), evidence-anchored, no code execution. Methodology →