This is the documentation for the v2 beta — looking for the v1 documentation?
Skip to content

MCP TypeScript SDK (V2) / @modelcontextprotocol/codemod / types

types

Enumerations

DiagnosticLevel

Defined in: types.ts:3

Enumeration Members

Error

Error: "error"

Defined in: types.ts:4

Info

Info: "info"

Defined in: types.ts:6

Warning

Warning: "warning"

Defined in: types.ts:5

Interfaces

Diagnostic

Defined in: types.ts:9

Properties

advisoryOnly?

optional advisoryOnly?: boolean

Defined in: types.ts:16

Heuristic "verify this" advisories: dropped by the runner for files no transform changed, so re-runs over migrated trees stay quiet.

category?

optional category?: "v2-gap"

Defined in: types.ts:14

file

file: string

Defined in: types.ts:11

insertComment?

optional insertComment?: boolean

Defined in: types.ts:19

level

level: DiagnosticLevel

Defined in: types.ts:10

line

line: number

Defined in: types.ts:12

message

message: string

Defined in: types.ts:13

resolveCurrentLine?

optional resolveCurrentLine?: () => number

Defined in: types.ts:20

Returns

number

tag?

optional tag?: "zod-injected"

Defined in: types.ts:18

Machine-readable marker for cross-stage plumbing (e.g. the runner feeding manifest edits).


FileResult

Defined in: types.ts:53

Properties

changes

changes: number

Defined in: types.ts:55

diagnostics

diagnostics: Diagnostic[]

Defined in: types.ts:56

filePath

filePath: string

Defined in: types.ts:54


Migration

Defined in: types.ts:39

Properties

description

description: string

Defined in: types.ts:41

name

name: string

Defined in: types.ts:40

transforms

transforms: Transform[]

Defined in: types.ts:42


PackageJsonChange

Defined in: types.ts:59

Properties

added

added: string[]

Defined in: types.ts:60

applied

applied: boolean

Defined in: types.ts:69

True for the manifest the codemod writes (the nearest one walking up from the target directory) — or, under dry-run, the one it would write. False entries describe edits to other manifests — typically workspace members — that are reported for the user to apply themselves; those are never written.

notes?

optional notes?: string[]

Defined in: types.ts:71

Context on how the change set was computed (e.g. hoisted member usage credited to this manifest).

packageJsonPath

packageJsonPath: string

Defined in: types.ts:62

removed

removed: string[]

Defined in: types.ts:61

warnings?

optional warnings?: string[]

Defined in: types.ts:73

Manifest-level findings that need the user's attention (e.g. an incompatible zod range).


RunnerOptions

Defined in: types.ts:45

Properties

dryRun?

optional dryRun?: boolean

Defined in: types.ts:47

ignore?

optional ignore?: string[]

Defined in: types.ts:50

targetDir

targetDir: string

Defined in: types.ts:46

transforms?

optional transforms?: string[]

Defined in: types.ts:49

verbose?

optional verbose?: boolean

Defined in: types.ts:48


RunnerResult

Defined in: types.ts:76

Properties

commentCount

commentCount: number

Defined in: types.ts:82

diagnostics

diagnostics: Diagnostic[]

Defined in: types.ts:79

fileResults

fileResults: FileResult[]

Defined in: types.ts:80

filesChanged

filesChanged: number

Defined in: types.ts:77

mcpImportFiles

mcpImportFiles: number

Defined in: types.ts:84

Source files importing a v2 @modelcontextprotocol/* package after the run.

packageJsonChanges?

optional packageJsonChanges?: PackageJsonChange[]

Defined in: types.ts:81

totalChanges

totalChanges: number

Defined in: types.ts:78

v1ImportFiles

v1ImportFiles: number

Defined in: types.ts:86

Source files still importing the v1 @modelcontextprotocol/sdk package after the run (possible under --transforms subsets).


Transform

Defined in: types.ts:29

Properties

id

id: string

Defined in: types.ts:31

name

name: string

Defined in: types.ts:30

Methods

apply()

apply(sourceFile, context): TransformResult

Defined in: types.ts:32

Parameters
sourceFile

SourceFile

context

TransformContext

Returns

TransformResult


TransformContext

Defined in: types.ts:35

Properties

projectType

projectType: "client" | "server" | "both" | "unknown"

Defined in: types.ts:36


TransformResult

Defined in: types.ts:23

Properties

changesCount

changesCount: number

Defined in: types.ts:24

diagnostics

diagnostics: Diagnostic[]

Defined in: types.ts:25

usedPackages?

optional usedPackages?: Set<string>

Defined in: types.ts:26