Cover image
Try Now
2025-04-06

3 years

Works with Finder

1

Github Watches

0

Github Forks

0

Github Stars

MCP Server Sample

このプロジェクトは、Model Context Protocol (MCP) に準拠したサーバーの基本実装です。MCPは、モデルとローカルで実行されているMCPサーバー間の通信を可能にするプロトコルです。

機能

  • 標準入出力を介したJSONメッセージの処理
  • MCPプロトコルに準拠した基本的な型定義
  • エラーハンドリング機能

プロジェクト構造

.
├── main.go              # メインサーバーの実装
├── go.mod              # Goモジュール定義
└── server/
    └── types.go        # MCPプロトコルの型定義

主要コンポーネント

ServerInfo (main.go)

サーバーの基本情報を管理する構造体です。

type ServerInfo struct {
    Name    string `json:"name"`
    Version string `json:"version"`
}

Server (main.go)

MCPサーバーの基本機能を提供する構造体です。

type Server struct {
    info         ServerInfo
    capabilities map[string]interface{}
}

MCP メッセージ型 (server/types.go)

  • Request: クライアントからのリクエストを表現
  • Response: サーバーからのレスポンスを表現
  • Error: エラー情報を表現

セットアップ

  1. リポジトリのクローン:
git clone <repository-url>
cd mcp-server-sample
  1. 依存関係のインストール:
go mod tidy
  1. サーバーの実行:
go run main.go

拡張

このサーバーは以下の機能を追加することで拡張できます:

  1. ツールの実装

    • 特定の機能を提供するツールの追加
    • ツールのパラメータとレスポンスの定義
  2. リソースの実装

    • 静的/動的リソースの追加
    • リソーステンプレートの定義
  3. メッセージハンドラー

    • 特定のメソッドに対するハンドラーの実装
    • カスタムエラーハンドリング

生成AI

このドキュメントは生成AIの支援を受けて作成されています。

ライセンス

このプロジェクトはMITライセンスの下で公開されています。

相关推荐

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • lumpenspace
  • Take an adjectivised noun, and create images making it progressively more adjective!

  • Lists Tailwind CSS classes in monospaced font

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • tomoyoshi hirata
  • Sony α7IIIマニュアルアシスタント

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • Carlos Ferrin
  • Encuentra películas y series en plataformas de streaming.

  • https://zenepic.net
  • Embark on a thrilling diplomatic quest across a galaxy on the brink of war. Navigate complex politics and alien cultures to forge peace and avert catastrophe in this immersive interstellar adventure.

  • apappascs
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • jae-jae
  • MCP服务器使用剧作《无头浏览器》获取网页内容。

  • ravitemer
  • 一个功能强大的Neovim插件,用于管理MCP(模型上下文协议)服务器

  • patruff
  • Ollama和MCP服务器之间的桥梁,使本地LLMS可以使用模型上下文协议工具

  • JackKuo666
  • 🔍使AI助手可以通过简单的MCP接口搜索和访问PYPI软件包信息。

  • pontusab
  • 光标与风浪冲浪社区,查找规则和MCP

  • av
  • 毫不费力地使用一个命令运行LLM后端,API,前端和服务。

    Reviews

    5 (1)
    Avatar
    user_4WlJpIGZ
    2025-04-17

    I recently used the mcp-server-sample by tossyyukky and I must say it's a well-crafted application. The repository on GitHub provides a great starting point for building robust server applications. The code is clean and easy to understand, making it perfect for both beginners and experienced developers. Highly recommended for anyone looking to explore MCP applications!