DM

dpella/mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

34 stars 13 forks 质量 62 趋势 16MPL-2.0

Haskell 模型上下文协议(MCP)的完整实现,分为两个包:

概览

Haskell 模型上下文协议(MCP)的完整实现,分为两个包: - — 纯协议类型,依赖最小(aeson、base、container、text)- — 基于仆的HTTP服务器,采用JWT认证 该仓库提供了Haskell中模型上下文协议的类型安全实现。MCP是一个开放协议,标准化应用程序如何向大型语言模型(LLMs)提供上下文,使AI模型能够安全地连接到数据源和工具。

概述(AI 翻译)

Haskell 模型上下文协议(MCP)的完整实现,分为两个包:

  • mcp-types — 纯协议类型,依赖最小(aeson、base、containers、text)
  • mcp — 基于仆人且带有JWT认证的HTTP服务器

概述

该仓库提供了Haskell中模型上下文协议的类型安全实现。MCP是一个开放协议,标准化应用程序如何向大型语言模型(LLMs)提供上下文,使AI模型能够安全地连接到数据源和工具。

特色

  • 最新协议支持:实现MCP协议版本2025-06-18
  • 完整的MCP协议实现:所有MCP消息类型、请求、响应和通知
  • 类型安全设计:通过Aeson实现全Haskell类型系统集成,实现自动JSON序列化
  • HTTP 传输:基于仆人的 HTTP 服务器,具有流式 SSE 响应
  • JWT 认证:通过 servant-auth-server 进行安全认证
  • 可扩展服务器接口:用于实现自定义MCP服务器的可配置处理框架
  • 工具框架:用于定义带有输入验证和结构化结果的工具的辅助功能

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

MCP — Model Context Protocol for Haskell

A complete implementation of the Model Context Protocol (MCP) for Haskell, split into two packages:

  • mcp-types — Pure protocol types with minimal dependencies (aeson, base, containers, text)
  • mcp — Servant-based HTTP server with JWT authentication

Overview

This repository provides a type-safe implementation of the Model Context Protocol in Haskell. MCP is an open protocol that standardizes how applications provide context to Large Language Models (LLMs), enabling AI models to securely connect to data sources and tools.

Features

  • Latest Protocol Support: Implements MCP protocol version 2025-06-18
  • Complete MCP Protocol Implementation: All MCP message types, requests, responses, and notifications
  • Type-Safe Design: Full Haskell type system integration with automatic JSON serialization via Aeson
  • HTTP Transport: Servant-based HTTP server with streaming SSE responses
  • JWT Authentication: Secure authentication via servant-auth-server
  • Extensible Server Interface: Configurable handler framework for implementing custom MCP servers
  • Tool Framework: Helper functions for defining tools with input validation and structured results

Architecture

The implementation is organized into two packages:

mcp-types

Core protocol types with minimal dependencies — suitable for building clients or alternative server implementations.

  • MCP.Types: Core MCP data types (Content, Resource, Tool, Prompt, Capability, etc.)
  • MCP.Protocol: JSON-RPC 2.0 message wrappers, all client/server request/response types, notification types
  • MCP.Aeson: Custom Aeson parsing options

mcp

Servant-based server implementation. Re-exports MCP.Protocol and MCP.Types for convenience.

  • MCP.Server: Core server infrastructure with MCPServerT monad transformer, ProcessHandlers record, ToolHandler framework, JWT-authenticated Servant API, server state management and request routing

For OAuth 2.0 authorization in MCP clients, see oauth2-server.

MCP Protocol Support

Operation Description Status
initialize Start session and negotiate capabilities Supported
ping Health check Supported
resources/list List available resources Supported
resources/templates/list List available resource templates Supported
resources/read Read resource contents Supported
resources/subscribe Subscribe to resource updates Supported
resources/unsubscribe Unsubscribe from resource updates Supported
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →