Skip to main content
Glama
AndyLiner13

ts-mcp-server

by AndyLiner13

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
navtoNoSet to 'false' to disable the navto tool
formatNoSet to 'false' to disable the format tool
renameNoSet to 'false' to disable the rename tool
mapCodeNoSet to 'false' to disable the mapCode tool
navtreeNoSet to 'false' to disable the navtree tool
quickinfoNoSet to 'false' to disable the quickinfo tool
definitionNoSet to 'false' to disable the definition tool
moveSymbolNoSet to 'false' to disable the moveSymbol tool
referencesNoSet to 'false' to disable the references tool
extractTypeNoSet to 'false' to disable the extractType tool
projectInfoNoSet to 'false' to disable the projectInfo tool
getCodeFixesNoSet to 'false' to disable the getCodeFixes tool
todoCommentsNoSet to 'false' to disable the todoComments tool
signatureHelpNoSet to 'false' to disable the signatureHelp tool
completionInfoNoSet to 'false' to disable the completionInfo tool
fileReferencesNoSet to 'false' to disable the fileReferences tool
getDiagnosticsNoSet to 'false' to disable the getDiagnostics tool
implementationNoSet to 'false' to disable the implementation tool
inlineVariableNoSet to 'false' to disable the inlineVariable tool
selectionRangeNoSet to 'false' to disable the selectionRange tool
typeDefinitionNoSet to 'false' to disable the typeDefinition tool
extractConstantNoSet to 'false' to disable the extractConstant tool
extractFunctionNoSet to 'false' to disable the extractFunction tool
inferReturnTypeNoSet to 'false' to disable the inferReturnType tool
organizeImportsNoSet to 'false' to disable the organizeImports tool
getOutliningSpansNoSet to 'false' to disable the getOutliningSpans tool
provideInlayHintsNoSet to 'false' to disable the provideInlayHints tool
docCommentTemplateNoSet to 'false' to disable the docCommentTemplate tool
documentHighlightsNoSet to 'false' to disable the documentHighlights tool
getCombinedCodeFixNoSet to 'false' to disable the getCombinedCodeFix tool
findSourceDefinitionNoSet to 'false' to disable the findSourceDefinition tool
prepareCallHierarchyNoSet to 'false' to disable the prepareCallHierarchy tool
getSupportedCodeFixesNoSet to 'false' to disable the getSupportedCodeFixes tool
renameFileOrDirectoryNoSet to 'false' to disable the renameFileOrDirectory tool
completionEntryDetailsNoSet to 'false' to disable the completionEntryDetails tool
definitionAndBoundSpanNoSet to 'false' to disable the definitionAndBoundSpan tool
getApplicableRefactorsNoSet to 'false' to disable the getApplicableRefactors tool
provideCallHierarchyIncomingCallsNoSet to 'false' to disable the provideCallHierarchyIncomingCalls tool
provideCallHierarchyOutgoingCallsNoSet to 'false' to disable the provideCallHierarchyOutgoingCalls tool
getMoveToRefactoringFileSuggestionsNoSet to 'false' to disable the getMoveToRefactoringFileSuggestions tool

Capabilities

Features and capabilities supported by this server

CapabilityDetails
tools
{
  "listChanged": true
}

Tools

Functions exposed to the LLM to take actions

NameDescription
getEditsForFileRenameA

Rename or move a TypeScript/JavaScript file OR folder and automatically update all import paths across the project. Supports .ts, .tsx, .js, .jsx. tsserver auto-discovers the relevant tsconfig.json. For folders, all imports referencing files inside the folder are updated.

renameA

Rename a TypeScript/JavaScript symbol (variable, function, class, type, property, etc.) and update all references across the project. Provide the file path and the 1-based line/offset of any occurrence of the symbol.

getDiagnosticsA

Get all errors, warnings, and suggestions for a TypeScript/JavaScript file. Reports type errors, unused variables, unused imports, unreachable code, and more. Requires the file to be part of a tsconfig.json project. Unused-code diagnostics only appear if tsconfig has noUnusedLocals/noUnusedParameters enabled.

