Anshul-Keote/SimpleMCPExample
If you are the rightful owner of SimpleMCPExample and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
CourtsApp MCP Server is an example implementation of a Model Context Protocol server using TypeScript, designed to provide simple tools for various operations.
CourtsApp MCP Server
An example Model Context Protocol (MCP) server implementation in TypeScript with three simple tools.
Quick Start
# Install dependencies
npm install
# Build the project
npm run build
# Run the server
npm start
The server will start on http://localhost:3000
MCP Client URL: http://localhost:3000/mcp
Tools
This MCP server provides three tools:
1. get_current_time
Returns the current date and time in multiple formats.
Parameters: None
Example Response:
{
"timestamp": "2025-11-04T05:46:00.000Z",
"formatted": "11/4/2025, 12:46:00 AM",
"unix": 1730698360000
}
2. calculator
Performs basic arithmetic operations.
Parameters:
operation(string): The operation to perform - "add", "subtract", "multiply", or "divide"a(number): The first numberb(number): The second number
Example Request:
{
"operation": "add",
"a": 5,
"b": 3
}
Example Response:
{
"operation": "add",
"a": 5,
"b": 3,
"result": 8,
"expression": "5 + 3 = 8"
}
3. is_even
Checks if a number is even or odd.
Parameters:
number(number): An integer to check
Example Request:
{
"number": 42
}
Example Response:
{
"number": 42,
"isEven": true,
"type": "even"
}
Installation
npm install
Build
npm run build
Running the Server
Start the HTTP server:
npm start
Or run directly with Node:
node build/index.js
The server will start on port 3000 by default. You can change the port using the PORT environment variable:
PORT=8080 npm start
The server exposes the following endpoints:
http://localhost:3000/health- Health check endpointhttp://localhost:3000/mcp- Streamable HTTP endpoint for MCP connections
Development
To watch for changes and rebuild automatically:
npm run dev
Connecting to an LLM Application
This MCP server uses Streamable HTTP (SHTTP) transport, the modern replacement for SSE. This transport is accessible via the web and MCP clients can connect to the server over HTTP.
Example Client Configuration
For MCP clients that support Streamable HTTP transport, configure with:
{
"url": "http://localhost:3000/mcp"
}
Exposing via Nginx
To expose this server to the internet using nginx, add this configuration to your nginx config:
server {
listen 80;
server_name your-domain.com;
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Then clients can connect to: http://your-domain.com/mcp
Project Structure
CourtsAppMCPServer/
├── src/
│ └── index.ts # Main server implementation
├── build/ # Compiled JavaScript output
├── package.json # Project dependencies
├── tsconfig.json # TypeScript configuration
└── README.md # This file
Dependencies
@modelcontextprotocol/sdk: Official MCP SDK for TypeScriptexpress: Web server framework for Streamable HTTP transportcors: CORS middleware for cross-origin requeststypescript: TypeScript compiler@types/node: Node.js type definitions
Deployment
Deploy to a VPS/Cloud Server
# 1. Clone the repository
git clone <your-repo-url>
cd CourtsAppMCPServer
# 2. Install dependencies
npm install
# 3. Build the project
npm run build
# 4. Install PM2 to keep the server running
npm install -g pm2
# 5. Start with PM2
pm2 start build/index.js --name mcp-server
# 6. Make it restart on reboot
pm2 startup
pm2 save
Custom Port
PORT=8080 npm start
Using with ngrok (for testing)
# Start the server
npm start
# In another terminal, expose it
ngrok http 3000
Then use the ngrok URL + /mcp for your MCP client: https://your-ngrok-url.ngrok.io/mcp
License
MIT