Skip to main content
Glama
Mtar786

Example MCP Server

by Mtar786

Example MCP Server

This repository contains a minimal Model Context Protocol (MCP) server written in Node.js. The server exposes two simple tools that can be called from AI assistants (such as Claude Desktop or Cursor) via the MCP standard.

Tools provided

Tool name

Description

Parameters

Return value

add

Adds two numbers together

a (number), b (number)

Text containing the sum

getTime

Returns the current server time in ISO format

none

Text with an ISO timestamp

These tools are defined in the index.js file using the McpServer class from the official SDK. You can extend this server by registering your own tools with custom parameters and logic.

Related MCP server: MCP Server Basic Example

Installation

  1. Install Node.js (version 20 or later is recommended).

  2. Clone this repository and install dependencies:

    npm install

    The @modelcontextprotocol/sdk package is published on npm. This example uses version 1.17.0 as referenced in package.json. MCP requires Node.js 18.x or higher to run properly【364465667226308†L72-L78】.

Running the server

Run the server with Node:

npm start

By default the server uses the StdioServerTransport to communicate. This means it will read JSON‑RPC 2.0 messages from stdin and write responses to stdout. Tools like Claude Desktop or Cursor will manage this communication for you.

Connecting with Claude Desktop

To connect this server to Claude Desktop, add an entry in your mcp.json configuration file (usually located in your ~/.claude/ or ~/.cursor/ directory depending on the client). An example configuration looks like this:

{
  "mcpServers": {
    "example-server": {
      "command": "/absolute/path/to/node",
      "args": [
        "/absolute/path/to/index.js"
      ]
    }
  }
}

Replace the command path with the absolute path to your Node binary (e.g. the output of which node) and update the args path to point to this project's index.js file.

After saving the config, restart your Claude Desktop app, grant permission to the tools when prompted, and you can invoke them by writing natural language instructions like:

“Add 3 and 5.” — Claude will call the add tool and return the sum.

“What’s the current time?” — Claude will call the getTime tool and return the timestamp.

References

  • The concept of MCP servers is described in Anthropic’s announcement【714031847317279†L20-L36】 and documented in several tutorials【67709559959600†L144-L178】.

  • For an example of defining tools with the official SDK, see the minimal server from the mcp-server-node project【966057210205090†L0-L18】.

License

This example is provided for educational purposes. Modify and adapt it to suit your own MCP workflows.

Available Tools

2 tools
addC

Add two numbers together

ParametersJSON Schema
NameRequiredDescriptionDefault
aYes
bYes

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It only states the basic function without mentioning error handling, precision limits, or output format, leaving significant gaps for a tool that performs a mathematical operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise and front-loaded in a single sentence with zero waste. Every word directly contributes to understanding the tool's purpose without unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations, output schema, and low schema description coverage, the description is incomplete. It doesn't address behavioral aspects like error cases or result format, making it inadequate for a tool with two parameters and no structured support.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 0%, but the description implies the parameters are numbers to be added. It doesn't specify parameter roles or constraints beyond what the schema's type hints provide, resulting in a baseline score due to minimal added value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('Add') and resource ('two numbers'), making it immediately understandable. However, it doesn't distinguish from sibling tools (like 'getTime'), which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives or in what context it should be applied. It simply states what it does without any usage context or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

getTimeB

Get the current server time

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It states what the tool does ('Get the current server time') but doesn't disclose behavioral traits like whether this requires authentication, has rate limits, returns a specific format, or has any side effects. For a tool with zero annotation coverage, this is a significant gap in behavioral transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero wasted words. It's front-loaded with the core purpose and appropriately sized for this simple tool. Every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (0 parameters, no annotations, no output schema), the description is minimally complete—it states what the tool does. However, without annotations or output schema, it lacks information about return format or behavioral constraints that would be helpful for an agent. It's adequate but has clear gaps for a tool that returns data.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters with 100% schema description coverage (empty schema). The description doesn't need to explain parameters since there are none, and it correctly doesn't mention any. This exceeds the baseline of 3 for high schema coverage by being perfectly appropriate for a parameterless tool.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Get the current server time' clearly states the verb ('Get') and resource ('current server time'), making the purpose immediately understandable. It's not tautological with the name 'getTime' since it specifies 'server time' rather than just 'time'. However, it doesn't differentiate from sibling tools beyond the obvious domain difference.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance about when to use this tool versus alternatives. While the sibling tool 'add' appears unrelated (likely mathematical), there's no explicit comparison or context about when this time-fetching operation is appropriate versus other time-related operations that might exist in a broader context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 1 tool updatev1.0.0
    • ChangedgetTime1 field changed
      • removedInput schema / additionalProperties
        Removed value: -false
  2. 2 tool updates
    • First observedadd
    • First observedgetTime

TDQS

C2.8/5.0
Disambiguation5/5

The two tools have completely distinct purposes: one performs a mathematical addition operation on two numbers, while the other retrieves the current server time. There is no overlap or ambiguity between these functions, making it impossible for an agent to confuse them.

Naming Consistency2/5

The naming conventions are inconsistent: 'add' uses a simple verb form, while 'getTime' uses camelCase with a verb-object structure. This mixing of styles (no separator vs. camelCase) lacks a predictable pattern, though the names are still readable.

Tool Count2/5

With only two tools, the server feels thin and under-scoped for a general-purpose MCP server. This minimal set suggests limited functionality that might not cover basic workflows or domain needs effectively, making it borderline too few for practical use.

Completeness1/5

The tool surface is severely incomplete; it lacks any coherent domain coverage. The tools are unrelated (math and time), with no CRUD operations, lifecycle management, or logical connections, leaving significant gaps that would cause agent failures in most scenarios.

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    A basic implementation of a Model Context Protocol server that demonstrates core functionality with simple math tools (add, subtract) and greeting resources for AI assistants like Claude.
    GPL 3.0
  • A
    license
    Not graded
    quality
    D
    maintenance
    A minimal, production-ready MCP server with a simple addition calculator tool that demonstrates integration with the Model Context Protocol.
    15
    1
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    A minimal Model Context Protocol server that provides basic arithmetic tools and a comprehensive meeting analysis prompt template for processing transcripts. It serves as a clean example for developers to learn how to build, test, and integrate MCP servers with Claude Desktop.
    -

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Mtar786/mcpServer'

If you have feedback or need assistance with the MCP directory API, please join our Discord server