Custom MCP Server

by meerisha

Not rated
GitHub

About

A versatile MCP server built with Next.js, providing a range of tools and utilities with Redis state management.

Details

Author
meerisha
Categories
Developer Tools

Setup

Install Custom MCP Server in your MCP client (Claude Desktop, Cursor, Windsurf, and others).

Repository: https://github.com/meerisha/custom-mcp-server

Follow the installation instructions in the repository README, then restart your MCP client.

A versatile MCP server built with Next.js, providing a range of tools and utilities with Redis state management.

A Model Context Protocol (MCP) server built with Next.js, providing useful tools and utilities through both HTTP and Server-Sent Events (SSE) transports.

- echo- Echo any message back (perfect for testing)
- get-current-time- Get the current timestamp and ISO date
- calculate- Perform basic mathematical calculations safely

- HTTP Transport(/mcp) - Stateless HTTP requests (works without Redis)
- SSE Transport(/sse) - Server-Sent Events with Redis for state management

- Rate limiting (100 requests per minute)
- Safe mathematical expression evaluation
- Input sanitization and validation

- Node.js 18+
- npm or yarn
- Docker (optional, for local Redis)

- Create environment configuration
- Set up Redis (Docker) if available
- Start the development server automatically

The server will be available athttp://localhost:3000

# Test HTTP transport npm run test:http # Test SSE transport (requires Redis) npm run test:sse # Test with Claude Desktop protocol npm run test:stdio # Comprehensive tool testing npm run test:tools

You can test the MCP server manually using curl:

# List available tools curl -X POST http://localhost:3000/mcp \ -H "Content-Type: application/json" \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "tools/list" }' # Call the echo tool curl -X POST http://localhost:3000/mcp \ -H "Content-Type: application/json" \ -d '{ "jsonrpc": "2.0", "id": 2, "method": "tools/call", "params": { "name": "echo", "arguments": { "message": "Hello World!" } } }' # Calculate an expression curl -X POST http://localhost:3000/mcp \ -H "Content-Type: application/json" \ -d '{ "jsonrpc": "2.0", "id": 3, "method": "tools/call", "params": { "name": "calculate", "arguments": { "expression": "15 * 4 + 10" } } }'
# Local Redis (Docker) REDIS_URL=redis://localhost:6379 # Upstash Redis (Production) UPSTASH_REDIS_REST_URL=your-upstash-url UPSTASH_REDIS_REST_TOKEN=your-upstash-token

The server automatically detects and uses Redis in this priority order:
- Upstash Redis(ifUPSTASH_REDIS_REST_URLandUPSTASH_REDIS_REST_TOKENare set)
- Local Redis(ifREDIS_URLis set)
- No Redis(HTTP transport only)

# The setup script handles this automatically, but you can also run manually: docker run -d --name redis-mcp -p 6379:6379 redis:alpine

Upstash Redis (Recommended for Production)

- Create an Upstash Redis database atupstash.com - Add the connection details to your.env.local - The server will automatically detect and use it

Add to your Claude Desktop configuration (claude_desktop_config.json):

{ "mcpServers": { "custom-mcp": { "command": "npx", "args": [ "-y", "mcp-remote", "http://localhost:3000/mcp" ] } } }

- macOS:~/Library/Application Support/Claude/claude_desktop_config.json
- Windows:%APPDATA%\Claude\claude_desktop_config.json

For Cursor 0.48.0 or later (direct SSE support):

{ "mcpServers": { "custom-mcp": { "url": "http://localhost:3000/sse" } } }
{ "mcpServers": { "custom-mcp": { "command": "npx", "args": [ "-y", "mcp-remote", "http://localhost:3000/mcp" ] } } }
custom-mcp-server/ ├── app/ │ ├── [transport]/ │ │ └── route.ts # Main MCP server logic │ ├── layout.tsx # Root layout │ └── page.tsx # Home page ├── lib/ │ └── redis.ts # Redis utilities ├── scripts/ │ ├── setup.mjs # Automated setup │ ├── test-http-client.mjs # HTTP transport tests │ ├── test-sse-client.mjs # SSE transport tests │ └── test-tools.mjs # Comprehensive tool tests ├── package.json ├── next.config.ts └── README.md

- Define the toolinapp/[transport]/route.ts:

const tools = { // ... existing tools myNewTool: { name: "my-new-tool", description: "Description of what your tool does", inputSchema: { type: "object", properties: { param1: { type: "string", description: "Description of parameter" } }, required: ["param1"] } } };
const toolHandlers = { // ... existing handlers "my-new-tool": async ({ param1 }: { param1: string }) => { // Your tool logic here return { content: [ { type: "text", text: Result: ${param1} } ] }; } };
# Run all tests npm run test:tools # Test specific functionality npm run test:http npm run test:sse
{ "jsonrpc": "2.0", "id": 1, "method": "tools/list" }
{ "jsonrpc": "2.0", "id": 2, "method": "tools/call", "params": { "name": "tool-name", "arguments": { "param": "value" } } }

Add environment variables in Vercel dashboard:

- UPSTASH_REDIS_REST_URL
- UPSTASH_REDIS_REST_TOKEN

Update your AI tool configurationsto use the deployed URL:

https://your-app.vercel.app/mcp https://your-app.vercel.app/sse

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
- Fork the repository
- Create a feature branch:git checkout -b feature/my-new-feature
- Make your changes and add tests
- Run the test suite:npm run test:tools
- Commit your changes:git commit -am 'Add some feature'
- Push to the branch:git push origin feature/my-new-feature
- Submit a pull request

MIT License - see LICENSE file for details.

- Check if port 3000 is available
- Ensure all dependencies are installed:npm install

- Verify Docker is running:docker ps
- Check Redis container status:docker ps -a | grep redis-mcp
- Restart Redis:docker restart redis-mcp

- 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

- Check server logs for error messages
- Test tools manually withnpm run test:tools
- Verify the tool parameters match the expected schema

Enable debug logging by setting the environment variable:

- Create an issue on GitHub for bug reports
- Check existing issues for common problems
- Review the test scripts for usage examples

This is a web browser that enables your coding agent, such as Claude Code, to visit websites on your behalf and assist you in identifying bugs or creating UI test cases.

Create crafted UI components inspired by the best 21st.dev design engineers.

Bring agent evaluations, observability, and synthetic test set generation directly into your IDE for free with Galileo's new MCP server

An MCP server to help AI assistants to answer questions and generate AccelByte Extend SDK code more effectively .

MCP server for AI Diagram Maker — generate beautiful software engineering diagrams directly inside Cursor, Claude Desktop, Claude Code, or any MCP-compatible AI agent

ALAPI MCP Tools,Call hundreds of API interfaces via MCP

AI-powered SVG animation generator that transforms static files into animated SVG components using the Allyson platform

MCP server that gives AI assistants on-demand access to 1,500+ amCharts docs, ~300 code examples, and 1000+ class API references.

APIMatic MCP Server is used to validate OpenAPI specifications using APIMatic. The server processes OpenAPI files and returns validation summaries by leveraging APIMatic’s API.

One shared context layer for AI agents and humans — live API specs, DB schemas, and versioned contracts across repos so every agent and teammate works from the same source of truth.

Build and deploy full-stack Next.js apps with 98 tools for React, AWS, and MongoDB

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.