MCP Server Sample
MCP サーバー サンプル
このリポジトリには、教育目的のモデルコンテキストプロトコル(MCP)サーバーの実装が含まれています。このコードは、様々なLLMクライアントと統合できる機能的なMCPサーバーの構築方法を示しています。

MCP サーバーの例
このリポジトリには、教育目的のモデルコンテキストプロトコル(MCP)サーバーの実装が含まれています。このコードは、様々なLLMクライアントと統合できる機能的なMCPサーバーの構築方法を示しています。
参考文献:
MCPとは何ですか?
MCP(モデル・コンテキスト・プロトコル)は、アプリケーションがLLMにコンテキストを提供する方法を標準化するオープンプロトコルです。MCPはAIアプリケーション用のUSB-Cポートのようなもので、AIモデルをさまざまなデータソースやツールに接続するための標準化された方法を提供します。
主なメリット
LLMに直接接続できる、構築済みの統合のリストが増えています
LLMプロバイダーとベンダーを切り替える柔軟性
インフラストラクチャ内でデータを保護するためのベストプラクティス
Related MCP server: MCP Server Example
アーキテクチャの概要
MCP は、ホスト アプリケーションが複数のサーバーに接続できるクライアント サーバー アーキテクチャに従います。
MCPホスト: Claude Desktop、IDE、またはMCPを介してデータにアクセスするAIツールなどのプログラム
MCPクライアント: サーバーとの1:1接続を維持するプロトコルクライアント
MCP サーバー: 標準化されたモデル コンテキスト プロトコルを通じて特定の機能を公開する軽量プログラム
データ ソース: MCP サーバーがアクセスできるローカル (ファイル、データベース) とリモート サービス (API) の両方
MCPコアコンセプト
MCP サーバーは、主に次の 3 種類の機能を提供できます。
リソース: クライアントが読み取ることができるファイルのようなデータ (API レスポンスやファイルの内容など)
ツール: LLM から呼び出せる関数 (ユーザーの承認が必要)
プロンプト: ユーザーが特定のタスクを達成するのに役立つ、事前に作成されたテンプレート
システム要件
Python 3.10以上
MCP SDK 1.2.0以上
uvパッケージマネージャー
インストール
Python プロジェクトに MCP を追加する Python プロジェクトを管理するには、uv を使用することをお勧めします。
UV 管理プロジェクトをまだ作成していない場合は、作成します。
uv init mcp-server-sample
cd mcp-server-sample次に、プロジェクトの依存関係に MCP を追加します。
uv add "mcp[cli]あるいは、依存関係に pip を使用するプロジェクトの場合:
pip install "mcp[cli]"スタンドアロン MCP 開発ツールの実行 uv で mcp コマンドを実行するには:
uv run mcpクイックスタート
計算ツールといくつかのデータを公開するシンプルな MCP サーバーを作成しましょう。
# 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}!"次のコマンドを実行すると、このサーバーを Claude Desktop にインストールしてすぐに操作することができます。
mcp install server.pyあるいは、MCP Inspector を使用してテストすることもできます。
mcp dev server.pyアントニオ・スカペラートが❤️を込めて作りました
リソース:
ライセンス
このプロジェクトはMITライセンスの下で提供されています。詳細は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