MCP Server Sample
MCP-Serverbeispiel
Dieses Repository enthält die Implementierung eines Model Context Protocol (MCP)-Servers für Bildungszwecke. Dieser Code demonstriert den Aufbau eines funktionsfähigen MCP-Servers, der sich in verschiedene LLM-Clients integrieren lässt.

MCP-Server-Beispiel
Dieses Repository enthält die Implementierung eines Model Context Protocol (MCP)-Servers für Bildungszwecke. Dieser Code demonstriert den Aufbau eines funktionsfähigen MCP-Servers, der sich in verschiedene LLM-Clients integrieren lässt.
Quellen:
Was ist MCP?
MCP (Model Context Protocol) ist ein offenes Protokoll, das die Bereitstellung von Kontext für LLMs durch Anwendungen standardisiert. Stellen Sie sich MCP wie einen USB-C-Anschluss für KI-Anwendungen vor – es bietet eine standardisierte Möglichkeit, KI-Modelle mit verschiedenen Datenquellen und Tools zu verbinden.
Hauptvorteile
Eine wachsende Liste vorgefertigter Integrationen, in die Ihr LLM direkt eingebunden werden kann
Flexibilität beim Wechsel zwischen LLM-Anbietern und -Anbietern
Best Practices zum Sichern Ihrer Daten innerhalb Ihrer Infrastruktur
Related MCP server: MCP Server Example
Architekturübersicht
MCP folgt einer Client-Server-Architektur, bei der eine Hostanwendung eine Verbindung zu mehreren Servern herstellen kann:
MCP-Hosts : Programme wie Claude Desktop, IDEs oder KI-Tools, die über MCP auf Daten zugreifen möchten
MCP-Clients : Protokoll-Clients, die 1:1-Verbindungen mit Servern aufrechterhalten
MCP-Server : Leichtgewichtige Programme, die über das standardisierte Model Context Protocol spezifische Funktionen bereitstellen
Datenquellen : Sowohl lokale (Dateien, Datenbanken) als auch Remote-Dienste (APIs), auf die MCP-Server zugreifen können
Kernkonzepte von MCP
MCP-Server können drei Haupttypen von Funktionen bereitstellen:
Ressourcen : Dateiähnliche Daten, die von Clients gelesen werden können (wie API-Antworten oder Dateiinhalte)
Tools : Funktionen, die vom LLM aufgerufen werden können (mit Benutzerfreigabe)
Eingabeaufforderungen : Vorgefertigte Vorlagen, die Benutzern helfen, bestimmte Aufgaben zu erledigen
Systemanforderungen
Python 3.10 oder höher
MCP SDK 1.2.0 oder höher
uv-Paketmanager
Installation
Hinzufügen von MCP zu Ihrem Python-Projekt. Wir empfehlen die Verwendung von UV zur Verwaltung Ihrer Python-Projekte.
Wenn Sie noch kein UV-verwaltetes Projekt erstellt haben, erstellen Sie eines:
uv init mcp-server-sample
cd mcp-server-sampleFügen Sie dann MCP zu Ihren Projektabhängigkeiten hinzu:
uv add "mcp[cli]Alternativ für Projekte, die pip für Abhängigkeiten verwenden:
pip install "mcp[cli]"Ausführen der eigenständigen MCP-Entwicklungstools. So führen Sie den MCP-Befehl mit UV aus:
uv run mcpSchnellstart
Lassen Sie uns einen einfachen MCP-Server erstellen, der ein Taschenrechner-Tool und einige Daten bereitstellt:
# 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}!"Sie können diesen Server in Claude Desktop installieren und sofort mit ihm interagieren, indem Sie Folgendes ausführen:
mcp install server.pyAlternativ können Sie es mit dem MCP Inspector testen:
mcp dev server.pyMit ❤️ erstellt von Antonio Scapellato
Ressourcen:
Lizenz
Dieses Projekt ist unter der MIT-Lizenz lizenziert. Weitere Informationen finden Sie in der Datei LICENSE .
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
1 tool update
v0.1.0- First observed
add
TDQS
With only one tool, there is no possibility of confusion or overlap between tools. The tool 'add' has a clear and distinct purpose of adding two numbers, so disambiguation is perfect.
With a single tool, naming consistency is inherently perfect as there are no other tools to compare against. The tool name 'add' follows a simple verb pattern, which is appropriate for its function.
A single tool is too few for most server purposes, as it limits functionality and scope. While it might be appropriate for a trivial demo, it feels thin and incomplete for any meaningful domain coverage.
The server is severely incomplete, as it only offers a basic arithmetic operation. There are obvious gaps, such as missing other mathematical operations or any broader domain coverage, which will cause agent failures in most scenarios.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
An MCP server that provides an API to LLMs to manage their JumpCloud resources.
Model Context Protocol server for the Apideck Unified API. Connect any MCP-compatible agent framework to 100+ accounting systems, HRIS platforms, file storage providers, and more through one integration. More information https://www.apideck.com/mcp-server
A Model Context Protocol server for Wix AI tools
Related MCP Servers
- AlicenseNot gradedqualityFmaintenanceA minimal server/client application implementation utilizing the Model Context Protocol (MCP) and Azure OpenAI.34MIT
- AlicenseBqualityDmaintenanceAn educational implementation of a Model Context Protocol server that demonstrates how to build a functional MCP server for integrating with various LLM clients like Claude Desktop.1163MIT
- FlicenseDqualityDmaintenanceA ready-to-use starter implementation of the Model Context Protocol (MCP) server that enables applications to provide standardized context for LLMs with sample resources, tools, and prompts.281-
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol (MCP) server that supports STDIO, SSE and Streamable HTTP protocols for AI model interactions.71MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/antonscap/mcp-server-sample'
If you have feedback or need assistance with the MCP directory API, please join our Discord server