MCP Hello World Server
A simple hello world MCP server with a greeting tool, deployable on Railway.
README
MCP Hello World Server
A simple hello world MCP (Model Context Protocol) server built with Node.js and TypeScript. This project is configured for easy deployment on Railway.
Features
- ✅ Simple hello world tool endpoint
- ✅ TypeScript for type safety
- ✅ Docker containerization
- ✅ Railway deployment ready
- ✅ MCP SDK integration
Prerequisites
- Node.js 18.0.0 or higher
- npm 9.0.0 or higher
Setup
-
Install dependencies:
npm install -
Build the project:
npm run build
Development
Stdio Mode (Default)
Start the server in stdio mode:
npm run dev
or with the compiled build:
npm start
The server will start and listen on stdio for incoming MCP protocol messages.
HTTP Mode
Start the server in HTTP mode by setting the PORT environment variable:
PORT=8080 npm start
The server will start on the specified port and expose:
POST /mcp- MCP protocol endpointGET /health- Health check endpoint
Example health check:
curl http://localhost:8080/health
# Response: {"status":"ok"}
Building for Production
Build the TypeScript code:
npm run build
Run the compiled server:
npm start
Project Structure
.
├── src/
│ └── index.ts # Main server implementation
├── dist/ # Compiled JavaScript (generated)
├── package.json # Project dependencies
├── tsconfig.json # TypeScript configuration
├── Dockerfile # Docker configuration
├── railway.toml # Railway deployment config
└── README.md # This file
MCP Server Tools
hello
A simple tool that returns a personalized greeting.
Parameters:
name(string, optional): The name to greet. Defaults to "World"
Example:
{
"name": "hello",
"arguments": {
"name": "Alice"
}
}
Response:
{
"content": [
{
"type": "text",
"text": "Hello, Alice! Welcome to the MCP server."
}
]
}
Deployment on Railway
Prerequisites
- Railway account (sign up at https://railway.app)
- Railway CLI installed locally (optional, but recommended)
- GitHub repository (optional, for easier deployment)
How It Works
This MCP server can run in two modes:
- Stdio Mode - Default, for local development or direct integration
- HTTP Mode - For cloud deployment (Railway, Render, etc.)
When a PORT environment variable is set, the server automatically switches to HTTP mode and exposes:
POST /mcp- MCP protocol endpoint for clientsGET /health- Health check endpoint for load balancers
Deploy Using GitHub
- Push your code to a GitHub repository
- Go to railway.app
- Click "Create New Project"
- Select "GitHub Repo"
- Authorize Railway and select your repository
- Railway will automatically detect the Node.js project and set
PORTfor you - Click "Deploy"
Railway will automatically:
- Set the
PORTenvironment variable - Build your TypeScript code
- Start the server in HTTP mode
Deploy Using Railway CLI
- Install Railway CLI: https://docs.railway.app/cli/quick-start
- Login to Railway:
railway login - Create a new project in the current directory:
railway init - Deploy:
railway up
Using the Deployed Server
Once deployed to Railway, you'll get a public URL like https://your-service.railway.app.
To use it with an MCP client:
// Example: POST request to the MCP endpoint
const response = await fetch('https://your-service.railway.app/mcp', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
jsonrpc: '2.0',
id: 1,
method: 'initialize',
params: {
protocolVersion: '2024-11-05',
capabilities: {},
clientInfo: { name: 'my-client', version: '1.0.0' }
}
})
});
const data = await response.json();
console.log(data);
Environment Variables
The server automatically detects its running environment:
- With
PORTset - Runs in HTTP mode (Railway, Render, etc.) - Without
PORT- Runs in stdio mode (local development, Docker exec)
No additional configuration needed!
Testing
To test the MCP server, you'll need an MCP client. The server communicates via:
- Stdio - Direct pipe communication for local integration
- HTTP Streamable - HTTP endpoint for cloud deployment
Local Testing with Claude Desktop
Configure Claude Desktop to use the local server in stdio mode:
Create or edit %APPDATA%\Claude\claude_desktop_config.json:
{
"mcpServers": {
"hello-world": {
"command": "node",
"args": ["C:\\path\\to\\mcp\\dist\\index.js"]
}
}
}
Then restart Claude Desktop and the hello tool will be available.
Cloud Testing with Railway
Once deployed to Railway, you can make HTTP requests to your server:
# Health check
curl https://your-service.railway.app/health
# MCP protocol request
curl -X POST https://your-service.railway.app/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "hello",
"arguments": {"name": "Alice"}
}
}'
Troubleshooting
Port Already in Use
If you see an error about the port being in use, the server may still be running. Kill it with:
# On Windows
taskkill /F /IM node.exe
# On macOS/Linux
pkill -f "node"
Module Not Found Errors
Make sure all dependencies are installed:
npm install
npm run build
TypeScript Errors
Run type checking:
npm run typecheck
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.