home / mcp / my first mcp server

My First MCP Server

A minimal MCP server with basic tools to learn MCP development and testing.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "dh1789-my-first-mcp": {
      "command": "claude",
      "args": [
        "mcp",
        "add",
        "my-first-mcp",
        "--",
        "node",
        "/path/to/my-first-mcp/dist/index.js"
      ]
    }
  }
}

This minimal MCP server lets you experiment with the Model Context Protocol by exposing a few practical tools you can call from an MCP client. It’s designed for learning, quick testing, and building intuition around how an MCP server processes requests and returns results.

How to use

To use this MCP server from an MCP client, first register the server with your MCP client, then call the available tools to perform common tasks. You can test basic interactions locally using the built-in Inspector and by starting the server directly.

Connect the server to your MCP client and verify the connection, then run tools to perform tasks such as getting the current time, performing calculations, or inspecting server information. Use the MCP Inspector for interactive testing and debugging.

When you are ready to run the server on its own, start it and observe responses from the client as you request different operations.

# Register the MCP server with your client (example command)
claude mcp add my-first-mcp -- node /path/to/my-first-mcp/dist/index.js

# Verify the registered server
claude mcp list

How to install

Prerequisites you need before installing:
- Node.js 20+
- npm or pnpm (your preferred package manager)

Follow these concrete steps to set up the server locally.

# Clone the project
git clone https://github.com/dh1789/my-first-mcp.git
cd my-first-mcp

# Install dependencies
npm install

# Build the project
npm run build

Additional notes

After building, you can test and run the server in multiple ways. Use the MCP Inspector for quick in-browser testing, or start the server directly to run it as a standalone service.

# Run the inspector for interactive testing
npm run inspect

# Start the MCP server directly
npm start

Available tools

get_current_time

Query the current system time from the MCP server.

calculate

Perform basic arithmetic operations (addition, subtraction, multiplication, division) on provided operands.

get_random_number

Generate a random number or a sequence of numbers as requested.

reverse_string

Return the reverse of a given string.

get_server_info

Retrieve information about the MCP server, such as version and status.

analyze_structure

Analyze and describe the project structure or code layout.

analyze_dependencies

Analyze project dependencies and their versions.

count_lines

Count lines of code in a given set of files or a project.

server_status

Check the current operational status of the MCP server.