TsComplexityMcp
Analyzes TypeScript functions to calculate their complexity, allowing agents to detect and reduce overly complex functions (e.g. keeping complexity at or below a set threshold such as 12).
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@TsComplexityMcp What's the complexity of this function? function f(x){if(x)return 1;return 0;}"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
TsComplexityMcp
TsComplexityMcp is an MCP server. It calculates the complexity of one TypeScript function.
Use this server to prevent code that is too complex.
This server is an MCP interface for the tsmetrics-core package by Tamas Kiss: https://github.com/kisstkondoros/tsmetrics-core.
Adding a rule in your AGENTS.md file to limit complexity to 12 or lower. Ask your LLM to reduce complexity.

Installation
Requirements
TypeScript.
Node.js version 20 or higher.
npm.
Git.
Install the server
Examine the Node.js version. Enter this command:
node --versionMake sure that the version is 20 or higher.
Clone the repository. Enter this command:
git clone https://github.com/JohnMarzulli/TsComplexityMcp.gitGo to the repository directory. Enter this command:
cd TsComplexityMcpInstall the dependencies. Enter this command:
npm installBuild the server. Enter this command:
npm run buildDo the tests. Enter this command:
npm testMake sure that no tests fail.
Add the server to an MCP client
Find the full path of the server file. Enter this command in the repository directory:
echo "$PWD/dist/server.js"Open the MCP configuration file of your MCP client.
Add the server to the configuration file. Use the full path from step 1.
For Visual Studio Code, use the file
~/.config/Code/User/mcp.json:{ "servers": { "ts-complexity": { "type": "stdio", "command": "node", "args": ["</full/path/to>/TsComplexityMcp/dist/server.js"] } } }For MCP clients that use the
mcpServerskey, use this example:{ "mcpServers": { "ts-complexity": { "command": "node", "args": ["</full/path/to>/TsComplexityMcp/dist/server.js"] } } }Save the configuration file.
Start the server. In Visual Studio Code, do these steps:
Open the Command Palette.
Select MCP: List Servers.
Select ts-complexity.
Select Start Server.
Make sure that the tool
analyze_typescript_complexityis in the list of tools.
NOTE: The MCP client starts the server process. Do not start dist/server.js in a terminal.
Available Tools
1 toolanalyze_typescript_complexityA
Scores the complexity of a single TypeScript function with tsmetrics-core. Returns JSON { total, details: [{ startLine, endLine, complexity, description }] }; lines are 1-based within the snippet.
Inputs: code (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 1 tool
There is only one tool, so there is no possibility of confusing it with another. Its purpose—scoring the complexity of a single TypeScript function—is stated unambiguously in the name and description.
The single name analyze_typescript_complexity follows a clear verb_noun convention in snake_case with a descriptive qualifier. With only one tool there is no opportunity for inconsistency, and the format is readable and predictable.
The server appears to be a narrowly scoped complexity analyzer, so a small surface is defensible, but one tool is thin for a useful MCP surface. Adding batch or file-level analysis variants would round it out without bloating it.
The surface covers snippet-level function complexity only; there is no way to analyze a whole file, a directory, or multiple functions in one call, which are natural extensions of the stated domain. Agents working on real codebases will hit a dead end after the single-function case.
Related MCP Connectors
Stateless TS/JS compiler facts for agents: references, imports, impact. No repo index or OAuth.
Coding agents in multi-service codebases routinely rebuild existing helpers, trust stale type definitions, and modify API contracts without knowing who consumes them. Carrick solves this by indexing your entire TypeScript ecosystem across service and repository boundaries. By integrating deeply with the TypeScript compiler, Carrick traces every route, type, and cross-service call while recording function behaviour so agents search by intent rather than name. Delivered via MCP for AI agents and LSP for IDEs, Carrick ensures models see existing endpoints and utilities before generating new code. The scanner is source-available and runs from your CLI or CI pipeline.
AI-powered codebase analysis — call graphs, security, dead code, complexity. 150+ tools.
Ship production-ready TypeScript code in half the time, at half the cost.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceAn MCP server for static Big-O time complexity analysis using tree-sitter AST parsing. Supports JavaScript, TypeScript, Python, Java, Kotlin, and Dart.3MIT
- AlicenseNot gradedqualityCmaintenanceAST-aware TypeScript/JavaScript codebase exploration for AI agents, providing high-precision symbol resolution, reference finding, and structural analysis via MCP tools.275 npmMIT
- AlicenseNot gradedqualityDmaintenanceEnables to extract TypeScript methods, functions, and their relevant imports and class properties for code analysis, refactoring, and documentation.MIT
- AlicenseAqualityDmaintenanceProvides deep structural analysis of TypeScript and JavaScript code via the TypeScript Compiler API, offering 20 tools for functions, types, call graphs, code quality, dead code detection, and IDE integration.20153 npm1MIT