@victox/hello-stdio 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +2 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +2 -0
- package/package.json +10 -8
- package/dist/cli.d.ts +0 -2
- package/dist/cli.js +0 -2
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -17
package/dist/cli.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/cli.mjs
ADDED
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{McpServer as e}from"@modelcontextprotocol/sdk/server/mcp.js";import*as t from"zod/v4";import{StdioServerTransport as n}from"@modelcontextprotocol/sdk/server/stdio.js";const r=[`Hello!`,`Hi there!`,`Hey!`,`Howdy!`,`Good day!`,`Greetings!`];function i(e){if(e.length===0)throw Error(`pickRandom: empty list`);return e[Math.floor(Math.random()*e.length)]}function a(e){e.registerTool(`hello1`,{description:`Generate a random greeting.`},async()=>({content:[{type:`text`,text:i(r)}]})),e.registerTool(`hello2`,{description:`Generate a greeting addressed to a provided name.`,inputSchema:{name:t.string().min(1).describe(`Name to greet.`)}},async({name:e})=>({content:[{type:`text`,text:`${i(r)} ${e}`}]}))}function o(t,n){let r=new e(t,n);return a(r),r}async function s(){let e=o({name:`hello-mcp-server`,version:`0.1.0`}),t=new n;await e.connect(t)}process.stdin.isTTY&&process.stdin.resume(),s().catch(e=>{let t=e instanceof Error?e.stack??e.message:String(e);process.stderr.write(t+`
|
|
2
|
+
`),process.exit(1)});export{};
|
package/package.json
CHANGED
|
@@ -1,32 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@victox/hello-stdio",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "dist/index.
|
|
7
|
-
"types": "dist/index.d.
|
|
6
|
+
"main": "dist/index.mjs",
|
|
7
|
+
"types": "dist/index.d.mts",
|
|
8
8
|
"bin": {
|
|
9
|
-
"hello-mcp-server": "dist/cli.
|
|
9
|
+
"hello-mcp-server": "dist/cli.mjs"
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
12
12
|
"dist"
|
|
13
13
|
],
|
|
14
14
|
"exports": {
|
|
15
|
-
".": "./dist/index.
|
|
16
|
-
"./cli": "./dist/cli.
|
|
15
|
+
".": "./dist/index.mjs",
|
|
16
|
+
"./cli": "./dist/cli.mjs",
|
|
17
17
|
"./package.json": "./package.json"
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
|
-
"build": "
|
|
20
|
+
"build": "tsdown",
|
|
21
21
|
"prepack": "pnpm run build",
|
|
22
22
|
"start": "node dist/index.js"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
26
|
-
"
|
|
26
|
+
"zod": "^4.0.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
+
"@victox/hello-lib": "workspace:*",
|
|
29
30
|
"@types/node": "^22.10.2",
|
|
31
|
+
"tsdown": "^0.20.1",
|
|
30
32
|
"typescript": "^5.5.4"
|
|
31
33
|
}
|
|
32
34
|
}
|
package/dist/cli.d.ts
DELETED
package/dist/cli.js
DELETED
package/dist/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/index.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { createHelloServer } from "@victox/hello-lib";
|
|
2
|
-
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
3
|
-
async function main() {
|
|
4
|
-
const mcpServer = createHelloServer({
|
|
5
|
-
name: "hello-mcp-server",
|
|
6
|
-
version: "0.1.0",
|
|
7
|
-
});
|
|
8
|
-
const transport = new StdioServerTransport();
|
|
9
|
-
await mcpServer.connect(transport);
|
|
10
|
-
}
|
|
11
|
-
if (process.stdin.isTTY)
|
|
12
|
-
process.stdin.resume();
|
|
13
|
-
main().catch((err) => {
|
|
14
|
-
const message = err instanceof Error ? err.stack ?? err.message : String(err);
|
|
15
|
-
process.stderr.write(message + "\n");
|
|
16
|
-
process.exit(1);
|
|
17
|
-
});
|