Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Custom MCP Servercalculate 25 * 4 + 15"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Custom MCP Server π€
A Model Context Protocol (MCP) server built with Next.js, providing useful tools and utilities through both HTTP and Server-Sent Events (SSE) transports.
π Features
π§ Available Tools
echo - Echo any message back (perfect for testing)
get-current-time - Get the current timestamp and ISO date
calculate - Perform basic mathematical calculations safely
π Transport Methods
HTTP Transport (
/mcp) - Stateless HTTP requests (works without Redis)SSE Transport (
/sse) - Server-Sent Events with Redis for state management
π Security Features
Rate limiting (100 requests per minute)
Safe mathematical expression evaluation
Input sanitization and validation
πββοΈ Quick Start
Prerequisites
Node.js 18+
npm or yarn
Docker (optional, for local Redis)
Setup
Clone and install dependencies:
npm installRun the automated setup:
npm run setupThis will:
Create environment configuration
Set up Redis (Docker) if available
Start the development server automatically
Manual start (alternative):
npm run dev
The server will be available at http://localhost:3000
π§ͺ Testing
Quick Tests
Manual Testing
You can test the MCP server manually using curl:
π§ Configuration
Environment Variables
Create a .env.local file:
Redis Setup
The server automatically detects and uses Redis in this priority order:
Upstash Redis (if
UPSTASH_REDIS_REST_URLandUPSTASH_REDIS_REST_TOKENare set)Local Redis (if
REDIS_URLis set)No Redis (HTTP transport only)
Local Redis with Docker
Upstash Redis (Recommended for Production)
Create an Upstash Redis database at upstash.com
Add the connection details to your
.env.localThe server will automatically detect and use it
π₯οΈ Integration with AI Tools
Claude Desktop
Add to your Claude Desktop configuration (claude_desktop_config.json):
Configuration file locations:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
Cursor IDE
For Cursor 0.48.0 or later (direct SSE support):
For older Cursor versions:
π οΈ Development
Project Structure
Adding New Tools
Define the tool in
app/[transport]/route.ts:
Add the handler:
Testing Your Changes
π API Reference
Tools/List
Get all available tools:
Tools/Call
Call a specific tool:
π Deployment
Vercel (Recommended)
Deploy to Vercel:
vercelAdd environment variables in Vercel dashboard:
UPSTASH_REDIS_REST_URLUPSTASH_REDIS_REST_TOKEN
Update your AI tool configurations to use the deployed URL:
https://your-app.vercel.app/mcp https://your-app.vercel.app/sse
Other Platforms
The server is a standard Next.js application and can be deployed to any platform that supports Node.js:
Netlify
Railway
Render
DigitalOcean App Platform
π€ Contributing
Fork the repository
Create a feature branch:
git checkout -b feature/my-new-featureMake your changes and add tests
Run the test suite:
npm run test:toolsCommit your changes:
git commit -am 'Add some feature'Push to the branch:
git push origin feature/my-new-featureSubmit a pull request
π License
MIT License - see LICENSE file for details.
π Troubleshooting
Common Issues
Server not starting:
Check if port 3000 is available
Ensure all dependencies are installed:
npm install
Redis connection issues:
Verify Docker is running:
docker psCheck Redis container status:
docker ps -a | grep redis-mcpRestart Redis:
docker restart redis-mcp
AI tool not detecting server:
Ensure the server is running and accessible
Check the configuration file syntax (valid JSON)
Restart your AI tool after configuration changes
Verify the server URL is correct
Tool calls failing:
Check server logs for error messages
Test tools manually with
npm run test:toolsVerify the tool parameters match the expected schema
Debug Mode
Enable debug logging by setting the environment variable:
π Support
Create an issue on GitHub for bug reports
Check existing issues for common problems
Review the test scripts for usage examples