ts-mcp-server
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| navto | No | Set to 'false' to disable the navto tool | |
| format | No | Set to 'false' to disable the format tool | |
| rename | No | Set to 'false' to disable the rename tool | |
| mapCode | No | Set to 'false' to disable the mapCode tool | |
| navtree | No | Set to 'false' to disable the navtree tool | |
| quickinfo | No | Set to 'false' to disable the quickinfo tool | |
| definition | No | Set to 'false' to disable the definition tool | |
| moveSymbol | No | Set to 'false' to disable the moveSymbol tool | |
| references | No | Set to 'false' to disable the references tool | |
| extractType | No | Set to 'false' to disable the extractType tool | |
| projectInfo | No | Set to 'false' to disable the projectInfo tool | |
| getCodeFixes | No | Set to 'false' to disable the getCodeFixes tool | |
| todoComments | No | Set to 'false' to disable the todoComments tool | |
| signatureHelp | No | Set to 'false' to disable the signatureHelp tool | |
| completionInfo | No | Set to 'false' to disable the completionInfo tool | |
| fileReferences | No | Set to 'false' to disable the fileReferences tool | |
| getDiagnostics | No | Set to 'false' to disable the getDiagnostics tool | |
| implementation | No | Set to 'false' to disable the implementation tool | |
| inlineVariable | No | Set to 'false' to disable the inlineVariable tool | |
| selectionRange | No | Set to 'false' to disable the selectionRange tool | |
| typeDefinition | No | Set to 'false' to disable the typeDefinition tool | |
| extractConstant | No | Set to 'false' to disable the extractConstant tool | |
| extractFunction | No | Set to 'false' to disable the extractFunction tool | |
| inferReturnType | No | Set to 'false' to disable the inferReturnType tool | |
| organizeImports | No | Set to 'false' to disable the organizeImports tool | |
| getOutliningSpans | No | Set to 'false' to disable the getOutliningSpans tool | |
| provideInlayHints | No | Set to 'false' to disable the provideInlayHints tool | |
| docCommentTemplate | No | Set to 'false' to disable the docCommentTemplate tool | |
| documentHighlights | No | Set to 'false' to disable the documentHighlights tool | |
| getCombinedCodeFix | No | Set to 'false' to disable the getCombinedCodeFix tool | |
| findSourceDefinition | No | Set to 'false' to disable the findSourceDefinition tool | |
| prepareCallHierarchy | No | Set to 'false' to disable the prepareCallHierarchy tool | |
| getSupportedCodeFixes | No | Set to 'false' to disable the getSupportedCodeFixes tool | |
| renameFileOrDirectory | No | Set to 'false' to disable the renameFileOrDirectory tool | |
| completionEntryDetails | No | Set to 'false' to disable the completionEntryDetails tool | |
| definitionAndBoundSpan | No | Set to 'false' to disable the definitionAndBoundSpan tool | |
| getApplicableRefactors | No | Set to 'false' to disable the getApplicableRefactors tool | |
| provideCallHierarchyIncomingCalls | No | Set to 'false' to disable the provideCallHierarchyIncomingCalls tool | |
| provideCallHierarchyOutgoingCalls | No | Set to 'false' to disable the provideCallHierarchyOutgoingCalls tool | |
| getMoveToRefactoringFileSuggestions | No | Set to 'false' to disable the getMoveToRefactoringFileSuggestions tool |
Capabilities
Features and capabilities supported by this server
| Capability | Details |
|---|---|
| tools | {
"listChanged": true
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| 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 |
| implementationA | Finds concrete implementations of an interface or abstract class. Given an interface |
| 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:
When a match is found:
When no match is found:
Multiple contents limitation:
Non-existent files:
Usage patterns:
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
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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