MCP ExplorerExplorer

Qilin

@miyamo2on a year ago
2 MIT
FreeCommunity
AI Systems
#framework#go#golang#mcp#mcp-server#model-context-protocol
Qilin MCP Framework

Overview

What is Qilin

Qilin is a Model Context Protocol (MCP) Framework designed for Go programming language, enabling developers to create context-aware applications with ease.

Use cases

Use cases for Qilin include building RESTful APIs, implementing background processing tasks, and creating interactive command-line tools that require structured input and output.

How to use

To use Qilin, simply install it via go get github.com/miyamo2/qilin, then create a new instance and start the server with qilin.New().Start(). Define your request and response structures, and implement tools to handle specific functionalities.

Key features

Key features of Qilin include zero-configuration server setup, familiar handlers inspired by popular Go web frameworks, and a straightforward API for defining tools and handling requests.

Where to use

Qilin can be used in various fields such as web development, microservices architecture, and any application requiring context-aware processing and communication between components.

Content

Qilin Logo

Qilin 🌩️🐲🌩️ – Model Context Protocol Framework for Go

Go Reference Go Version Go Report Card License MIT Status WIP Ask DeepWiki Ask DeepWiki

🌟 Highlights

   
Zero‑config server qilin.New().Start() launches an MCP server on STDIN/STDOUT
🤝 Familiar look and feel Handlers inspired by Go’s well-known web application framework. Developers familiar with them will feel right at home.
Streamable HTTP Supports Streamable HTTP transport.

🚀 Quick Start

go get github.com/miyamo2/qilin
package main

import (
	"fmt"
	"github.com/miyamo2/qilin"
	"maps"
)

type OrderBeerRequest struct {
	BeerName string `json:"beer_name" jsonschema:"title=Beer Name"`
	Quantity int    `json:"quantity"  jsonschema:"title=Quantity of Beers"`
}

type OrderBeerResponse struct {
	Amount float64 `json:"amount"`
}

var beers = map[string]string{
	"IPA":   "A hoppy beer with a bitter finish.",
	"Stout": "A dark beer with a rich, roasted flavor.",
	"Lager": "A light, crisp beer with a smooth finish.",
}

func main() {
	q := qilin.New("beer hall", qilin.WithVersion("v0.1.0"))

	q.Resource("menu_list",
		"resources://beer_list",
		func(c qilin.ResourceContext) error {
			return c.JSON(maps.Keys(beers))
		})

	q.Tool("order_beer",
		(*OrderBeerRequest)(nil),
		func(c qilin.ToolContext) error {
			var req OrderBeerRequest
			if err := c.Bind(&req); err != nil {
				return err
			}
			_, ok := beers[req.BeerName]
			if !ok {
				return fmt.Errorf("beer %s not found", req.BeerName)
			}
			amount := 8 * req.Quantity // Assume unit cost of all beers is $8.00.
			return c.JSON(OrderBeerResponse{Amount: float64(amount)})
		})
	q.Start() // listen on stdio
}

For more detailed usage, please refer to the Qilin User Guide.

🛤 Roadmap

Transports

  • [x] Stdio
  • [x] Streamable HTTP

Features

  • [x] Tool
    • [X] Listing
    • [X] Calling
      • [X] Middleware
  • [x] Resource
    • [X] Listing
    • [X] Reading
      • [X] Middleware
    • [X] Templates
    • [X] List Changed Notification
    • [X] Subscriptions
  • [ ] Prompt

📜 License

Qilin released under the MIT License

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers