mcp-leftpad
v1.0.0
Published
An MCP server that exposes left-pad as a tool
Downloads
26
Readme
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 padlength
(number, required): The target length of the padded stringpadStr
(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