Skip to main content
Glama

MCP Base

by jsmiff

MCP Base - 汎用モデルコンテキストプロトコルフレームワーク

このフォルダには、AIを活用したアプリケーションを構築するためのモデルコンテキストプロトコル(MCP)の汎用的な基本実装が含まれています。これにより、LLMをアプリケーションに統合するために使用できるMCPサーバーとクライアントを標準化された方法で作成できます。

📋 機能

  • 標準化されたMCPサーバーおよびstdioトランスポートをサポートする基本サーバー実装
  • 汎用MCPクライアント:任意のMCPサーバーに接続するためのクライアント
  • Ollama 統合: Ollama で埋め込みとテキストを生成するためのすぐに使えるサービス
  • Supabase 統合: Supabase ベクター データベースの組み込みサポート
  • モジュラー設計: リソース、ツール、プロンプトを明確に整理した構造
  • サンプルテンプレート: すぐに開始できるようにするための実装例

🛠️ ディレクトリ構造

_mcp-base/ ├── server.ts # Main MCP server implementation ├── client.ts # Generic MCP client ├── utils/ # Utility services │ ├── ollama_embedding.ts # Embedding generation with Ollama │ └── ollama_text_generation.ts # Text generation with Ollama ├── tools/ # Tool implementations │ └── sample-tool.ts # Example tool template ├── resources/ # Resource implementations │ └── sample-resource.ts # Example resource template ├── prompts/ # Prompt implementations │ └── sample-prompt.ts # Example prompt template └── README.md # This documentation

🚀 はじめに

前提条件

  • Node.js と npm/pnpm
  • ローカル埋め込みとテキスト生成のための Ollama
  • ベクターストレージ用のSupabaseアカウント

環境設定

次の変数を含む.envファイルを作成します。

PORT=3000 SUPABASE_URL=https://your-project.supabase.co SUPABASE_SERVICE_KEY=your-service-key OLLAMA_URL=http://localhost:11434 OLLAMA_EMBED_MODEL=nomic-embed-text OLLAMA_LLM_MODEL=llama3 SERVER_MODE=http # 'http' or 'stdio'

サーバーの初期化

  1. 必要なモジュールをインポートする
  2. リソース、ツール、プロンプトを登録する
  3. サーバーを起動する
// Import base server and utilities import server from "./server"; import { registerSampleResources } from "./resources/sample-resource"; import { registerSampleTool } from "./tools/sample-tool"; import { registerSamplePrompts } from "./prompts/sample-prompt"; // Initialize database if needed async function initializeDatabase() { // Your database initialization logic } // Register your components registerSampleResources(server, supabase); registerSampleTool(server, textGenerator, embeddings, supabase); registerSamplePrompts(server, supabase); // Start the server startServer();

クライアントの使用状況

import MCPClient from "./client"; // Create a client instance const client = new MCPClient({ serverUrl: "http://localhost:3000", }); // Example: Call a tool async function callSampleTool() { const result = await client.callTool("sample-tool", { query: "example query", maxResults: 5, }); console.log(result); } // Example: Read a resource async function readResource() { const items = await client.readResource("items://all"); console.log(items); } // Example: Get a prompt async function getPrompt() { const prompt = await client.getPrompt("simple-prompt", { task: "Explain quantum computing", }); console.log(prompt); } // Don't forget to disconnect when done await client.disconnect();

📚 フレームワークの拡張

新しいツールの作成

  1. tools/ディレクトリに新しいファイルを作成する
  2. Zodを使用してツールの機能とスキーマを定義する
  3. ツールロジックを実装する
  4. ツールをサーバーに登録する

新しいリソースの作成

  1. resources/ディレクトリに新しいファイルを作成する
  2. リソースのエンドポイントとスキーマを定義する
  3. リソースロジックを実装する
  4. サーバーにリソースを登録する

新しいプロンプトの作成

  1. prompts/ディレクトリに新しいファイルを作成する
  2. プロンプトのスキーマとパラメータを定義する
  3. プロンプトテンプレートを実装する
  4. サーバーにプロンプトを登録する

📄 ライセンス

マサチューセッツ工科大学

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

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

AI を活用したアプリケーションを構築するための汎用モデル コンテキスト プロトコル フレームワーク。Ollama および Supabase をサポートする LLM を統合するための MCP サーバーおよびクライアントを作成するための標準化された方法を提供します。

  1. 📋 機能
    1. 🛠️ ディレクトリ構造
      1. 🚀 はじめに
        1. 前提条件
        2. 環境設定
        3. サーバーの初期化
        4. クライアントの使用状況
      2. 📚 フレームワークの拡張
        1. 新しいツールの作成
        2. 新しいリソースの作成
        3. 新しいプロンプトの作成
      3. 📄 ライセンス

        Related MCP Servers

        • -
          security
          F
          license
          -
          quality
          A Model Context Protocol server implementation that enables connection between OpenAI APIs and MCP clients for coding assistance with features like CLI interaction, web API integration, and tool-based architecture.
          Last updated -
          33
          Python
          • Linux
          • Apple
        • A
          security
          F
          license
          A
          quality
          Implements the Model Context Protocol (MCP) to provide AI models with a standardized interface for connecting to external data sources and tools like file systems, databases, or APIs.
          Last updated -
          1
          125
          Python
          • Apple
          • Linux
        • -
          security
          A
          license
          -
          quality
          A Model Context Protocol (MCP) server that implements AI-First Development framework principles, allowing LLMs to interact with context-first documentation tools and workflows for preserving knowledge and intent alongside code.
          Last updated -
          332
          Python
          AGPL 3.0
        • -
          security
          A
          license
          -
          quality
          A high-performance Model Context Protocol (MCP) server designed for large language models, enabling real-time communication between AI models and applications with support for session management and intelligent tool registration.
          Last updated -
          2
          Python
          MIT License

        View all related MCP servers

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

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