This is a Model Context Protocol (MCP) server implementation written in ReScript. It demonstrates best practices for:
- Server initialization and configuration
- Tool registration and management
- Error handling and logging
- Resource cleanup
- Node.js 18+
- pnpm, npm, or yarn
-
Install dependencies:
pnpm install # or npm install # or yarn install
-
Build the ReScript files:
pnpm res:build # or npm run res:build # or yarn res:build
-
Start the server:
pnpm start # or npm start # or yarn start
For development with automatic rebuilding and the MCP inspector:
pnpm dev
# or
npm run dev
# or
yarn dev
src/MCP_SDK.res
- ReScript bindings for @modelcontextprotocol/sdksrc/Index.res
- Main server entry pointsrc/examples/
- Example tool implementationsCalculator.res
- Simple calculator toolRestApi.res
- REST API interaction example
To add a new tool, follow the pattern in the example files:
- Define a schema using rescript schema
- Implement the tool handler function
- Register the tool with the server in
Index.res