referencesA

Find all usages of a symbol across the project. Provide the file path and 1-based line/offset of any occurrence of the symbol. Returns references grouped by file with line text for context.

organizeImportsA

Sort, coalesce, and remove unused imports in a TypeScript/JavaScript file. Uses TypeScript's native organizeImports with mode 'All' (sorts, coalesces, and removes unused). Requires the file to be part of a tsconfig.json project.

getCodeFixesA

Get available code fixes for specific error codes at a range in a TypeScript/JavaScript file. Returns the raw list of code actions tsserver suggests for the given diagnostics. Use getDiagnostics first to discover error codes and ranges, then pass them here.

extractFunctionA

Extract the selected code range into a new function. TypeScript auto-detects parameters and return type. The response includes renameFilename/renameLocation so you can follow up with rename_symbol to give the function a meaningful name.

extractConstantA

Extract the selected expression into a named constant. TypeScript infers the type. The response includes renameFilename/renameLocation so you can follow up with rename_symbol to give the constant a meaningful name.

moveSymbolA

Move top-level declarations (functions, classes, types, constants) to another file. Automatically rewires all imports across the project. If the target file does not exist, tsserver creates it.

inlineVariableA

Inline a variable — replace all references with the variable's initializer and delete the declaration. Position must be on the variable name in its declaration or any usage.

extractTypeA

Extract an inline type annotation into a named type alias. Select the type span to extract. The response includes renameFilename/renameLocation so you can follow up with rename_symbol to give the type a meaningful name.

inferReturnTypeB

Add an explicit return type annotation to a function, inferred by TypeScript. Position must be on the function name or declaration keyword.

quickinfoA

Get type information, documentation, and JSDoc tags for a symbol at a position. Returns the hover info — kind, display string (full type signature), documentation, and tags.

navtreeA

Get the complete hierarchical structure of a file — all classes, functions, variables, interfaces, type aliases, enums, and their nesting. Returns kind, name, spans, and child items for every declaration.

definitionB

Returns the file location(s) where a symbol is defined. The fundamental 'where is this thing declared?' query.

navtoA

Workspace-wide symbol search by name. Takes a search string and returns matching symbols across all project files with their locations and kinds.

fileReferencesA

Finds every file that imports or references a given file. The reverse dependency graph for a single file.

prepareCallHierarchyA

Returns the call hierarchy item(s) at a position — the entry point for call hierarchy queries. Returns the function/method name, kind, file location, and spans.

provideCallHierarchyIncomingCallsA

Returns all functions/methods that call the function at the given position. Answers 'who calls this?'

provideCallHierarchyOutgoingCallsA

Returns all functions/methods that the function at the given position calls. Answers 'what does this call?'

typeDefinitionA

Navigates to the type's definition, not the variable's declaration. Given const user: UserProfile = ..., definition goes to the variable, but typeDefinition goes to the UserProfile interface.

implementationA

Finds concrete implementations of an interface or abstract class. Given an interface Serializable, returns every class that implements it.

projectInfoA

Returns the tsconfig.json path, the full list of files in the project, and whether the language service is active.

completionInfoA

Get autocomplete suggestions at a position. Returns all possible completions with their kinds, sort text, and insert text. Useful for understanding what symbols, methods, or properties are available at a specific location in code.

completionEntryDetailsA

Get full details for specific completion entries. Follow-up to completion_info for richer information including documentation, full type signature, JSDoc tags, and code actions (like auto-imports). Can request details for multiple entries at once.

signatureHelpA

Get function/method signature information at a call site. Returns parameter names, types, and documentation for each overload. Use when the cursor is inside function call parentheses to understand what arguments are expected.

documentHighlightsA

Find all occurrences of a symbol within a file (or set of files). Distinguishes between read and write references. More efficient than find_all_references when you only need local occurrences within specific files.

getApplicableRefactorsA

Discover what refactorings are available at a position or selection. Use before attempting a refactor to see what's possible. Returns a list of available refactors with their actions, descriptions, and any reasons why certain actions may not apply.

