Addition MCP Server

Addition MCP Server

A simple demonstration MCP server that provides a basic arithmetic tool for adding two numbers together, showcasing how to build custom MCP servers with input validation.

Category
Visit Server

README

My MCP Server

A simple Model Context Protocol (MCP) server that provides an addition tool for adding two numbers together.

Overview

This MCP server implements a basic arithmetic tool that can add two numbers. It's built using the official MCP SDK and demonstrates how to create a custom MCP server.

Features

  • Addition Tool: Adds two numbers together
  • MCP Protocol: Follows the Model Context Protocol specification
  • Type Safety: Uses Zod for input validation

Installation

  1. Clone or download this repository
  2. Install dependencies:
    npm install
    

Usage

Running the Server

To run the MCP server:

node mcp.js

The server will start and listen for MCP protocol messages via stdio.

Available Tools

Addition Tool

  • Name: add
  • Description: Add two numbers together
  • Parameters:
    • a (number): First number
    • b (number): Second number
  • Returns: The sum of the two numbers as text

Example Usage

When connected to an MCP client, you can use the addition tool like this:

{
  "tool": "add",
  "parameters": {
    "a": 5,
    "b": 3
  }
}

This would return: 8

Adding to Cursor

To use this MCP server in Cursor, you need to configure it in your Cursor settings:

Method 1: Using Cursor Settings UI

  1. Open Cursor Settings:

    • Press Cmd+, (Mac) or Ctrl+, (Windows/Linux)
    • Or go to Cursor > Preferences > Settings
  2. Navigate to MCP Settings:

    • Search for "MCP" in the settings search bar
    • Click on "Model Context Protocol" settings
  3. Add the Server:

    • Click "Add Server" or the "+" button
    • Configure the server with these settings:
      Name: Addition Server
      Command: node
      Args: [path/to/your/mcp.js]
      Cwd: [path/to/your/project/directory]
      

Method 2: Using Settings JSON

  1. Open Cursor Settings JSON:

    • Press Cmd+Shift+P (Mac) or Ctrl+Shift+P (Windows/Linux)
    • Type "Preferences: Open Settings (JSON)"
    • Select it
  2. Add MCP Configuration: Add this configuration to your settings JSON:

    {
      "mcp.servers": {
        "addition-server": {
          "command": "node",
          "args": ["/Users/slav/Documents/dev/first-mcp/mcp.js"],
          "cwd": "/Users/slav/Documents/dev/first-mcp"
        }
      }
    }
    

    Important: Replace the paths with your actual project directory path.

  3. Restart Cursor:

    • Close and reopen Cursor for the changes to take effect

Using the Addition Tool in Cursor

Once configured, you can use the addition tool in Cursor by:

  1. Opening a chat with the AI assistant
  2. Asking it to add numbers: "Can you add 15 and 27 for me?"
  3. The AI will use your MCP server to perform the calculation

Troubleshooting

  • Server not found: Make sure the path to mcp.js is correct and the file exists
  • Permission errors: Ensure you have execute permissions on the Node.js binary
  • Dependencies missing: Run npm install in the project directory first
  • Port conflicts: This server uses stdio, so no port conflicts should occur

Development

Project Structure

  • mcp.js - Main server implementation
  • package.json - Node.js project configuration
  • README.md - This file

Dependencies

  • @modelcontextprotocol/sdk - Official MCP SDK
  • zod - Type validation library

License

ISC

Recommended Servers

playwright-mcp

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.

Official
Featured
TypeScript
Magic Component Platform (MCP)

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.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

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.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

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.

Official
Featured
TypeScript
Kagi MCP Server

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.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

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.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured