1.0.0 • Published 4 months ago

mcp-leftpad v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
4 months ago

mcp-leftpad

An MCP server that exposes a left-pad tool using the Model Context Protocol.

Installation

npm install -g mcp-leftpad

Usage

Start the MCP server:

mcp-leftpad

The server exposes the following tool:

left-pad

Pads the start of a string to a specified length with a specified string.

Parameters:

  • str (string, required): The string to pad
  • length (number, required): The target length of the padded string
  • padStr (string, optional, default: ' '): The string to pad with

Example:

{
  "name": "left-pad",
  "arguments": {
    "str": "hello",
    "length": 10,
    "padStr": "-"
  }
}

This will return:

{
  "content": [
    {
      "type": "text",
      "text": "-----hello"
    }
  ]
}

Development

# Clone the repository
git clone https://github.com/yourusername/mcp-leftpad.git
cd mcp-leftpad

# Install dependencies
npm install

# Start the server locally
npm start

Implementation

This MCP server is built using the @modelcontextprotocol/sdk library and uses:

  • The McpServer class for creating a compliant MCP server
  • The StdioServerTransport for communicating over standard input/output
  • Zod schemas for parameter validation

License

MIT

1.0.0

4 months ago