Skip to content

Conversation

@oshchyhol
Copy link
Collaborator

@oshchyhol oshchyhol commented Jul 17, 2025

Info on this change

Changes

  • use relative import paths – subpath imports seem to upset Claude's built-in node runtime
  • change the build process to emit JS in dist/. Use tsx only for dev
  • adapt Dockerfile to the above change
  • add DXT manifest.json
  • add a script to build a .dxt artifact
  • update deps to latest
  • use node:sqlite to avoid loading shared native lib in better-sqlite3 which currently fails in Claude Desktop
Node dlopen faliure
[{"type": "text", "text": "Error executing code: MCP error -32603: dlopen(/.../Library/Application Support/Claude/Claude Extensions/local.dxt.coupler.io.coupler-io-data-analyst/node_modules/better-sqlite3/build/Release/better_sqlite3.node, 0x0001): tried: '/.../Library/Application Support/Claude/Claude Extensions/local.dxt.coupler.io.coupler-io-data-analyst/node_modules/better-sqlite3/build/Release/better_sqlite3.node' (code signature in <7EF45311-6401-30DF-9286-BBC9668E67F3> '/.../Library/Application Support/Claude/Claude Extensions/local.dxt.coupler.io.coupler-io-data-analyst/node_modules/better-sqlite3/build/Release/better_sqlite3.node' not valid for use in process: mapping process and mapped file (non-platform) have different Team IDs), '/System/Volumes/Preboot/Cryptexes/OS/.../Library/Application Support/Claude/Claude Extensions/local.dxt.coupler.io.coupler-io-data-analyst/node_modules/better-sqlite3/build/Release/better_sqlite3.node' (no such file), '/.../Library/Application Support/Claude/Claude Extensions/local.dxt.coupler.io.coupler-io-data-analyst/node_modules/better-sqlite3/build/Release/better_sqlite3.node' (code signature in <7EF45311-6401-30DF-9286-BBC9668E67F3> '/.../Library/Application Support/Claude/Claude Extensions/local.dxt.coupler.io.coupler-io-data-analyst/node_modules/better-sqlite3/build/Release/better_sqlite3.node' not valid for use in process: mapping process and mapped file (non-platform) have different Team IDs)", "uuid": "95a2f0d9-bd44-45fa-9d5a-f5f1ddabde70"}]

How to test

  • regression-test the local MCP setup with the docker image
  • install .dxt file in Claude Desktop and verify all existing flows

@oshchyhol oshchyhol requested a review from catalin27 July 18, 2025 10:58
@oshchyhol oshchyhol marked this pull request as ready for review July 18, 2025 10:58
`better-sqlite3` relies on loading a native shared lib, which fails
in Claude Desktop currently (`Claude 0.12.16 (fae442) 2025-07-14T19:10:28.000Z`)

```
dlopen(...)
... not valid for use in process: mapping process and mapped file (non-platform) have different Team IDs
```
Comment on lines +14 to +20
if [ "$CURRENT_DIR" != "$REPO_ROOT" ]; then
echo "Error: This script must be run from the repository root"
echo "Current directory: $CURRENT_DIR"
echo "Repository root: $REPO_ROOT"
echo "Please cd to the repository root and run again"
exit 1
fi

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious - why don't we cd there in the script instead?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this would normally run it from the the repo root, but if not, we'd remind about it and not take implicit action

Comment on lines +32 to +47
{
"name": "get-data",
"description": "Get data from a Coupler.io data flow run."
},
{
"name": "get-schema",
"description": "Get data table schema from a Coupler.io data flow."
},
{
"name": "list-dataflows",
"description": "List my Coupler.io data flows."
},
{
"name": "get-dataflow",
"description": "Get a Coupler.io data flow by ID."
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So we'd have to update this list whenever we add new tools?

I'll try to make an automation which would update this using git hooks as I'm adding the new executions tool

Copy link
Collaborator Author

@oshchyhol oshchyhol Jul 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, the static list of tools is rendered in the extension page in their store, but I haven't seen descriptions there.
Most of our tools seem like a candidate for a shared npm package extraction – the implementation is the same in remote MCP with the exception of get-data/schema

Comment on lines -2 to -3
import { server } from '@/server'
import { logger } from '@/logger'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, instead of relative imports, wouldn't it work to simply import { server } from 'server' (absolute import).

Because in our tsconfig.json. I see we already have the "rootDir": "./src".

If that doesn't work, then maybe setting the compilerOptions.baseUrl attribute would do the trick (I see that's how we have it configured in the web repo)

Suggesting this only because relative imports could get out of hand quite quickly 😕

Copy link
Collaborator Author

@oshchyhol oshchyhol Jul 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this controls how Typescript resolves import paths and what paths it emits during compilation, but Node wouldn't know anything about it. Node would try to look for a module server in node_modules 🤷🏼‍♂️
(setting NODE_PATH has its own problems)

This has been an unsolved problem in Node for as long as I can remember. There's a bunch of workarounds and none of them work nicely/reliably compatible with all tools :) Subpath imports is one of them https://nodejs.org/api/packages.html#subpath-imports

@oshchyhol oshchyhol requested a review from catalin27 July 21, 2025 12:36
@oshchyhol oshchyhol merged commit 8ff0267 into main Jul 21, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants