Skip to main content
Glama
sumitvairagar

Simple MCP Server

Simple MCP Server

A simple Model Context Protocol (MCP) server implementation using TypeScript and the official MCP SDK.

Features

This MCP server provides:

Tools

  • echo: Echoes back the input text

  • add_numbers: Adds two numbers together

  • get_current_time: Returns the current date and time

  • get_flight_status: Get real-time flight status using flight number (supports both mock and real API data)

Resources

  • info://server: Server information and capabilities

  • greeting://hello: A simple greeting message

Related MCP server: TypeScript MCP Server Boilerplate

Installation

  1. Install dependencies:

npm install
  1. Build the project:

npm run build

Usage

Development Mode

Run the server in development mode with hot reloading:

npm run dev

Production Mode

Build and run the compiled server:

npm run build
npm start

Watch Mode

Build and watch for changes:

npm run watch

MCP Client Integration

To use this server with an MCP client, you'll need to configure the client to connect to this server. The server uses stdio transport, so it can be launched as a subprocess.

Example configuration for MCP clients:

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

Project Structure

├── examples/                   # Example implementations
│   ├── resources/
│   │   └── example-resource.ts # Example resource implementations
│   └── tools/
│       └── example-tool.ts     # Example tool implementations
├── src/                        # Source code
│   ├── handlers/
│   │   └── index.ts            # MCP request handlers
│   ├── resources/
│   │   ├── index.ts            # Resource implementations
│   │   └── registry.ts         # Resource registry
│   ├── tools/
│   │   ├── index.ts            # Tool implementations
│   │   └── registry.ts         # Tool registry
│   ├── types/
│   │   └── index.ts            # TypeScript type definitions
│   ├── utils/
│   │   └── config.ts           # Configuration and utilities
│   ├── index.ts                # Main entry point
│   └── server.ts               # Core server implementation
├── dist/                       # Compiled JavaScript (generated)
├── package.json                # Node.js dependencies and scripts
├── tsconfig.json               # TypeScript configuration
├── test.js                     # Basic test script
├── test-comprehensive.js       # Comprehensive test script
└── README.md                   # This file

Modular Architecture

The server is built with a modular architecture that makes it easy to extend:

  • Tools: Each tool is a separate class implementing the ToolHandler interface

  • Resources: Each resource is a separate class implementing the ResourceHandler interface

  • Registries: Central registries manage all tools and resources

  • Handlers: Request handlers manage MCP protocol communication

  • Types: Shared TypeScript interfaces for type safety

Development

Adding New Tools

  1. Create a new tool class implementing ToolHandler in src/tools/

  2. Add the tool to the ToolRegistry in src/tools/registry.ts

  3. See examples/tools/example-tool.ts for a complete example

Adding New Resources

  1. Create a new resource class implementing ResourceHandler in src/resources/

  2. Add the resource to the ResourceRegistry in src/resources/registry.ts

  3. See examples/resources/example-resource.ts for complete examples

Flight Status Tool

The flight status tool provides real-time flight information:

Features:

  • Real-time flight status (scheduled, active, landed, cancelled, delayed)

  • Departure and arrival airport information

  • Airline details

  • Scheduled times

  • International flight support

Usage:

# Test the flight status tool
node test-flight-status.js

API Integration: By default, the tool uses mock data. To get real flight data:

  1. Sign up for a free API key at AviationStack

  2. Set the environment variable: AVIATIONSTACK_API_KEY=your_api_key

  3. Rebuild and restart the server

Testing

Run the test scripts to verify functionality:

# Basic test
node test.js

# Comprehensive test with all features
node test-comprehensive.js

# Test flight status tool specifically
node test-flight-status.js

Git Configuration

The project includes a comprehensive .gitignore file that excludes:

  • Environment files (.env*) containing API keys

  • Compiled output (dist/)

  • Dependencies (node_modules/)

  • IDE/editor files

  • OS-specific files

  • Logs and temporary files

Important Security Note: API keys and secrets are automatically excluded from git tracking.

See GITIGNORE_INFO.md for detailed information about ignored files.

MCP Protocol

This server implements the Model Context Protocol (MCP) which allows AI assistants to securely access external tools and data sources. The server communicates via JSON-RPC over stdio.

For more information about MCP, visit: https://modelcontextprotocol.io/

Available Tools

4 tools
add_numbersB

Add two numbers together

ParametersJSON Schema
NameRequiredDescriptionDefault
aYesFirst number
bYesSecond number

TDQS

B3.1/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. It states what the tool does but doesn't disclose behavioral traits like error handling, performance characteristics, or what happens with non-numeric inputs. For a tool with zero annotation coverage, this is a significant gap.

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 that directly states the tool's function without any unnecessary words. It's appropriately sized and front-loaded, making it easy to parse.

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 (2 parameters, no output schema, no annotations), the description is adequate but minimal. It covers the basic purpose but lacks context about when to use it, behavioral details, or output expectations, leaving some gaps for the agent.

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?

Schema description coverage is 100%, with both parameters clearly documented in the schema. The description adds no additional meaning beyond what the schema provides (e.g., no details on number types, ranges, or special cases), so the baseline score of 3 is appropriate.

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 verb ('Add') and resource ('two numbers together'), making the purpose immediately understandable. It doesn't distinguish from siblings since this is a simple arithmetic operation, but the purpose is unambiguous and specific.

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. It doesn't mention any context, prerequisites, or comparison with sibling tools like 'echo' or 'get_current_time', leaving the agent to infer usage scenarios.

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

echoB

Echo back the input text

ParametersJSON Schema
NameRequiredDescriptionDefault
textYesText to echo back

TDQS

