Skip to content

Commit 5ab53b0

Browse files
authored
Merge pull request #5 from railsware/use-node
Migrate to NodeJS
2 parents d3ae829 + d06aa7d commit 5ab53b0

File tree

21 files changed

+5950
-811
lines changed

21 files changed

+5950
-811
lines changed

.env.example

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# See https://github.com/oven-sh/bun/blob/500199fe8b61bde69a73a635e1546c2c099ca282/docs/runtime/env.md
2-
31
NODE_ENV=development
42
COUPLER_API_HOST=http://lvh.me:3000/mcp
53
COUPLER_ACCESS_TOKEN=<your_token>

.github/workflows/lint-and-test.yml

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,34 @@ jobs:
1212
- name: Checkout code
1313
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1414

15-
- name: Set up Bun
16-
uses: oven-sh/setup-bun@735343b667d3e6f658f44d0eca948eb6282f2b76 # v2.0.2
17-
id: setup-bun
15+
- name: Set up Node
16+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
17+
id: setup-node
1818
with:
19-
bun-version-file: .tool-versions
19+
node-version-file: .tool-versions
2020

21-
- name: Save & restore bun install and node_modules cache
22-
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
23-
id: bun-cache
21+
- name: Get npm cache directory
22+
id: npm-cache-dir
23+
shell: bash
24+
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
25+
26+
- name: Save & restore node cache
27+
uses: actions/cache@v4
28+
id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true'
2429
with:
25-
path: |
26-
~/.bun/install/cache
27-
node_modules
28-
key: ${{ runner.os }}-${{ steps.setup-bun.outputs.bun-version }}-node_modules-${{ hashFiles('bun.lock') }}
30+
path: ${{ steps.npm-cache-dir.outputs.dir }}
31+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
32+
restore-keys: |
33+
${{ runner.os }}-node-
2934
3035
- name: Install dependencies
3136
run: |
32-
bun install --frozen-lockfile
37+
npm ci
3338
3439
- name: Lint code
3540
run: |
36-
bun lint
41+
npm run lint
3742
3843
- name: Run tests
3944
run: |
40-
bun test
45+
npm run test

.gitignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ yarn-error.log*
77
lerna-debug.log*
88
.pnpm-debug.log*
99

10-
# Bun
11-
package-lock.json
12-
.bun
13-
1410
# Misc
1511
.DS_Store
1612

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
loglevel=silent

.tool-versions

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
nodejs 22.14.0
2-
bun 1.2.12
1+
nodejs 22.15.1

README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ The Coupler.io MCP Server is a Model Context Protocol (MCP) server that provides
2020
"command": "docker",
2121
"args": [
2222
"run",
23+
"--pull=always",
2324
"-e",
2425
"COUPLER_ACCESS_TOKEN",
2526
"--rm",
@@ -34,6 +35,9 @@ The Coupler.io MCP Server is a Model Context Protocol (MCP) server that provides
3435
}
3536
```
3637

38+
NOTE: `"--pull=always"` will ensure you always have the latest image by pulling it from the registry.
39+
Remove this line, if you're offline or if you specifically want to use the image you've already pulled previously.
40+
3741
## Tools
3842
### Data flows
3943
- **get-data** - Gets the result of a data flow run as a SQLite file and executes a read-only query on it.
@@ -45,17 +49,15 @@ The Coupler.io MCP Server is a Model Context Protocol (MCP) server that provides
4549

4650
## Development
4751

48-
Install Bun and NodeJS:
52+
Install NodeJS:
4953
```shell
50-
# Add Bun plugin
51-
asdf plugin add bun
5254
asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git
5355
asdf install
5456
```
5557

5658
Install dependencies:
5759
```shell
58-
bun install
60+
npm install
5961
```
6062

6163
Install Git hooks:
@@ -71,20 +73,20 @@ cp .env.example .env.local
7173
### Work with a raw server
7274
Run the MCP server:
7375
```shell
74-
bun start
76+
npm run dev
7577
```
7678

7779
#### Run [MCP server inspector](https://github.com/modelcontextprotocol/inspector) for debugging
7880
Caveat: make sure to keep only a single inspector tab open at all times, until [this inspector bug](https://github.com/modelcontextprotocol/inspector/issues/302) is fixed.
7981
```shell
8082
# Run this and follow the instructions to view the inspector
81-
bun inspect:bun
83+
npm run inspect:node
8284
```
8385

8486
#### Tail logs
8587
Our local MCP server uses STDIO transport, therefore logs must go to a file. This may come in handy when debugging.
8688
```shell
87-
tail -f log/development.log | bun pino-pretty
89+
tail -f log/development.log | npx pino-pretty
8890
```
8991
You can also optionally capture STDIO messages in the log file by setting `LOG_STDIO=1` when running the server.
9092
If you're debugging a containerized server, you'd likely want to mount a dir at `/app/log` to be able to access the logs it generates.
@@ -97,7 +99,7 @@ bin/build_image
9799

98100
You can now run the container with the MCP inspector for debugging:
99101
```shell
100-
bun inspect:docker
102+
npm run inspect:docker
101103
```
102104

103105
Or run the container within Claude Desktop, configured with your `.env.local` file in the project.

bun.lock

Lines changed: 0 additions & 729 deletions
This file was deleted.

bunfig.toml

Lines changed: 0 additions & 4 deletions
This file was deleted.

config/mcp-inspector/development.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515
"coupler-io-mcp-server-development"
1616
]
1717
},
18-
"coupler_bun": {
19-
"command": "bun",
18+
"coupler_node": {
19+
"command": "npm",
2020
"args": [
21+
"run",
2122
"dev"
2223
]
2324
}

docker/Dockerfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM oven/bun:1.2.12-slim AS base
1+
FROM node:22.15.1-slim AS base
22

33
ENV NODE_ENV=production
44
ENV COUPLER_API_HOST=https://app.coupler.io/mcp
@@ -8,15 +8,15 @@ WORKDIR /app
88

99
FROM base AS install
1010
WORKDIR /temp/install
11-
COPY package.json bun.lock ./
12-
RUN bun install --frozen-lockfile --production
11+
COPY package.json package-lock.json ./
12+
RUN npm ci
1313

1414
FROM base AS final
1515
COPY --from=install /temp/install/node_modules node_modules
1616
COPY . .
1717
# We may write logs to this dir
18-
RUN chown -R bun:bun /app/log
18+
RUN chown -R node:node /app/log
1919

20-
USER bun
20+
USER node
2121

22-
CMD ["bun", "start"]
22+
CMD ["npm", "run", "--silent", "start"]

0 commit comments

Comments
 (0)