minimal-mcp-server
by jl681
README.md
# Minimal MCP Server
This project demonstrates how to build a Model Context Protocol (MCP) server using the TypeScript SDK. It provides a minimal implementation in `index.ts` and includes two examples showcasing its usage.
## Features
- **Minimal MCP Server**: A lightweight server implementation using the MCP TypeScript SDK.
- **Tool Support**: Includes tools for calculating the area of a rectangle and retrieving calculation history.
- **Examples**: Demonstrates how to interact with the server and use the tools.
## Prerequisites
- Node.js (v16 or higher)
- TypeScript
## Installation
1. Clone the repository:
```bash
git clone <repository-url>
```
2. Navigate to the project directory:
```bash
cd minimal-mcp-server
```
3. Install dependencies:
```bash
npm install
```
## Usage
### Build the Project
Compile the TypeScript code:
```bash
npm run build
```
### Run the Server
Start the MCP server:
```bash
node index.js
```
## Examples
### 1. Calculate Area
Send a request to calculate the area of a rectangle:
```json
{
"name": "calculate_area",
"arguments": {
"width": 5,
"height": 10
}
}
```
Response:
```json
{
"content": [{ "type": "text", "text": "Result: 50. Added to history." }]
}
```
### 2. Get Calculation History
Retrieve the history of previous calculations:
```json
{
"name": "get_calculation_history",
"arguments": {}
}
```
Response:
```json
{
"content": [{ "type": "text", "text": "History: [\"Untitled: 5x10 = 50\"]" }]
}
```
## Project Structure
- `index.ts`: Contains the minimal MCP server implementation.
- `package.json`: Project metadata and dependencies.
- `tsconfig.json`: TypeScript configuration.
## Dependencies
- `@modelcontextprotocol/sdk`: MCP TypeScript SDK for building servers.
- `@types/node`: Type definitions for Node.js.
- `typescript`: TypeScript compiler.
## License
This project is licensed under the ISC License.
## How to Use
To use this minimal MCP server, you can configure it as follows:
```json
{
"mcpServers": {
"my-minimal-server": {
"command": "node",
"args": ["/absolute/path/to/minimal-mcp-server/index.js"]
}
}
}
```
### Sample Usage


This server cannot be deployed
Maintenance
ActivityInactive
ResponsivenessNo issues