mcp-reference-implementation
A working realization of the Model Context Protocol (MCP) server designed to interface diverse Large Language Model (LLM) clients with external utilities, data stores, and structured inputs to augment AI capabilities.
Author

antonioscapellato
Quick Info
Actions
Tags
Reference Implementation for the Model Context Protocol (MCP) Server
This repository furnishes a concrete, operational instance of an MCP server, primarily intended for pedagogical application. The included codebase illustrates the methodology for constructing a fully functional MCP backend capable of interoperating with a variety of LLM frontend systems.
MCP Server Exemplar
This repository contains an implementation of a Model Context Protocol (MCP) server for educational purposes. This code demonstrates how to build a functional MCP server that can integrate with various LLM clients.
References: - Model Context Protocol - Anthropic. - MCP - Python.
What is MCP?
MCP (Model Context Protocol) is an open protocol that standardizes how applications provide context to LLMs. Think of MCP like a USB-C port for AI applications - it provides a standardized way to connect AI models to different data sources and tools.
Key Benefits
- A growing list of pre-built integrations that your LLM can directly plug into
- Flexibility to switch between LLM providers and vendors
- Best practices for securing your data within your infrastructure
Architecture Overview
MCP follows a client-server architecture where a host application can connect to multiple servers:
- MCP Hosts: Programs like Claude Desktop, IDEs, or AI tools that want to access data through MCP
- MCP Clients: Protocol clients that maintain 1:1 connections with servers
- MCP Servers: Lightweight programs that expose specific capabilities through the standardized Model Context Protocol
- Data Sources: Both local (files, databases) and remote services (APIs) that MCP servers can access
Core MCP Concepts
MCP servers can provide three main types of capabilities:
- Resources: File-like data that can be read by clients (like API responses or file contents)
- Tools: Functions that can be called by the LLM (with user approval)
- Prompts: Pre-written templates that help users accomplish specific tasks
System Requirements
- Python 3.10 or higher
- MCP SDK 1.2.0 or higher
uvpackage manager
Installation
Adding MCP to your python project We recommend using uv to manage your Python projects.
If you haven't created a uv-managed project yet, create one:
uv init mcp-server-sample cd mcp-server-sample
Then add MCP to your project dependencies:
console uv add "mcp[cli]"
Alternatively, for projects using pip for dependencies:
console pip install "mcp[cli]"
Running the standalone MCP development tools To run the mcp command with uv:
console uv run mcp
Quickstart
Let's create a simple MCP server that exposes a calculator tool and some data:
python
server.py
from mcp.server.fastmcp import FastMCP
Create an MCP server
mcp = FastMCP("Demo")
Add an addition tool
@mcp.tool() def add(a: int, b: int) -> int: """Add two numbers""" return a + b
Add a dynamic greeting resource
@mcp.resource("greeting://{name}") def get_greeting(name: str) -> str: """Get a personalized greeting""" return f"Hello, {name}!"
You can install this server in Claude Desktop and interact with it right away by running:
console mcp install server.py
Alternatively, you can test it with the MCP Inspector:
console mcp dev server.py
Made with ❤️ by Antonio Scapellato
Resources:
License
This project is licensed under the MIT License. See the LICENSE file for details.
WIKIPEDIA: XMLHttpRequest (XHR) is an API in the form of a JavaScript object whose methods transmit HTTP requests from a web browser to a web server. The methods allow a browser-based application to send requests to the server after page loading is complete, and receive information back. XMLHttpRequest is a component of Ajax programming. Prior to Ajax, hyperlinks and form submissions were the primary mechanisms for interacting with the server, often replacing the current page with another one.
== History == The concept behind XMLHttpRequest was conceived in 2000 by the developers of Microsoft Outlook. The concept was then implemented within the Internet Explorer 5 browser (1999). However, the original syntax did not use the XMLHttpRequest identifier. Instead, the developers used the identifiers ActiveXObject("Msxml2.XMLHTTP") and ActiveXObject("Microsoft.XMLHTTP"). As of Internet Explorer 7 (2006), all browsers support the XMLHttpRequest identifier. The XMLHttpRequest identifier is now the de facto standard in all the major browsers, including Mozilla's Gecko layout engine (2002), Safari 1.2 (2004) and Opera 8.0 (2005).
=== Standards === The World Wide Web Consortium (W3C) published a Working Draft specification for the XMLHttpRequest object on April 5, 2006. On February 25, 2008, the W3C published the Working Draft Level 2 specification. Level 2 added methods to monitor event progress, allow cross-site requests, and handle byte streams. At the end of 2011, the Level 2 specification was absorbed into the original specification. At the end of 2012, the WHATWG took over development and maintains a living document using Web IDL.
== Usage == Generally, sending a request with XMLHttpRequest has several programming steps.
Create an XMLHttpRequest object by calling a constructor: Call the "open" method to specify the request type, identify the relevant resource, and select synchronous or asynchronous operation: For an asynchronous request, set a listener that will be notified when the request's state changes: Initiate the request by calling the "send" method: Respond to state changes in the event listener. If the server sends response data, by default it is captured in the "responseText" property. When the object stops processing the response, it changes to state 4, the "done" state. Aside from these general steps, XMLHttpRequest has many options to control how the request is sent and how the response is processed. Custom header fields can be added to the request to indicate how the server should fulfill it, and data can be uploaded to the server by providing it in the "send" call. The response can be parsed from the JSON format into a readily usable JavaScript object, or processed gradually as it arrives rather than waiting for the entire text. The request can be aborted prematurely or set to fail if not completed in a specified amount of time.
== Cross-domain requests ==
In the early development of the World Wide Web, it was found possible to brea
