get_project_contextLABSCO SUMMARY
The typosquat check is the one that matters most.
Hallucinated imports waste your afternoon; hallucinated package names can install someone else's code. Screening new packages for registry existence and near-miss similarity to popular names, before anything is installed, is a different class of protection from version-aware method checking — and you get both from the same server. Packages already in your fingerprint are skipped, since you already made that call.
What it is
A TypeScript MCP server that reads your project's installed packages and their exact versions, feeds that fingerprint into the model's context, and validates suggestions against it before you paste them into an editor.
What you get
get_project_context— scans the project root and returns a fingerprint of every installed package with its exact version, cached for a few minutes so repeat calls are instantvalidate_suggestion— checks generated code in three layers: is every imported package in your dependencies (MISSING_PACKAGE), does every method call exist in your installed version (HALLUCINATED_METHOD), and what is the closest real alternativecheck_package_safety— screens new packages the model wants to install for PHANTOM_PACKAGE, LIKELY_TYPOSQUAT and LOW_TRUST_PACKAGE, using registry existence, edit distance to popular names, and age and repository signalsget_package_docs— pulls live npm or PyPI metadata for a specific version so the model can correct itself- Node and Python projects both covered, from package.json and requirements.txt
- Output written for a human: the offending identifier, the severity, and the install command or method that fixes it
Requirements
Node.js 18+ and TypeScript 5+ to build; Python 3 as well if you want Python projects validated. Clone, npm install, npm run build, then point your client at build/index.js — it speaks stdio. Clients that support auto-approval can pre-approve the four tools so validation runs without a prompt each time. On Windows with fnm or nvm, use the full path to node.exe in the config, since the client may launch outside your shell session.
Setup effort
Build from source — git clone https://github.com/Nirvanjha2004/ctxAI-MCP-tool-to-reduce-hallucinations.git
USE CASES
Catching a method that does not exist in your version
Validate the suggestion against your installed versions and get the closest real method for the version you actually have.
Refusing to install a package that was invented
Screen every new dependency the model proposes for existence, typosquat similarity and trust signals before running the install.
Keeping the model inside your actual stack
Put the version fingerprint in context up front so suggestions are constrained to APIs that exist in your environment.
4 tools
Listed in project docs. Your client may show a different list.
validate_suggestioncheck_package_safetyget_package_docsBEFORE YOU INSTALL
What to know first
Tools you get
4 tools named in the project's documentation.
Requires
- Node.js 18+
- TypeScript 5+
- Python 3 (only to validate Python projects)
Where it runs
All 4 documented clients run the server on your machine.
INSTALLATION
Connect your client
You clone and build this one yourself.
Server setup
git clone https://github.com/Nirvanjha2004/ctxAI-MCP-tool-to-reduce-hallucinations.git
cd ctxAI-MCP-tool-to-reduce-hallucinations/ctxai
npm install
npm run buildMCP Clients
Kiro
{
"mcpServers": {
"ctxai": {
"command": "node",
"args": [
"<YOUR_PATH_TO_CTXAI>/build/index.js"
],
"disabled": false,
"autoApprove": [
"get_project_context",
"validate_suggestion",
"check_package_safety",
"get_package_docs"
]
}
}
}Claude Desktop
{
"mcpServers": {
"ctxai": {
"command": "node",
"args": [
"<YOUR_PATH_TO_CTXAI>/build/index.js"
]
}
}
}Cursor, Cline
{
"mcpServers": {
"ctxai": {
"command": "node",
"args": [
"<YOUR_PATH_TO_CTXAI>/build/index.js"
],
"disabled": false,
"alwaysAllow": []
}
}
}