const require_chunk = require('./chunk-DWy1uDak.cjs');
const require_version = require('./version-CdN5Kpjv.cjs');
const __sentry_node = require_chunk.__toESM(require("@sentry/node"));
const __modelcontextprotocol_sdk_server_stdio_js = require_chunk.__toESM(require("@modelcontextprotocol/sdk/server/stdio.js"));

//#region src/transports/stdio.ts
/**
* Starts the MCP server with stdio transport and telemetry.
*
* Connects the server using stdio transport for process-based communication.
* Context is already captured in tool handler closures during buildServer().
* All operations are wrapped in Sentry tracing for observability.
*
* @param server - Configured and instrumented MCP server instance (with context in closures)
* @param context - Server context with authentication and configuration (for telemetry attributes)
*
* @example CLI Integration
* ```typescript
* import { buildServer } from "./server.js";
* import { startStdio } from "./transports/stdio.js";
*
* const context = {
*   accessToken: userToken,
*   sentryHost: "sentry.io",
*   userId: "user-123",
*   clientId: "cursor-ide",
*   constraints: {}
* };
*
* const server = buildServer({ context }); // Context captured in closures
* await startStdio(server, context);
* ```
*/
async function startStdio(server, context) {
	await __sentry_node.startNewTrace(async () => {
		return await __sentry_node.startSpan({
			name: "mcp.server/stdio",
			attributes: {
				"mcp.transport": "stdio",
				"network.transport": "pipe",
				"service.version": require_version.LIB_VERSION
			}
		}, async () => {
			const transport = new __modelcontextprotocol_sdk_server_stdio_js.StdioServerTransport();
			await server.connect(transport);
		});
	});
}

//#endregion
Object.defineProperty(exports, 'startStdio', {
  enumerable: true,
  get: function () {
    return startStdio;
  }
});
//# sourceMappingURL=stdio-CV8Yynj8.cjs.map