CURL_TO_CONTEXT
This educational demo teaches the Model Context Protocol (MCP) - a protocol for AI assistants to interact with external tools and data sources.
claude mcp add --transport stdio mehdibukhari-curl_to_context node mcp-server/dist/index.js \ --env PORT="5001"
How to use
This MCP server implements a basic educational example that exposes a set of mathematical tools (add, subtract, multiply, divide) via the MCP JSON-RPC 2.0 protocol. It can be accessed locally either through a stdio-based client (running alongside the server in the same environment) or through an HTTP-based client, allowing you to discover available tools and call them with specific arguments. The repository includes a stdio client and an HTTP client to demonstrate both transport methods, along with example requests showing how to list tools and perform calculations. When you list tools, you’ll see the four math operations, and when you call a tool you’ll receive a structured JSON-RPC response containing the result or an error if something went wrong. This setup is ideal for learning how MCP requests are formed and how error handling propagates through the system.
How to install
Prerequisites:
- Node.js 18+ installed on your system
Step 1: Clone the repository or download the project contents.
Step 2: Install dependencies for the MCP server and clients:
# From the repository root
cd CURL_TO_CONTEXT
# Install and build the MCP server
cd mcp-server
npm install
npm run build
# Optional: install and build clients to experiment locally
cd ../mcp-client-stdio
npm install
npm run build
cd ../mcp-client-remote
npm install
npm run build
Step 3: Start the server (stdio mode) and/or HTTP mode as described in the Quick Start section of the README. For HTTP mode, ensure Node environment supports the configured port (default 5001).
Step 4: Use the provided clients or curl commands to interact with the server.
Additional notes
Tips and common considerations:
- The server demonstrates two transport methods: stdio (local) and HTTP (remote). Start the HTTP server with npm run start:http from the mcp-server directory and use the HTTP client to connect.
- The JSON-RPC 2.0 format is used for all requests. Tools can be listed with the tools/list method and individual tools can be executed with tools/call, providing the tool name and arguments.
- If you adjust the port, remember to update the MCP client configuration or environment variables accordingly (PORT for the server; MCP_SERVER_URL for the client when using HTTP).
- Common issues include not building before starting, port conflicts, or mismatched URLs. The README includes troubleshooting tips for these scenarios.
- This is an educational/demo server intended for learning MCP concepts; in production, you would likely deploy a robust server with proper authentication, input validation, and error handling enhancements.
Related MCP Servers
mcp-for-beginners
This open-source curriculum introduces the fundamentals of Model Context Protocol (MCP) through real-world, cross-language examples in .NET, Java, TypeScript, JavaScript, Rust and Python. Designed for developers, it focuses on practical techniques for building modular, scalable, and secure AI workflows from session setup to service orchestration.
openai -agent-dotnet
Sample to create an AI Agent using OpenAI models with any MCP server running on Azure Container Apps
unity-editor
An MCP server and client for LLMs to interact with Unity Projects
create -kit
Scaffold a production-ready Model Context Protocol (MCP) server in seconds.
MCP_Integration_Package-NPM
A lightweight, production-ready Model Context Protocol (MCP) server for exposing Node.js functions to Claude Desktop and other AI agents via JSON-RPC 2.0 over STDIO.
mcpplay
The FastAPI /docs experience, for MCP servers.