@ezmcpz/transport-stdio
v0.1.2
Published
Stdio transport for EZMCPZ
Downloads
8
Readme
@ezmcpz/transport-stdio
Stdio transport for EZMCPZ. Enables communication with MCP clients via standard input/output.
Installation
npm install @ezmcpz/transport-stdio
# or
pnpm add @ezmcpz/transport-stdioUsage
import { McpServer } from '@ezmcpz/core';
import { stdioTransport } from '@ezmcpz/transport-stdio';
const server = new McpServer({
name: 'my-server',
version: '1.0.0'
});
// Add stdio transport
server.use(stdioTransport());
await server.start();Configuration
Currently, the stdio transport doesn't require any configuration options, but the API accepts an options object for future extensibility:
server.use(stdioTransport({
// Options will be added in future versions
}));How It Works
The stdio transport:
- Uses the official MCP SDK's
StdioServerTransport - Communicates via stdin/stdout using JSON-RPC 2.0
- Automatically handles MCP protocol messages
- Routes tool and resource calls to your server handlers
Use Cases
- Local MCP clients (Claude Desktop, etc.)
- Command-line tools
- Process-to-process communication
- Development and testing
Example
import { McpServer } from '@ezmcpz/core';
import { stdioTransport } from '@ezmcpz/transport-stdio';
import { z } from 'zod';
const server = new McpServer({
name: 'calculator',
version: '1.0.0'
})
.tool('add', {
description: 'Add two numbers',
schema: z.object({
a: z.number(),
b: z.number()
}),
handler: async (args) => {
return { result: args.a + args.b };
}
})
.use(stdioTransport());
await server.start();License
MIT
