Skip to main content
Glama

Simple MCP

A simple TypeScript library for creating MCP (Model Context Protocol) servers.

Features

  • Simple API: Create MCP servers with minimal code

  • Type Safety: Full TypeScript integration

  • Parameter Validation: Built-in validation with Zod

  • MCP Compatible: Fully implements the Model Context Protocol

Related MCP server: toolcall

Installation

npm install simple-mcp

Quickstart

import { McpServer } from 'simple-mcp';
import { z } from 'zod';

// Create a server instance
const server = new McpServer({ name: 'my-server' });

// Register the tool with the server
server.tool({
  name: 'greet',
  parameters: {
    name: z.string().describe('Person\'s name')
  },
  execute: async ({ name }) => {
    return {
      content: [
        {
          type: 'text',
          text: `Hello, ${name}! Nice to meet you.`
        }
      ]
    };
  }
});

// Start the server
server.start({ transportType: 'stdio' });

Class-based Implementation

You can also implement MCP tools using classes:

import { McpServer, type McpTool } from 'simple-mcp';
import { z, ZodObject } from 'zod';

const parameters = {
  name: z.string().describe('The name is required'),
};

class GreetTool implements McpTool<typeof parameters> {
  public readonly name = 'greet';
  public readonly parameters = parameters;

  public async execute({ name }: z.infer<ZodObject<typeof this.parameters>>) {
    return {
      content: [
        {
          type: 'text',
          text: `Hello, ${name}! Nice to meet you.`,
        },
      ],
    };
  }
}

// Initialize a new MCP server with the name 'greet-server'
const server = new McpServer({ name: 'greet-server' });

// Create an instance of the GreetTool class
const greetTool = new GreetTool();

// Register the tool with the server
server.tool(greetTool);

// Start the server using stdio as the transport method
server.start({ transportType: 'stdio' });

Examples

Check out the examples directory for more complete examples:

Contributing

Contributions are welcome! Feel free to open issues or submit pull requests.

License

MIT

Available Tools

1 tool
greetD

Inputs: name (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    D1.5/5.0

    Scored across 1 tool

    Disambiguation5/5

    With only one tool in the server, there is no possibility of overlap or confusion between tools. The agent does not need to distinguish competing operations.

    Naming Consistency4/5

    The single tool name 'greet' uses a clear lowercase verb with no conflicting naming style. However, one tool is too few to establish a meaningful naming pattern across a server.

    Tool Count1/5

    A server named MCPKit containing only one trivial tool is severely underprovisioned. This tool count earns no place in a coherent server surface.

    Completeness1/5

    The only tool, 'greet', provides a trivial single action with no description and no supporting operations. The server surface is severely incomplete for any plausible broader purpose.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      A lightweight SDK for building Model Context Protocol (MCP) servers with zero-config setup, automatic TypeScript type inference, and Zod runtime validation.
      8 npm
      3
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables creating MCP (Model Context Protocol) servers with zero boilerplate, full TypeScript support, and multiple transports (stdio and HTTP).
      4 npm
      1
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables developers to create and serve Model Context Protocol servers in TypeScript by declaratively defining tools, resources, resource templates, prompts, and roots with minimal boilerplate. It provides an Express-like API or experimental decorators, with optional context access for logging and progress reporting.
      38 npm
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables developers to create Model Context Protocol servers in TypeScript with minimal boilerplate through an Express-like API or experimental decorators. It supports defining tools, prompts, resources, resource templates, and roots, with type safety and MCP capabilities like logging and progress reporting.
      38 npm
      MIT