Skip to content

Commit 5f56442

Browse files
authored
Refactor to binary entry point (#22)
1 parent 686415e commit 5f56442

File tree

3 files changed

+54
-4
lines changed

3 files changed

+54
-4
lines changed

package.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "@makingchatbots/genesys-cloud-mcp-server",
3-
"version": "0.0.10",
3+
"version": "0.0.11",
44
"description": "A Model Context Protocol (MCP) server exposing Genesys Cloud tools for LLMs, including sentiment analysis, conversation search, topic detection and more.",
5-
"exports": "./dist/index.js",
5+
"bin": "./dist/cli.js",
66
"type": "module",
77
"license": "ISC",
88
"repository": {
@@ -22,7 +22,7 @@
2222
"start:inspector": "npm run build && npx @modelcontextprotocol/inspector node dist/index.js",
2323
"clean": "rm -rf dist/*",
2424
"build:esm": "tsc -p tsconfig.build.json",
25-
"build": "npm run clean && npm run build:esm",
25+
"build": "npm run clean && npm run build:esm && chmod +x dist/cli.js",
2626
"lint": "eslint . --ext .ts",
2727
"format": "prettier --write .",
2828
"prettier:check": "prettier --check src/**/*.ts *.md tests/**/*.ts --no-error-on-unmatched-pattern",
@@ -32,7 +32,8 @@
3232
"check": "npm run lint:check && npm run prettier:check",
3333
"fix": "npm run lint:fix && npm run prettier:fix",
3434
"test": "npx vitest --config ./vitest.config.ts",
35-
"prepublishOnly": "npm run test && npm run build"
35+
"prepublishOnly": "npm run test && npm run build",
36+
"test:pack": "npm run build && npm pack --pack-destination ./dist"
3637
},
3738
"dependencies": {
3839
"@modelcontextprotocol/sdk": "^1.12.1",

src/cli.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/usr/bin/env node
2+
import "./index.js";

tests/serverRuns.test.ts

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,51 @@ describe("Server Runs", () => {
4747
"conversation_transcript",
4848
]);
4949
});
50+
51+
test("server runs via cli", async () => {
52+
const transport = new StdioClientTransport({
53+
command: "node",
54+
args: ["--inspect", join(__dirname, "../dist/cli.js")],
55+
env: {
56+
PATH: process.env.PATH!,
57+
GENESYSCLOUD_REGION: "test-value",
58+
GENESYSCLOUD_OAUTHCLIENT_ID: "test-value",
59+
GENESYSCLOUD_OAUTHCLIENT_SECRET: "test-value",
60+
},
61+
});
62+
63+
client = new Client({
64+
name: "test-client",
65+
version: "1.0.0",
66+
});
67+
68+
await client.connect(transport);
69+
70+
const { tools } = await client.listTools();
71+
expect(tools.length).toBeGreaterThan(0);
72+
});
73+
74+
test("server runs via npx", async () => {
75+
execSync("npm link", { stdio: "inherit" });
76+
const transport = new StdioClientTransport({
77+
command: "npx",
78+
args: ["--no-install", "@makingchatbots/genesys-cloud-mcp-server"],
79+
env: {
80+
PATH: process.env.PATH!,
81+
GENESYSCLOUD_REGION: "test-value",
82+
GENESYSCLOUD_OAUTHCLIENT_ID: "test-value",
83+
GENESYSCLOUD_OAUTHCLIENT_SECRET: "test-value",
84+
},
85+
});
86+
87+
client = new Client({
88+
name: "test-client",
89+
version: "1.0.0",
90+
});
91+
92+
await client.connect(transport);
93+
94+
const { tools } = await client.listTools();
95+
expect(tools.length).toBeGreaterThan(0);
96+
});
5097
});

0 commit comments

Comments
 (0)