Sloot MCP Server
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.
README
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:
npm install
Development
Run the server in development mode with hot reload:
npm run dev
Production
Build and run the production server:
npm run build
npm start
Watch Mode
Run with file watching for development:
npm run watch
Code Quality
Check code quality and formatting:
# Lint the code
npm run lint
# Fix linting issues automatically
npm run lint:fix
# Format code with Prettier
npm run format
# Check if code is properly formatted
npm run format:check
# Run all checks (lint + format check + build)
npm run check
Usage
Starting the Server
The server will start on port 3000 by default (configurable via PORT environment variable):
🚀 MCP Server running on port 3000
📡 MCP endpoint: http://localhost:3000/mcp
❤️ Health check: http://localhost:3000/health
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:
curl http://localhost:3000/health
Response:
{
"status": "healthy",
"timestamp": "2024-01-01T12:00:00.000Z",
"activeSessions": 0
}
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:
mcp-session-id: <session-uuid>
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:
enableDnsRebindingProtection: true,
allowedHosts: ['127.0.0.1'],
Development
Project Structure
sloot-mcp/
├── src/
│ └── index.ts # Main server implementation
├── dist/ # Compiled JavaScript (generated)
├── package.json # Dependencies and scripts
├── tsconfig.json # TypeScript configuration
└── README.md # This file
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:
server.setRequestHandler(ListToolsRequestSchema, async () => {
return {
tools: [
// ... existing tools
{
name: "your_tool",
description: "Description of your tool",
inputSchema: {
type: "object",
properties: {
// Define your tool's parameters
},
required: ["required_param"]
}
}
]
};
});
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
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.