docCommentTemplateA

Generate a JSDoc comment template for a function, method, or class at a position. Returns the template text with @param, @returns, etc. based on the function signature. The returned text can be inserted above the function declaration.

getOutliningSpansA

Get code folding regions for a file. Returns the hierarchical structure of code blocks including their kinds (comment, region, code, imports). Useful for understanding file structure, complexity, and navigating large files.

provideInlayHintsA

Get inlay hints (inline type annotations) for a range. Shows inferred types, parameter names at call sites, and return types. Useful for understanding what TypeScript infers without explicit type annotations.

getCombinedCodeFixA

Get a combined code fix that applies all instances of a fix across a file in one action. For example, "Add all missing imports" or "Remove all unused variables". Returns the full set of file edits as a CombinedCodeActions response. Use getCodeFixes first to discover available fixId values, then pass the fixId here to get the combined fix for the whole file.

todoCommentsA

Find all TODO, FIXME, HACK, and other configured comment markers in a file. Returns the location and text of each matching comment. You must provide the descriptors array specifying which markers to search for.

definitionAndBoundSpanA

Like 'definition', but also returns the span of the symbol at the cursor. Useful for understanding exactly which characters constitute the symbol being queried. Returns both the definition locations and the textSpan of the queried symbol.

findSourceDefinitionA

Navigate to the actual TypeScript source instead of .d.ts declaration files. Useful when working with libraries that have source maps or when you want to see the implementation rather than just the type declarations.

selectionRangeA

Get semantically meaningful selection ranges for smart expand/shrink selection. Returns nested spans that represent progressively larger syntactic constructs. Useful for structural code selection (e.g., select expression → statement → block → function).

formatA

Format a range of code according to TypeScript's formatting rules. Applies consistent indentation, spacing, and line breaks. Specify a range or use the full file length to format the entire file.

getMoveToRefactoringFileSuggestionsA

Get suggested target files when moving a symbol to another file. Returns both a suggested new file name and existing files that would be good destinations. Use this before moveSymbol to choose the best target location.

getSupportedCodeFixesA

Returns the list of all error codes that have available code fixes. Use this as a discovery tool before calling getCodeFixes — it tells you which error codes tsserver can automatically fix. A file path must be provided to establish a project context; omitting it will cause tsserver to throw 'No Project'.

mapCodeA

Map/insert/replace code snippets into a file. Designed for AI code generation workflows.

How matching works:

  1. Without focusLocations → code is ALWAYS appended to end of file (no matching attempted)

  2. With focusLocations → TypeScript searches for matching declarations by NAME in the scope

  3. Matching works for: functions, classes, methods, interfaces (nodes with a 'name' property)

  4. Matching does NOT work for: const/let/var declarations (VariableStatement has no name)

When a match is found:

  • The range from first matching statement to last matching statement is REPLACED with new code

When no match is found:

  • Code is appended to the end of the scope (file or block)

Multiple contents limitation:

  • When providing multiple contents entries, only the FIRST entry's match is applied

  • To replace multiple named declarations, call mapCode once per declaration

Non-existent files:

  • tsserver opens a virtual file buffer for paths that don't exist on disk

  • Edits are returned and written as if the file exists, effectively creating it

  • Use preview=true first to verify the output before writing a new file

Usage patterns:

  • REPLACE a function: provide contents with same function name + focusLocations anywhere in file

  • ADD new code: omit focusLocations (always appends to end)

  • REPLACE const/var: NOT SUPPORTED by mapCode — use standard file editing instead

  • REPLACE multiple declarations: call mapCode separately for each one

  • CREATE a new file: provide the desired path and contents without focusLocations

Example - replacing function 'calculate' (focusLocations just needs to be in the file scope): contents: ["export function calculate(x: number) { return x * 2; }"] focusLocations: [[{ start: { line: 1, offset: 1 }, end: { line: 1, offset: 1 } }]]

Set preview=true to see edits without applying them.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/AndyLiner13/ts-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server