B3.1/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 for behavioral disclosure. It states the tool echoes input text, implying a simple read-only operation, but doesn't cover aspects like error handling, performance, or side effects. For a tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

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 waste—'Echo back the input text' directly conveys the core function without fluff. It's appropriately sized for a simple tool and front-loaded with essential information, making it easy for an agent to parse quickly.

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 low complexity (one parameter, no output schema, no annotations), the description is minimally adequate. It states what the tool does but lacks context on usage, behavior, or output. Without annotations or output schema, more detail would be helpful, but it's not critically incomplete for such a simple operation.

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?

Schema description coverage is 100%, with the parameter 'text' fully documented in the schema as 'Text to echo back'. The description adds no additional meaning beyond this, such as format constraints or examples. Baseline 3 is appropriate when the schema does all the heavy lifting for parameter semantics.

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 'Echo back the input text' clearly states the tool's function with a specific verb ('echo back') and resource ('input text'). It distinguishes from siblings like 'add_numbers' or 'get_current_time' by focusing on text reflection rather than computation or data retrieval. However, it doesn't explicitly differentiate from hypothetical similar tools (e.g., 'repeat_text'), so it's not a perfect 5.

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. It doesn't mention use cases, prerequisites, or comparisons with sibling tools like 'get_flight_status' for different data needs. The agent must infer usage from the purpose alone, which is insufficient for optimal tool selection.

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

get_current_timeB

Get the current date and 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 the full burden of behavioral disclosure. It describes the action ('Get') but lacks details such as timezone handling, format of the returned date/time, whether it's real-time or cached, or any rate limits. This leaves significant gaps for an agent to understand how the tool behaves.

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, clear sentence with no wasted words. It's front-loaded with the core purpose, making it highly efficient and easy to parse for an agent.

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 output schema, no annotations), the description is minimally adequate. However, it lacks details on the return format (e.g., ISO string, timestamp) and behavioral aspects like timezone, which are important for completeness even in simple tools.

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 input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description appropriately doesn't discuss parameters, and it adds value by specifying what is retrieved ('current date and time'), which aligns well with the lack of inputs.

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 ('Get') and resource ('current date and time'), making it immediately understandable. It doesn't distinguish from its sibling tool 'echo', but the purpose is unambiguous and not tautological with the name.

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 like 'echo' or other time-related tools that might exist. It states what it does but offers no context about appropriate use cases or exclusions.

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

get_flight_statusB

Get the latest status of a flight using flight number

ParametersJSON Schema
NameRequiredDescriptionDefault
flightNumberYesFlight number (e.g., "1234")
airlineIataNoOptional airline IATA code (e.g., "AA" for American Airlines)

TDQS

B3.2/5.0
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool retrieves flight status but omits critical details like whether it requires authentication, has rate limits, returns real-time or cached data, or handles errors. This leaves significant gaps in understanding how the tool behaves in practice.

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 that directly states the tool's purpose without unnecessary words. It is front-loaded with the core action and resource, making it easy to understand at a glance.

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 and output schema, the description is incomplete. It does not explain what the tool returns (e.g., status details like departure time, delays), error conditions, or operational constraints. For a tool with two parameters and no structured output, more context is needed to ensure effective use.

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 100%, with clear documentation for both parameters (flightNumber and airlineIata). The description adds minimal value beyond the schema, as it only mentions 'flight number' without elaborating on parameter usage or interactions. This meets the baseline for high schema coverage.

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

Purpose5/5

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

The description clearly states the specific action ('Get the latest status') and resource ('a flight'), using the flight number as the key identifier. It distinguishes this tool from its siblings (add_numbers, echo, get_current_time) by focusing on flight status retrieval rather than mathematical operations, text echoing, or time queries.

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, such as other flight-related tools that might exist in a broader context (though none are listed among siblings here). It lacks any mention of prerequisites, constraints, or typical use cases beyond the basic function.

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.

  1. 4 tool updatesv1.0.0
    • First observedadd_numbers
    • First observedecho
    • First observedget_current_time
    • First observedget_flight_status

TDQS

B3.3/5.0

Scored across 4 tools

Disambiguation5/5

Each tool has a clearly distinct purpose: mathematical addition, text echoing, time retrieval, and flight status checking. There is no overlap or ambiguity between these functions, making tool selection straightforward for an agent.

Naming Consistency4/5

The naming follows a consistent verb_noun pattern (e.g., add_numbers, get_current_time) with one minor deviation: 'echo' is a verb-only name without a noun, which slightly breaks the pattern but remains readable and intuitive.

Tool Count3/5

With only 4 tools, the server feels thin and lacks a cohesive domain focus, as it mixes unrelated utilities (math, text, time, flights). While the count is reasonable for a simple server, it suggests a lack of depth or clear scope.

Completeness2/5

The toolset is severely incomplete for any coherent domain; it appears as a random collection of utilities with no clear coverage. For example, if targeting travel, it lacks tools for booking or searching flights, and as a general utility server, it misses common operations like file handling or data conversion.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    A starter template for building MCP servers with TypeScript support, example tools, and automated installation scripts for Claude Desktop, Cursor, and other MCP-compatible AI assistants. Provides a foundation for creating custom tools, resource providers, and prompt templates.
    5
    -
  • F
    license
    Not graded
    quality
    D
    maintenance
    A boilerplate project for quickly developing MCP servers using TypeScript, featuring example implementations of tools (calculator, greetings) and resources (server info) with Zod schema validation.
    -
  • F
    license
    A
    quality
    D
    maintenance
    A boilerplate for building MCP servers using TypeScript, with example tools like calculator and greet, plus resource support.
    6
    -