Sloot MCP Server
A complete TypeScript Model Context Protocol (MCP) server implementation using Express.js and the official MCP SDK.
Features
π Express.js HTTP Server: RESTful API with MCP protocol support
π§ Session Management: Automatic session handling with UUID-based session IDs
π οΈ Built-in Tools: Example tools including echo, time, and calculator
π‘ Streamable Transport: HTTP-based transport with Server-Sent Events (SSE)
π Type Safety: Full TypeScript implementation with strict typing
β€οΈ Health Monitoring: Built-in health check endpoint
Available Tools
The server provides the following MCP tools:
echo - Echo back any message
get_time - Get current server time
calculate - Perform basic mathematical calculations
Quick Start
Prerequisites
Node.js 18+
npm or yarn
Code Quality Tools
This project includes:
ESLint - Code linting with TypeScript support
Prettier - Code formatting
TypeScript - Type checking and compilation
Installation
Clone or download this project
Install dependencies:
Development
Run the server in development mode with hot reload:
Production
Build and run the production server:
Watch Mode
Run with file watching for development:
Code Quality
Check code quality and formatting:
Usage
Starting the Server
The server will start on port 3000 by default (configurable via PORT
environment variable):
MCP Endpoints
POST /mcp - Main MCP communication endpoint
GET /mcp - Server-to-client notifications (SSE)
DELETE /mcp - Session termination
GET /health - Health check and status
Testing the Server
You can test the health endpoint:
Response:
MCP Client Integration
This server is designed to work with MCP clients. The server handles:
Session initialization with automatic UUID generation
Session persistence across requests
Proper cleanup when sessions are closed
DNS rebinding protection (configurable)
Session Headers
When making requests to the MCP endpoint, include the session ID in headers:
Configuration
Environment Variables
PORT
- Server port (default: 3000)
DNS Rebinding Protection
For local development, you can enable DNS rebinding protection by uncommenting and configuring these options in the transport configuration:
Development
Project Structure
Scripts
npm run build
- Compile TypeScript to JavaScriptnpm run start
- Run the compiled servernpm run dev
- Run with tsx for developmentnpm run watch
- Run with file watchingnpm run lint
- Run ESLint to check for code issuesnpm run lint:fix
- Run ESLint and automatically fix issuesnpm run format
- Format code with Prettiernpm run format:check
- Check if code is properly formattednpm run check
- Run linting, formatting check, and build
Extending the Server
Adding New Tools
To add new tools, modify the ListToolsRequestSchema
handler in src/index.ts
:
Then add the tool implementation in the CallToolRequestSchema
handler.
Adding Resources
You can add MCP resources by implementing the appropriate request handlers for resources.
License
MIT
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
A TypeScript MCP server implementation using Express.js that provides basic tools like echo, time retrieval, and calculator functionality. Features session management, RESTful API endpoints, and Server-Sent Events for streamable communication.