Written by

Article Jinyao · 6 hr ago 2m read

No-Hallucinate MCP: Real-time Routine Context for ObjectScript

Motivation


Why do we need this?

  1. Lack of Compiled Context: AI tools only see source code; they don't know what the final compiled routine looks like.

  2. Macro Hallucination: Because AI doesn't see our #include files or system macros, it often makes them up, wasting time during debugging.

  3. The Documentation Gap: Deep logic optimization often requires understanding internal macros that aren't fully covered in public documentation.

  4. Manual Overhead: Currently, the only way to fix this is to manually use the IRIS VS Code extension to find the "truth" in the routine.

The Solution: This MCP server gives our AI "eyes" inside our IRIS instance, allowing it to read routines and expand macros automatically before it suggests code to you.

Quick Start

Try this MCP server with the ObjectScript project apiPub.

Fetch the routine for api.cls:
alt text

Press ctrl+shift+v to view the compiled routine. In compiler terminology these are called readable intermediate code. LLMs lack this context — which is why even frontier models invent macros, because they don't know what the expanded code looks like.
alt text

They also don't know which .inc files are imported, or what the $$$xxx macros inside them expand to.

For example, a .inc file may explicitly include system macros:
alt text

If you are connected to an IRIS instance you can navigate into those macro files directly:
alt text

Without explicitly including these system macros there is no way to reach those files — and the LLM has no visibility into them at all.
alt text

Under the .vscode folder, add the following to mcp.json:

{
  "servers": {
    "intersystemsObjectscriptRoutine": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "intersystems-objectscript-routine-mcp"],
      "env": {
        "IRIS_URL": "http://localhost:52773",
        "IRIS_NAMESPACE": "IRISAPP",
        "IRIS_USERNAME": "_SYSTEM",
        "IRIS_PASSWORD": "SYS"
      }
    }
  }
}

Open VS Code Copilot in agent mode (the MCP tool is not invoked in other modes). Press ctrl+shift+p and choose MCP: List Servers:
alt text

Start the MCP server:
alt text

Ask about a routine:
alt text

Ask to list all available .inc files:
alt text

Fetch the contents of a specific .inc file:
alt text

The similar MCP configuration works in other VS Code forks such as Cursor, Antigravity and Windsurf, as well as CLI tools like Claude Code and Codex.
Links:
https://www.npmjs.com/package/intersystems-objectscript-routine-mcp
https://github.com/cjy513203427/intersystems-objectscript-mcp

Comments

Guillaume Rongier · 3 hr ago

Great very useful, i plan to do the same but for classes, it's ok for custom classes they are on your local folder, the LLM claude, codex, copilot can parse them, but not for server side classes for example in Ens.Director or others.

Do you plan to support it too ?

0