Back to MCP Catalog

Lite MCP Server

Developer ToolsTypeScript
A TypeScript framework for building Model Context Protocol servers elegantly
Available Tools

add

Add two numbers

a: numberb: number

fetch

Fetch the content of a URL

url: string

download

Download a file from a URL

url: string

LiteMCP is a lightweight, elegant TypeScript framework designed specifically for building Model Context Protocol (MCP) servers. It provides a clean, type-safe API for defining tools, resources, and prompts that can be exposed to LLM clients. With built-in features like logging, error handling, and debugging tools, LiteMCP simplifies the development process for MCP server creators. Note that as of April 2025, the project has been deprecated in favor of the official MCP TypeScript SDK, which now offers similar high-level APIs. However, the CLI commands from this project are still available as a standalone package.

Overview

LiteMCP provides a streamlined approach to building Model Context Protocol servers in TypeScript. It offers a clean API for defining tools, resources, and prompts with full TypeScript support, making it easier to create robust MCP servers.

Installation

To get started with LiteMCP, you'll need to install the package along with Zod, which is used for parameter validation:

npm install litemcp zod

Basic Usage

Here's a simple example of how to create an MCP server with LiteMCP:

import { LiteMCP } from "litemcp";
import { z } from "zod";

// Create a new server instance
const server = new LiteMCP("demo", "1.0.0");

// Add a tool
server.addTool({
  name: "add",
  description: "Add two numbers",
  parameters: z.object({
    a: z.number(),
    b: z.number(),
  }),
  execute: async (args) => {
    return args.a + args.b;
  },
});

// Add a resource
server.addResource({
  uri: "file:///logs/app.log",
  name: "Application Logs",
  mimeType: "text/plain",
  async load() {
    return {
      text: "Example log content",
    };
  },
});

// Start the server
server.start();

Core Concepts

Tools

Tools allow your server to expose executable functions that can be invoked by clients and used by LLMs to perform actions:

server.addTool({
  name: "fetch",
  description: "Fetch the content of a URL",
  parameters: z.object({
    url: z.string(),
  }),
  execute: async (args) => {
    const content = await fetchWebpageContent(args.url);
    return content;
  },
});

Resources

Resources represent data that your MCP server makes available to clients, such as file contents, images, or logs:

server.addResource({
  uri: "file:///logs/app.log",
  name: "Application Logs",
  mimeType: "text/plain",
  async load() {
    return {
      text: await readLogFile(),
    };
  },
});

For binary content, you can return a base64-encoded blob:

async load() {
  return {
    blob: 'base64-encoded-data'
  }
}

Prompts

Prompts enable servers to define reusable prompt templates and workflows:

server.addPrompt({
  name: "git-commit",
  description: "Generate a Git commit message",
  arguments: [
    {
      name: "changes",
      description: "Git diff or description of changes",
      required: true,
    },
  ],
  load: async (args) => {
    return `Generate a concise but descriptive commit message for these changes:\n\n${args.changes}`;
  },
});

Logging

LiteMCP provides a built-in logger that sends messages to the client:

server.addTool({
  name: "download",
  description: "Download a file from a URL",
  parameters: z.object({
    url: z.string(),
  }),
  execute: async (args) => {
    server.logger.info("Downloading file", { url: args.url });
    // ... download logic ...
    server.logger.info("Downloaded file", { url: args.url });
    return response;
  },
});

The logger supports different log levels: debug, info, warn, and error.

Running Your Server

Debugging with the CLI

The easiest way to test your server is with the built-in CLI:

npx litemcp dev server.js
# TypeScript files are also supported
npx litemcp dev server.ts

Using MCP Inspector

You can also use the official MCP Inspector for a web-based UI:

npx litemcp inspect server.js

SSE Transport

By default, servers run with stdio transport, but you can also use SSE:

server.start({
  transportType: "sse",
  sse: {
    endpoint: "/sse",
    port: 8080,
  },
});

This will start the server and listen for SSE connections on http://localhost:8080/sse.

Deprecation Notice

As of April 2025, LiteMCP has been deprecated since the official MCP TypeScript SDK now offers similar high-level APIs. If you like the CLI commands from LiteMCP, you can use them independently from the mcp-cli package.

Related MCPs

Apple Shortcuts
Developer ToolsJavaScript

Control Apple Shortcuts automations from AI assistants

Clojars Dependency Lookup
Developer ToolsJavaScript

Fetch dependency information from Clojars, the Clojure community's artifact repository

Simple Timeserver
Developer ToolsPython

Provides Claude with current time and timezone information

About Model Context Protocol

Model Context Protocol (MCP) allows AI models to access external tools and services, extending their capabilities beyond their training data.

Generate Cursor Documentation

Save time on coding by generating custom documentation and prompts for Cursor IDE.