Skip to main content
Glama

example-mcp-server-stdio

by yigitkonur
package.jsonโ€ข3.67 kB
{ "name": "calculator-learning-demo-stdio", "version": "1.0.0", "type": "module", "description": "Learning-edition MCP calculator server demonstrating STDIO transport", "main": "./dist/server.js", "types": "./dist/server.d.ts", "bin": { "calculator-stdio-server": "./dist/server.js" }, "scripts": { "dev": "tsx src/server.ts", "clean": "rimraf dist build .tsbuildinfo", "typecheck": "tsc --noEmit", "lint": "eslint .", "lint:fix": "eslint . --fix", "lint:ci": "eslint . --max-warnings=0", "format": "prettier --write .", "format:check": "prettier --check .", "build": "tsc -p tsconfig.json", "check:quick": "npm run typecheck && npm run lint:ci && npm run format:check", "check:deep": "npm run typecheck && npm run lint:fix && npm run lint:ci && npm run format && npm run format:check", "pipeline": "npm run clean && npm run typecheck && npm run lint:fix && npm run lint:ci && npm run format && npm run format:check && npm run build", "smoke:stdio": "node -e \"const {spawn}=require('child_process');try{const p=spawn('node',['dist/server.js'],{stdio:['ignore','pipe','pipe']});let exited=false;const timer=setTimeout(()=>{if(!exited){p.kill('SIGINT');}},900);p.on('exit',c=>{exited=true;clearTimeout(timer);if(c&&c!==0){process.exit(c);}console.log('smoke:stdio exit',c||0);});}catch(e){console.error(e);process.exit(1);} \"", "smoke:http": "node -e \"const http=require('http');const {spawn}=require('child_process');const ports=[1453,1923,3333];const s=spawn('node',['dist/server.js'],{stdio:'inherit'});let i=0,tries=0,ok=false;function hit(){if(i>=ports.length){if(!ok){s.kill('SIGINT');process.exit(1);}return;}const port=ports[i];tries++;http.get({host:'127.0.0.1',port,path:'/'},res=>{ok=true;console.log('HTTP status',res.statusCode,'on',port);s.kill('SIGINT');if(res.statusCode>=400)process.exit(1);}).on('error',()=>{if(tries<5){setTimeout(hit,300);}else{tries=0;i++;setTimeout(hit,200);} });}setTimeout(hit,600);\"", "smoke:auto": "node -e \"const http=require('http');const {spawn}=require('child_process');const ports=[1453,1923,3333];const s=spawn('node',['dist/server.js'],{stdio:'inherit'});let i=0,tries=0,ok=false;function hit(){if(i>=ports.length){if(!ok){console.log('No HTTP detected; assuming STDIO-style process.');setTimeout(()=>{s.kill('SIGINT');process.exit(0);},800);return;}return;}const port=ports[i];tries++;http.get({host:'127.0.0.1',port,path:'/'},res=>{ok=true;console.log('HTTP status',res.statusCode,'on',port);s.kill('SIGINT');if(res.statusCode>=400)process.exit(1);}).on('error',()=>{if(tries<5){setTimeout(hit,300);}else{tries=0;i++;setTimeout(hit,200);} });}setTimeout(hit,600);\"", "all": "npm run pipeline && npm run smoke:auto", "start": "node dist/server.js", "check": "npm run typecheck && npm run lint:ci && npm run format:check", "ci": "npm run all", "inspector": "npx @modelcontextprotocol/inspector tsx src/server.ts", "prepare": "husky" }, "lint-staged": { "*.{ts,tsx,js,json,md,css,scss}": [ "prettier --write", "eslint --fix" ] }, "dependencies": { "@modelcontextprotocol/sdk": "^1.0.0", "zod": "^3.22.0" }, "devDependencies": { "@eslint/js": "^9.32.0", "@types/node": "^20.0.0", "@typescript-eslint/eslint-plugin": "^6.19.0", "@typescript-eslint/parser": "^6.19.0", "eslint": "^8.56.0", "eslint-config-prettier": "^10.1.8", "globals": "^16.3.0", "husky": "^9.1.7", "lint-staged": "^16.1.3", "prettier": "^3.2.4", "rimraf": "^6.0.1", "tsx": "^4.0.0", "typescript": "^5.3.0" }, "engines": { "node": ">=20.0.0" } }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/yigitkonur/example-mcp-server-stdio'

If you have feedback or need assistance with the MCP directory API, please join our Discord server