@ottrix/mcp-server
v0.1.0
Published
Expose ottrix tools as an MCP server (stdio or SSE)
Downloads
140
Readme
@ottrix/mcp-server
Part of Ottrix — TypeScript framework for production LLM agents.
Core:ottrix· All packages: docs/README.md
Expose ottrix tools as an MCP server so Claude Desktop, Cursor, and other MCP clients can call your tools.
This is the reverse of ottrix core's MCP client (MCPClient, MCPToolProvider) — core connects to external MCP servers; this package lets others connect to your ottrix tools.
Install
npm install @ottrix/mcp-server ottrixProgrammatic use
import { FunctionTool, ToolRegistry } from 'ottrix';
import { serveMCP } from '@ottrix/mcp-server';
const registry = new ToolRegistry();
registry.register(
new FunctionTool({
name: 'echo',
description: 'Echoes input',
inputSchema: {
type: 'object',
properties: { message: { type: 'string' } },
required: ['message'],
},
execute: async (input) => ({ echoed: input.message }),
}),
);
await serveMCP({
name: 'my-tools',
version: '1.0.0',
toolRegistry: registry,
transport: 'stdio',
});CLI
npx ottrix-serve --transport stdio
npx ottrix-serve --transport sse --port 3001
npx ottrix-serve --config ./mcp.config.mjsConfig module example:
import { FunctionTool } from 'ottrix';
export default {
name: 'my-tools',
transport: 'stdio',
setup({ registry }) {
registry.register(/* ... */);
},
};Transports
| Transport | Use case |
|-----------|----------|
| stdio | Claude Desktop, local subprocess clients |
| SSE | HTTP clients — GET /sse + POST /message?sessionId=… |
Exports
MCPServer— protocol handler with stdio/SSE transportsserveMCP()— create and start in one callMcpStdioServerTransport,McpSseServerTransport— advanced compositionASK_AGENT_TOOL_NAME— optional meta-tool when anAgentis passed toMCPServer
Related packages
| Package | Role |
|---------|------|
| ottrix | Tools, ToolRegistry, MCP client (MCPClient) |
| @ottrix/exporter-* | Trace export to Langfuse, OTel, Braintrust |
| @ottrix/nestjs / express / fastify / hono | HTTP APIs that use ottrix agents |
See docs/README.md.
