Simple MCP Tool Server

Integrations

  • Provides a website fetching tool using the MCP Python SDK, allowing AI agents to retrieve and process web content using a simple 'fetch' tool with a URL parameter.

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

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

要件

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

インストール

# 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

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

SSE トランスポート経由で Web サイト取得ツールを提供し、ユーザーが指定された URL からコンテンツを取得できるようにするサーバー。

  1. 要件
    1. インストール
      1. MCP Python SDK ドキュメント
        1. 使用法
          1. サーバーの起動
          2. サーバーの管理
          3. CLIクイックリファレンス
        2. サーバーツール
          1. 開発セットアップ
            1. セマンティック検索インデックス
          2. プロジェクトアーキテクチャ
            1. カーソルを使用する

              Related MCP Servers

              • A
                security
                A
                license
                A
                quality
                An advanced web browsing server enabling headless browser interactions via a secure API, providing features like navigation, content extraction, element interaction, and screenshot capture.
                Last updated -
                6
                9
                Python
                MIT License
              • A
                security
                A
                license
                A
                quality
                This server facilitates interaction with cosense/Scrapbox projects, enabling users to retrieve, list, search, and create pages while supporting various query operations and secure access to private projects.
                Last updated -
                4
                12
                TypeScript
                MIT License
                • Apple
              • A
                security
                A
                license
                A
                quality
                This server enables users to download entire websites and their assets for offline access, supporting configurable depth and concurrency settings.
                Last updated -
                1
                4
                Python
                MIT License
              • A
                security
                A
                license
                A
                quality
                A simple MCP server that facilitates website fetching through a configurable server platform using stdio or SSE transport, allowing integration with tools like Cursor for streamlined access.
                Last updated -
                2
                23
                Python
                MIT License

              View all related MCP servers

              ID: o8qqorghaa