Spiral MCP Server
スパイラルMCPサーバー
これは、Pythonを使用したSpiral APIのモデルコンテキストプロトコル(MCP)サーバー実装です。Spiralの言語モデルと対話するための標準化されたインターフェースを提供します。
インストール
mcp install src/server.py --name "spiral-writing-tool" --with pydantic --with requests --with beautifulsoup4 --with httpxRelated MCP server: MCP Server Example
設定
仮想環境を作成してアクティブ化します。
python3 -m venv venv
source venv/bin/activate # On Windows, use `venv\Scripts\activate`依存関係をインストールします:
uv pip install -r requirements.txtルート ディレクトリに
.envファイルを作成し、Spiral API キーを追加します。
SPIRAL_API_KEY=your_api_key_hereAPIキーはhttps://app.spiral.computer/apiから取得できます。
サーバーの実行
サーバーを起動します。
python src/server.pyサーバーはデフォルトでポート3000で動作します。PORT環境変数PORT設定することでこれを変更できます。
ツールのテスト
MCP ツールを直接テストするには:
python src/test_tools.pyこれにより、利用可能なすべてのツールのテストが実行され、その機能が検証されます。
MCPツール
サーバーは 4 つの強力な MCP ツールを実装します。
リストモデル
利用可能なすべてのスパイラル モデルとその機能およびメタデータを一覧表示します。
応答例:
{
"models": [
{
"id": "model-id",
"name": "model-name",
"description": "Model description",
"input_format": "text",
"output_format": "text",
"capabilities": {
"completion": true
}
}
]
}生成する
指定されたスパイラル モデルを使用してテキストを生成します。
パラメータ:
model: 使用するスパイラルモデルのIDまたはスラッグprompt: 生成する入力テキスト
例:
{
"model": "model_id_or_slug",
"prompt": "Your input text here"
}ファイルから生成
ファイルからの入力に基づき、スパイラルモデルを用いてテキストを生成します。これは、大規模なドキュメントの処理や、一貫した書式設定の維持に役立ちます。
パラメータ:
model: 使用するスパイラルモデルのIDまたはスラッグfile_path: 入力として使用するファイルへのパス
例:
{
"model": "model_id_or_slug",
"file_path": "path/to/your/input.txt"
}生成元URL
URLからの入力に基づき、スパイラルモデルを用いてテキストを生成します。このツールは、Webページから記事のコンテンツを自動的に抽出できます。
パラメータ:
model: 使用するスパイラルモデルのIDまたはスラッグurl: コンテンツを取得するURLextract_article: 記事の内容を抽出するか、完全な HTML を使用するか (デフォルト: true)
例:
{
"model": "model_id_or_slug",
"url": "https://example.com/article",
"extract_article": true
}エラー処理
サーバーは、次のようなさまざまなエラーケースを処理します。
無効なAPIキー
モデルが見つかりません
入力が長すぎます
レート制限を超えました
URL 取得の失敗
ファイル読み取りエラー
サーバーエラー
リクエストタイムアウト
各エラーは、問題の診断に役立つ明確なエラー メッセージを返します。
環境変数
SPIRAL_API_KEY: Spiral APIキー(必須)PORT: サーバーポート(オプション、デフォルトは3000)TIMEOUT: リクエストのタイムアウト(秒)(オプション、デフォルトは30)
特徴
堅牢なエラー処理: すべての操作に対する包括的なエラー処理とログ記録
記事抽出: Webページから記事のコンテンツをスマートに抽出します
柔軟な入力ソース: テキスト、ファイル、URLを入力としてサポート
非同期操作: パフォーマンス向上のため、すべての操作は非同期です。
型安全性: すべてのパラメータに対して完全なPydantic型検証を実施
ログ記録: トラブルシューティングのための詳細なデバッグログ
This server cannot be deployed
Maintenance
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
A Model Context Protocol server for Wix AI tools
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
Model Context Protocol server for Studex tools, notifications, and profile integrations
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceThis server implements the Model Context Protocol to facilitate meaningful interaction and understanding development between humans and AI through structured tools and progressive interaction patterns.57-
- 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.1162MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server implementation that provides a standardized interface for applications to interact with OpenRouter's language models through a unified conversation management system.6 npm2MIT
- AlicenseAqualityDmaintenanceA Model Context Protocol server that connects to Google AI Studio/Gemini API, enabling content generation with support for various file types, conversation history, and system prompts.1113 npm39MIT
Appeared in Searches
- Information about SSE (possible meanings: Scottish and Southern Energy, Server-Sent Events, etc.)
- Understanding and Techniques for Summarizing Information
- Automating document interaction, download, and conversion for AI-driven answers
- Retrieve Website Titles Based on Given URLs
- A server for finding language exercises