MCP Sample Server

MCP Sample Server

A simple Model Context Protocol server providing basic utility tools including timezone-aware time retrieval and basic arithmetic calculations (add, subtract, multiply, divide).

Category
Visit Server

README

MCP Sample Server

シンプルなModel Context Protocol (MCP)サーバーのサンプル実装です。

関連プロジェクト

  • MCPクライアント: このサーバーと対話するための自然言語クライアント
    • OpenAI APIを使用して自然言語でMCPツールを実行
    • GitHubリポジトリ: yukinaka/mcp-client
    • ローカルパス: ../mcp-client/

機能

このMCPサーバーは以下の機能を提供します:

ツール

  1. get_current_time - 現在の時刻を取得

    • パラメータ: timezone (オプション) - タイムゾーン(例: Asia/Tokyo, UTC)
  2. calculate - 簡単な計算を実行

    • パラメータ:
      • operation - 演算の種類(add, subtract, multiply, divide)
      • a - 最初の数値
      • b - 2番目の数値

リソース

  • サンプルノートへのアクセス(note:///welcome, note:///example

インストール

前提条件

  • Node.js (v18以上)
  • npm または yarn

ローカル開発

# リポジトリをクローン
git clone https://github.com/yukinaka/mcp-sample-server.git
cd mcp-sample-server

# 依存関係をインストール
npm install

# ビルド
npm run build

npmパッケージとしてインストール(公開後)

npm install -g @odenalexbs/mcp-sample-server

使い方

MCPクライアントで使用する(推奨)

このサーバーには、OpenAI APIを使用した自然言語クライアントが付属しています。

cd ../mcp-client
npm install
npm start

詳細はmcp-client/README.mdを参照してください。

Claude Codeで使用する

.claude/settings.local.json に以下の設定を追加します:

開発版(ローカル)を使用する場合

{
  "mcpServers": {
    "sample": {
      "command": "node",
      "args": ["/path/to/mcp-sample-server/dist/index.js"]
    }
  }
}

GitHubから直接使用する場合

{
  "mcpServers": {
    "sample": {
      "command": "npx",
      "args": ["-y", "github:yukinaka/mcp-sample-server"]
    }
  }
}

npmパッケージとして使用する場合(公開後)

{
  "mcpServers": {
    "sample": {
      "command": "npx",
      "args": ["-y", "@odenalexbs/mcp-sample-server"]
    }
  }
}

他のMCPクライアントで使用する

Claude Desktop等の他のMCPクライアントでも同様に設定できます。クライアントの設定ファイルに上記のような設定を追加してください。

開発

ウォッチモード

npm run watch

テスト実行

# サーバーを直接実行してテスト
npm run build
npm start

GitHub公開手順

  1. GitHubで新しいリポジトリを作成
  2. ローカルでGitリポジトリを初期化:
git init
git add .
git commit -m "Initial commit: MCP sample server"
git branch -M main
git remote add origin https://github.com/yukinaka/mcp-sample-server.git
git push -u origin main
  1. (オプション)npmに公開:
npm login
npm publish

カスタマイズ

このサンプルをベースに、独自のツールやリソースを追加できます:

  • src/index.tstools 配列に新しいツールを追加
  • CallToolRequestSchema ハンドラーに実装を追加
  • リソースを追加する場合は resources 関連のハンドラーを修正

ライセンス

MIT

参考リンク

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured