@victox/hello-stdio 0.1.3 → 0.1.4

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.
Files changed (2) hide show
  1. package/dist/index.mjs +3 -1
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -1,2 +1,4 @@
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+`
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(){process.stderr.write(`hello-mcp-server: starting (stdio)
2
+ `);let e=o({name:`hello-mcp-server`,version:`0.1.0`}),t=new n;await e.connect(t),process.stderr.write(`hello-mcp-server: ready (waiting for MCP requests)
3
+ `)}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
4
  `),process.exit(1)});export{};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@victox/hello-stdio",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "private": false,
5
5
  "description": "MCP stdio server exposing hello1/hello2 demo tools",
6
6
  "license": "MIT",