HC

hkr04/cpp-mcp

Developer tools

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기

341 stars 85 forks 품질 72 트렌드 34MIT

경량 C++ MCP (모델 컨텍스트 프로토콜) SDK

개요

모델 컨텍스트 프로토콜(MCP)은 AI 모델과 에이전트가 다양한 자원, 도구 및 서비스와 상호작용할 수 있도록 표준화된 방식을 제공하는 개방형 프로토콜입니다. 이 프레임워크는 2025-03-26 기본 프로토콜 명세에 부합하여 MCP 프로토콜의 핵심 기능을 구현합니다. - : JSON-RPC 2.0 표준을 기반으로 한 요청/응답 통신 - : 파일, API 등과 같은 리소스에 대한 표준 인터페이스 - : 구조화된 매개변수로 등록 및 호출 도구 - : AI 워크플로우를 위해 프롬프트 템플릿을 등록하고 클라이언트에 노출 - : 새로운 리소스 유형과 도구로 쉽게 확장할 수 있음 - : HTTP 및 표준 입출력(stdio) 통신 방식을 지원합니다 이 저장소를 사용하는 오픈소스 프로젝트들을 소개합니다. 여러분도 이 저장소를 사용하고 계시다면, 이곳에 소개될 수 있도록 PR을 제출해 주세요! - humanus.cpp: 경량 C++ LLM 에이전트 프레임워크 - ... 여러분의 기여를 기다리고 있습니다...

개요(AI 번역)

모델 컨텍스트 프로토콜(MCP)은 AI 모델과 에이전트가 다양한 자원, 도구 및 서비스와 상호작용할 수 있도록 표준화된 방식을 제공하는 개방형 프로토콜입니다. 이 프레임워크는 2025-03-26 기본 프로토콜 명세에 부합하여 MCP 프로토콜의 핵심 기능을 구현합니다.

핵심 기능

  • JSON-RPC 2.0 통신: JSON-RPC 2.0 표준을 기반으로 한 요청/응답 통신
  • 리소스 추상화: 파일, API 등과 같은 리소스에 대한 표준 인터페이스.
  • 도구 등록: 구조화된 매개변수를 가진 도구 등록 및 호출
  • 프롬프트 템플릿: AI 워크플로우를 위해 프롬프트 템플릿을 등록하고 클라이언트에게 노출
  • 확장 가능한 아키텍처: 새로운 리소스 유형과 도구로 쉽게 확장할 수 있음
  • 다중 전송 지원: HTTP 및 표준 입출력(stdio) 통신 방식을 지원합니다

건축 방법

CMake로 빌드한 예시:

테스트와 함께 빌드하세요:

SSL 지원 빌드:

입양자들

이 저장소를 사용하는 오픈소스 프로젝트들을 소개합니다.
여러분도 사용하고 계시다면, 이곳에 소개될 수 있도록 PR을 제출해 주세요!

  • humanus.cpp: 경량 C++ LLM 에이전트 프레임워크
  • … 네 기여를 기다리고 있어…

구성 요소

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요.

README

원문 README의 일부입니다. 원문 보기.

MCP Protocol Framework

Model Context Protocol (MCP) is an open protocol that provides a standardized way for AI models and agents to interact with various resources, tools, and services. This framework implements the core functionality of the MCP protocol, conforming to the 2025-03-26 basic protocol specification.

Core Features

  • JSON-RPC 2.0 Communication: Request/response communication based on JSON-RPC 2.0 standard
  • Resource Abstraction: Standard interfaces for resources such as files, APIs, etc.
  • Tool Registration: Register and call tools with structured parameters
  • Prompt Templates: Register and expose prompt templates to clients for AI workflows
  • Extensible Architecture: Easy to extend with new resource types and tools
  • Multi-Transport Support: Supports HTTP and standard input/output (stdio) communication methods

How to Build

Example of building with CMake:

cmake -B build
cmake --build build --config Release

Build with tests:

git submodule update --init --recursive # Get GoogleTest

cmake -B build -DMCP_BUILD_TESTS=ON
cmake --build build --config Release

Build with SSL support:

git submodule update --init --recursive # Get GoogleTest

cmake -B build -DMCP_SSL=ON
cmake --build build --config Release

Adopters

Here are some open-source projects that are using this repository.
If you’re using it too, feel free to submit a PR to be featured here!

  • humanus.cpp: Lightweight C++ LLM agent framework
  • …waiting for your contribution…

Components

The MCP C++ library includes the following main components:

Core Components

Client Interface (mcp_client.h)

Defines the abstract interface for MCP clients, which all concrete client implementations inherit from.

SSE Client (mcp_sse_client.h, mcp_sse_client.cpp)

Client implementation that communicates with MCP servers using HTTP and Server-Sent Events (SSE).

Stdio Client (mcp_stdio_client.h, mcp_stdio_client.cpp)

Client implementation that communicates with MCP servers using standard input/output, capable of launching subprocesses and communicating with them.

Message Processing (mcp_message.h, mcp_message.cpp)

Handles serialization and deserialization of JSON-RPC messages.

Tool Management (mcp_tool.h, mcp_tool.cpp)

Manages and invokes MCP tools.

Resource Management (mcp_resource.h, mcp_resource.cpp)

Manages MCP resources.

Server (mcp_server.h, mcp_server.cpp)

Implements MCP server functionality.

Examples

HTTP Server Example (examples/server_example.cpp)

Example MCP server implementation over HTTP/SSE with custom tools:

  • Time tool: Get the current time
  • Calculator tool: Perform mathematical operations
  • Echo tool: Echo input with optional transformations (to uppercase, reverse)
GitHub에서 전체 README 보기

설치

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

Open the repository installation guide MCP 초보자라면? mcpskill.org 가이드부터 시작하세요 →