Model Context Protocol (MCP) Server
모델 컨텍스트 프로토콜(MCP) Python 구현
이 프로젝트는 Anthropic MCP 사양에 따라 Python으로 작동하는 모델 컨텍스트 프로토콜(MCP) 서버와 클라이언트를 구현합니다. 간단한 대화형 예제를 통해 MCP 프로토콜의 주요 패턴을 보여줍니다.
MCP란 무엇인가요?
모델 컨텍스트 프로토콜(MCP)은 JSON-RPC 2.0 기반으로 구축된 개방형 표준으로, AI 모델을 외부 데이터 소스 및 도구에 연결하기 위한 것입니다. AI 애플리케이션이 하나 이상의 MCP 서버와 통신하는 클라이언트-서버 아키텍처를 정의하며, 각 서버는 다음과 같은 기능을 제공합니다.
도구 : 작업을 수행하는 실행 가능한 함수
리소스 : 정보를 제공하는 데이터 소스
프롬프트 : 미리 정의된 템플릿 또는 워크플로
MCP는 이러한 기능이 발견되고 호출되는 방식을 표준화하여 모델이 구조화된 방식으로 외부 시스템과 상호 작용할 수 있도록 하는 "AI용 USB-C" 역할을 합니다.
Related MCP server: simple_mcp
프로젝트 구조
server/: MCP 서버 구현server.py: MCP 요청을 처리하고 샘플 도구/리소스를 제공하는 WebSocket 서버
client/: MCP 클라이언트 구현client.py: 서버에 연결하고 모든 MCP 기능을 실행하는 데모 클라이언트
시연된 기능
이 구현은 핵심 MCP 프로토콜 흐름을 보여줍니다.
기능 협상 :
initialize통한 클라이언트-서버 핸드셰이크역량 발견 : 사용 가능한 도구 및 리소스 나열
도구 호출 : 매개변수를 사용하여
add_numbers도구 호출리소스 액세스 : 리소스에서 텍스트 콘텐츠 읽기
설정
가상 환경 만들기:
지엑스피1
종속성 설치:
pip install -r requirements.txt
용법
MCP 서버를 시작합니다(한 터미널에서):
python server/server.py(다른 터미널에서) MCP 클라이언트를 실행합니다.
python client/client.py
클라이언트는 서버에 연결하고, MCP 핸드셰이크를 수행하고, 기능을 검색하고, 도구를 호출하고, 포맷된 출력을 통해 리소스에 액세스하는 방법을 보여줍니다.
작동 원리
MCP 서버
서버:
WebSocket 연결을 허용합니다
MCP 사양에 따라 JSON-RPC 요청에 응답합니다.
샘플 도구(
add_numbers)를 제공합니다.샘플 리소스(
example.txt)를 제공합니다.MCP 핸드셰이크 및 기능 검색을 지원합니다.
MCP 클라이언트
고객:
WebSocket을 통해 서버에 연결합니다
MCP 핸드셰이크를 수행합니다.
사용 가능한 도구와 리소스를 발견합니다
도구 호출 및 리소스 읽기를 보여줍니다.
결과를 형식화된 디스플레이로 표시합니다.
프로토콜 세부 정보
MCP는 다음과 같은 주요 방법을 구현합니다.
방법 | 설명 |
| 역량 확립을 위한 핸드셰이크 |
| 사용 가능한 도구 나열 |
| 인수를 사용하여 도구 호출 |
| 사용 가능한 리소스 나열 |
| 리소스 콘텐츠 읽기 |
| 사용 가능한 프롬프트 나열 |
프로젝트 확장
다음을 통해 이 구현을 확장할 수 있습니다.
다양한 기능을 갖춘 도구 추가
읽을 때마다 변경되는 동적 리소스 추가
가이드 상호작용을 위한 프롬프트 템플릿 구현
더욱 상호 작용적인 클라이언트 애플리케이션 만들기
참고문헌
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-quality-maintenanceAn MCP server implementation that standardizes how AI applications access tools and context, providing a central hub that manages tool discovery, execution, and context management with a simplified configuration system.13
- Flicense-qualityDmaintenanceAn educational MCP server that teaches implementing the Model Context Protocol from scratch, enabling AI models to discover and invoke tools via JSON-RPC over stdio.
- Flicense-qualityDmaintenanceA basic MCP server implementation using Node.js and TypeScript that bridges AI models with external tools and data sources via JSON-RPC.2
- Flicense-qualityBmaintenanceA demo MCP server that connects an AI to external systems by exposing Python functions as tools and data as resources, using the stdio transport.
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
MCP server exposing the Backtest360 engine API as tools for AI agents.
MCP server for Clipkit — gives AI agents a video toolbox via the Clipkit schema.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/suspicious-cow/MCP2'
If you have feedback or need assistance with the MCP directory API, please join our Discord server