mcp-tool-server
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.

mcp-tool-server
A Model Context Protocol (MCP) server written from scratch in pure Python — no SDK — so the protocol itself stays readable end to end.
MCP is how AI clients (Claude Desktop, Cursor, agent frameworks) discover and call external tools through one standard handshake. Most people meet it through an SDK; this project implements the protocol directly — JSON-RPC 2.0 over stdio, one message per line — in about 150 lines, with four working tools: a calculator, a word counter, and a small notes store (add + search). Read it once and you understand what every MCP SDK is doing on your behalf.
What it does
Implements the core MCP lifecycle:
initializehandshake,tools/list,tools/call,pingExposes tools with JSON Schemas; validates required arguments before running them
Returns tool failures as tool results (
isError), never as protocol crashesLogs to stderr only — anything else on stdout would corrupt the JSON-RPC stream
Related MCP server: mini-mcp-demo
Demo
$ printf '%s\n' \
'{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}' \
'{"jsonrpc":"2.0","method":"notifications/initialized"}' \
'{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"calculator","arguments":{"expression":"12 * (3 + 4)"}}}' \
| python main.py
{"jsonrpc": "2.0", "id": 1, "result": {"protocolVersion": "2024-11-05", "capabilities": {"tools": {}}, "serverInfo": {"name": "mcp-tool-server", "version": "0.1.0"}}}
{"jsonrpc": "2.0", "id": 2, "result": {"content": [{"type": "text", "text": "84"}], "isError": false}}To use it from a real client, point the client's MCP config at
python /path/to/main.py — the tools appear in the client like any other
MCP server.
Architecture
flowchart LR
A[MCP client<br/>IDE / agent / desktop app] -->|JSON-RPC on stdio| B[protocol.py<br/>handshake + routing]
B --> C[tools.py<br/>calculator · word_count<br/>note_add · note_search]
C --> D[(notes.json)]Quick start
git clone https://github.com/Butterfly-ai-studios/mcp-tool-server.git
cd mcp-tool-server
python -m unittest discover -s tests # protocol + tools, 8 tests
python main.py # serve on stdio (waits for a client)Configuration
Variable | Default | Purpose |
|
| Where the notes tools persist data |
How this maps to a production system
MCP is becoming the standard tool surface for agents, and the production version of this server differs in transport and tools, not in shape:
Transports — streamable HTTP with auth, instead of local stdio
Real tools — database queries, SaaS APIs, internal services, each with its own permission scope
The same discipline — schemas up front, argument validation, tool errors returned as results the model can react to
My tool-calling-agent project shows the other side of the wire: an agent
consuming tools with exactly this contract.
Project structure
server/
protocol.py JSON-RPC routing: initialize, tools/list, tools/call, ping
tools.py the four tools + their schemas
main.py stdio entry point
tests/ handshake, tool-call, error and stream testsLicense
MIT — see LICENSE.
Built by Masud Hossen — AI product builder (VOOQIO, Foundqio). Part of a 10-project AI engineering portfolio.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Pay-per-call tools for AI agents, paid in USDC on Base or Solana. Web search, page and PDF reading, crypto news, Hyperliquid perps, market pulse, Chainlink price history, token checks, SEC filings, weather and more. Free calls every day, and a failed call costs nothing. Works with Tollkit Wallet.
Machine-native tools for autonomous agents with free routing and x402 USDC pay-per-call.
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
214 tools for AI agents over one MCP endpoint: image, video, audio, 3D, data, storage, mail, GPUs.
Related MCP Servers
- AlicenseAqualityCmaintenanceExposes a verified tool registry (calculator, sandboxed file read, web fetch) over MCP stdio, enabling any MCP-capable client to reuse the same tools from the inspectable ReAct loop.3MIT
- AlicenseNot gradedqualityDmaintenanceEnables local tool calling over Model Context Protocol via stdio, providing deterministic tools such as calc.add, text.word_count, and text.summarize_naive after JSON-RPC handshake and discovery.MIT
- FlicenseAqualityDmaintenanceEnables an LLM client to perform basic arithmetic on two numbers — addition, subtraction, multiplication, and division — plus reverse a supplied text string, through five simple tools exposed over stdio. Inputs and structured text results follow JSON schemas, with invalid operations such as division by zero surfaced as tool errors.5-
- AlicenseBqualityCmaintenanceEnables LLM agents and clients to discover and invoke tools — echo, add, sqrt, and now_utc — over a newline-delimited JSON-RPC 2.0 stdio transport, with protocol handshakes, tool schemas, and in-band tool errors handled per the Model Context Protocol spec. It also includes a demo client for driving the server.4MIT