loading…
Search for a command to run...
loading…
A proof-of-concept MCP server that enables reading local files and performing basic arithmetic operations. It provides a simple foundation for understanding how
A proof-of-concept MCP server that enables reading local files and performing basic arithmetic operations. It provides a simple foundation for understanding how tools are exposed to MCP clients.
A simple Model Context Protocol (MCP) server that exposes tools for:
This project is intended as a proof of concept (POC) to understand how MCP servers work and how tools are exposed to clients.
node -v npm -v
---
## Installation
1. Clone or copy this repository
2. Open a terminal in the project directory
3. Install dependencies:
```bash
npm install
Start the MCP server using standard I/O (stdio):
node server.js
The server will start and wait for JSON-RPC messages on stdin/stdout.
The easiest way to test the server is using the MCP Inspector tool.
$env:DANGEROUSLY_OMIT_AUTH="true"
npx mcp-inspector node server.js
DANGEROUSLY_OMIT_AUTH=true npx mcp-inspector node server.js
After running, open your browser to http://localhost:6274 to interact with the tools.
The server exposes two tools:
read_fileReads the content of a local text file.
Arguments:
path (string): The relative or absolute path to the file.Example usage:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "read_file",
"arguments": {
"path": "notes.txt"
}
}
}
calculatorPerforms basic arithmetic operations.
Arguments:
a (number): First operandb (number): Second operandoperation (string): One of add, subtract, multiply, divideExample usage:
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "calculator",
"arguments": {
"a": 10,
"b": 5,
"operation": "add"
}
}
}
You can also test the server by sending raw JSON-RPC messages to the running server process.
Example: Read notes.txt
# Start server
node server.js
# In another terminal, send JSON-RPC request
echo '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"read_file","arguments":{"path":"notes.txt"}}}' | node server.js
mcp-poc/
├── server.js # Main MCP server entry point
├── package.json # Project dependencies
└── README.md # This file
Добавь это в claude_desktop_config.json и перезапусти Claude Desktop.
{
"mcpServers": {
"simple-mcp-poc": {
"command": "npx",
"args": []
}
}
}