Skip to main content
Glama
slawekradzyminski

Simple MCP Tool Server

シンプルなMCPツールサーバー

SSE トランスポートを使用して Web サイト取得ツールを公開するシンプルな MCP サーバー。

要件

  • Python 3.10 以上 (Python 3.13 でテスト済み)

Related MCP server: MCP Server Fetch TypeScript

インストール

# Create a virtual environment
python3 -m venv venv

# Activate the virtual environment
source venv/bin/activate

# Install the package and dependencies
pip install -r requirements.txt

MCP Python SDK ドキュメント

MCP Python SDKのドキュメントは、小さなファイルに分割され、 docs/ディレクトリに整理されています。この構造により、AIエージェントがSDKを操作し、理解しやすくなります。ドキュメントの内容は以下のとおりです。

  • コアコンセプト(サーバー、リソース、ツールなど)

  • さまざまなモードでのMCPサーバーの実行

  • 例と高度な使用法

  • さらにもっと!

使用法

このパッケージには、MCP サーバーを管理するためのいくつかのコマンドを含むコマンドライン インターフェイス (CLI) が用意されています。

サーバーの起動

デフォルト ポート (7000) でサーバーを起動するか、カスタム ポートを指定します。

# Using default port (7000)
python -m mcp_simple_tool start

# Using custom port
python -m mcp_simple_tool start --port 8000

サーバーの管理

# Check if server is running
python -m mcp_simple_tool check [--port PORT]

# Stop the server
python -m mcp_simple_tool stop [--port PORT]

# Restart the server (stop and start)
python -m mcp_simple_tool restart [--port PORT]

再起動コマンドは次の処理を実行します。

  1. 指定されたポート上の既存のサーバーを停止します

  2. バックグラウンドで新しいサーバーを起動する

  3. サーバーが応答するまで待ちます

  4. server.log へのログ出力

CLIクイックリファレンス

指示

目的

start

サーバーを起動する

stop

サーバーを停止する

check

健康チェック

restart

停止と開始

サーバーツール

サーバーは次のツールを公開します。

  • fetch :リモートHTTP フェッチャー – 絶対 URL を指定すると、ページ テキストが返されます。

    • url : 取得するウェブサイトのURL(必須)

  • search_docs : SDK ドキュメント全体のセマンティック検索。上位 k 個の抜粋を返します。

    • query : 検索フレーズまたは質問(必須)

    • k : 返される上位一致の数(オプション、デフォルト = 3)

  • get_content : search_docsによって返された一致の完全なローカル ファイルを取得します。

    • file : ドキュメントへの相対パス(必須)

開発セットアップ

開発の場合は、追加のツールをインストールします。

pip install -e .
pip install -r requirements.txt

一般的なタスクには Makefile を使用します。

# Format code
make fmt

# Run linters
make lint

# Run tests
make test

テストスイートには、特にSSEエンドポイントでのハングアップを防ぐため、すべてのテストに20秒のタイムアウトが組み込まれています。個々のテストでは、 @pytest.mark.timeout(seconds)デコレータを使用して、より厳密なタイムアウトを指定できます。

セマンティック検索インデックス

search_docs ツールでは、ベクター インデックスを手動で構築または再構築できます。

# Build or rebuild the semantic search index
python scripts/build_doc_index.py

インデックスが存在しない場合は、ツールを初めて使用したときに自動的にインデックスが構築されます。

プロジェクトアーキテクチャ

mcp_simple_tool/
    __init__.py          # Package initialization
    __main__.py          # Entry point when run as module
    cli.py               # Command-line interface
    server/              # Server implementation
        __init__.py      # Server package initialization
        app.py           # ASGI application setup
        config.py        # Configuration settings
        handlers.py      # Tool implementations
        http.py          # HTTP utilities
    semantic_search/     # Semantic search functionality
        __init__.py      # Package initialization
        indexing.py      # Build and persist vector store
        search.py        # Load index and query helpers

カーソルを使用する

このMCPサーバーは、Cursorをクライアントとして使用できます。セットアップ手順:

  1. ターミナルでサーバーを実行します。

source venv/bin/activate
python -m mcp_simple_tool start
# or use the restart command
python -m mcp_simple_tool restart
  1. .cursor/mcp.jsonファイルを作成してカーソルを構成します。

{
  "mcpServers": {
    "website-fetcher-sse": {
      "url": "http://localhost:7000/sse"
    }
  }
}
  1. カーソルを使用するときはプロンプトでサーバーを指定してください

-
security - not tested
F
license - not found
-
quality - not tested

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Latest Blog Posts

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/slawekradzyminski/mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server