A learning project for the Model Context Protocol using the TypeScript SDK (@modelcontextprotocol/sdk v1.27.x). Demonstrates two transport modes with a single hello_world tool.
npm installThe client spawns the server as a subprocess and communicates over stdin/stdout. Best for local dev and desktop app integrations (e.g. Kiro, Claude Desktop).
npm startTo wire it into Kiro, add to .kiro/settings/mcp.json:
{
"mcpServers": {
"hello-world": {
"command": "node",
"args": ["<absolute-path>/src/mcp-stdio.js"],
"disabled": false
}
}
}An Express server exposing the MCP protocol over HTTP with session management. Best for shared or cloud deployments.
npm run start:hostedListens on http://localhost:3000/mcp (override with PORT env var).
Endpoints:
POST /mcp— initialize session + send requestsGET /mcp— server→client SSE stream (existing session)DELETE /mcp— end sessionGET /healthz— health check
A small script that connects to the hosted server, lists tools, and calls hello_world:
# start the hosted server first, then in another terminal:
node test-streamable-http.jssrc/
mcp-stdio.js # stdio transport (McpServer)
mcp-streamable-http.js # Streamable HTTP transport (McpServer + Express)
test-streamable-http.js # test client for the hosted server
Both servers use the high-level McpServer API from @modelcontextprotocol/sdk/server/mcp.js. Key concepts:
server.registerTool(name, config, handler)— register a tool (capabilities auto-declared)server.registerResource(name, uri, config, handler)— expose read-only dataserver.registerPrompt(name, config, handler)— reusable prompt templatesserver.connect(transport)— bind to a transport and start serving
Docs: https://github.com/modelcontextprotocol/typescript-sdk/tree/v1.x