mcpserver

package
v0.31.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 14, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package mcpserver provides a Model Context Protocol (MCP) server for Jira. It enables AI assistants to interact with Jira through standardized tool calls.

Index

Constants

View Source
const (
	ErrorCodeParseError     = -32700
	ErrorCodeInvalidRequest = -32600
	ErrorCodeMethodNotFound = -32601
	ErrorCodeInvalidParams  = -32602
	ErrorCodeInternalError  = -32603
)

Standard JSON-RPC error codes.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContentBlock

type ContentBlock struct {
	Type string `json:"type"`
	Text string `json:"text,omitempty"`
}

ContentBlock represents a content block in tool results.

type InitializeResult

type InitializeResult struct {
	ProtocolVersion string         `json:"protocolVersion"`
	ServerInfo      ServerInfo     `json:"serverInfo"`
	Capabilities    map[string]any `json:"capabilities"`
}

InitializeResult is returned from initialize method.

type JSONRPCError

type JSONRPCError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    any    `json:"data,omitempty"`
}

JSONRPCError represents a JSON-RPC 2.0 error.

type JSONRPCRequest

type JSONRPCRequest struct {
	JSONRPC string          `json:"jsonrpc"`
	ID      any             `json:"id"`
	Method  string          `json:"method"`
	Params  json.RawMessage `json:"params,omitempty"`
}

JSONRPCRequest represents an incoming JSON-RPC 2.0 request.

type JSONRPCResponse

type JSONRPCResponse struct {
	JSONRPC string        `json:"jsonrpc"`
	ID      any           `json:"id"`
	Result  any           `json:"result,omitempty"`
	Error   *JSONRPCError `json:"error,omitempty"`
}

JSONRPCResponse represents an outgoing JSON-RPC 2.0 response.

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server handles MCP protocol requests for Jira operations.

func NewServer

func NewServer(client *rest.Client, logger *slog.Logger) *Server

NewServer creates a new MCP server with the given Jira client.

func (*Server) CallTool

func (s *Server) CallTool(ctx context.Context, name string, args map[string]any) (any, error)

CallTool dispatches a tool call to the appropriate handler.

func (*Server) Handle

func (s *Server) Handle(ctx context.Context, req JSONRPCRequest) JSONRPCResponse

Handle processes a JSON-RPC request and returns a response.

type ServerInfo

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

ServerInfo describes the MCP server capabilities.

type Tool

type Tool struct {
	Name        string         `json:"name"`
	Description string         `json:"description"`
	InputSchema map[string]any `json:"inputSchema"`
}

Tool describes an available tool.

func GetTools

func GetTools() []Tool

GetTools returns all available Jira tools.

type ToolCallParams

type ToolCallParams struct {
	Name      string         `json:"name"`
	Arguments map[string]any `json:"arguments"`
}

ToolCallParams are the parameters for tools/call method.

type ToolCallResult

type ToolCallResult struct {
	Content []ContentBlock `json:"content"`
	IsError bool           `json:"isError,omitempty"`
}

ToolCallResult is returned from tools/call method.

type ToolsListResult

type ToolsListResult struct {
	Tools []Tool `json:"tools"`
}

ToolsListResult is returned from tools/list method.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL