mini-mcp-demo
mini-mcp
MCP(Model Context Protocol)를 기본 원리부터 약 200줄의 읽기 쉬운 코드로 구현했습니다. 서버, 클라이언트, 그리고 그 사이의 JSON-RPC 메커니즘 — 모든 에이전트 통합이 의존하는 도구 호출의 핵심, 한 번에 읽을 수 있을 만큼 작습니다.
git clone https://github.com/harshadkhetpal/mini-mcp
cd mini-mcp
PYTHONPATH=src python3 -m minimcp.clientconnected: mini-mcp-demo protocol 2025-06-18
tools discovered: calc.add, text.word_count, text.summarize_naive
calc.add(2, 40) -> 42
word_count -> 6SDK가 있는데 왜 만들까
프레임워크는 프로토콜을 숨기고, 숨겨진 프로토콜은 통합을 연결할 수는 있지만 디버깅할 수 없는 엔지니어를 만듭니다. 핵심을 구현하면 SDK가 실제로 하는 일을 배울 수 있습니다. MCP는 전송 계층 위의 JSON-RPC 2.0이며, 여기에 중요한 세 가지 메서드가 더해집니다 — initialize(핸드셰이크와 기능 협상), tools/list(JSON-Schema 설명이 포함된 카탈로그), tools/call(검증된 호출). 이것을 이해하고 나면 모든 MCP SDK는 편의 래퍼로 읽히는데, 실제로 그렇습니다.
Related MCP server: mcp-anvil-lite
구현된 것
항목 | 상세 |
서버 | 데코레이터를 통한 도구 등록, JSON-RPC 디스패치, 올바른 오류 코드(-32700 파싱 오류, -32600 잘못된 요청, -32601 메서드 없음, -32602 잘못된 매개변수, -32603 내부 오류) |
스키마 검증 | 최소한의 JSON-Schema 하위 집합(type, required, properties), 직접 작성하지 않고 가져오지 않음 |
클라이언트 | 모든 stdio MCP 서버를 실행, 핸드셰이크, 발견, 호출 |
데모 서버 | 결정적 도구 세 개, 오프라인에서도 루프가 돌도록 |
범위는 의도적입니다: 리소스, 프롬프트, 샘플링, 알림은 제외합니다. 도구 하위 집합은 에이전트가 의존하는 부분이며, 완전한 작은 것이 불완전한 큰 것보다 낫습니다.
논쟁할 만한 설계 결정
전송-독립적 서버. handle_line은 하나의 요청 문자열을 하나의 응답 문자열로 매핑합니다. 같은 서버가 stdio, 소켓, 또는 직접 호출하는 단위 테스트에서도 동작합니다 — 그래서 프로토콜 테스트는 서브프로세스가 필요 없고 절대 실패하지 않습니다.
알 수 없는 도구 인자는 무시되지 않고 거부됩니다. 선언하지 않은 매개변수를 받는 도구는 프로덕션으로 가는 버그입니다. 여기서의 엄격함이 에이전트 도구 호출을 디버깅 가능하게 만듭니다.
도구 예외는 크래시가 아니라 프로토콜 오류가 됩니다. 버그가 있는 도구가 서버나 세션을 죽여서는 안 됩니다. 클라이언트는 메시지와 함께 -32603을 받고, 루프는 계속됩니다.
bool은 integer가 아닙니다. Python의 bool은 int의 하위 클래스이므로, 단순한 검증기는 True를 개수가 필요한 곳에 허용합니다. 이 구현은 그렇지 않으며, 테스트가 이를 고정합니다.
테스트
PYTHONPATH=src python3 -m pytest tests -q핸드셰이크, 발견, 유효한 호출과 유효하지 않은 호출, 모든 JSON-RPC 오류 코드를 다루며, 실제 클라이언트를 실제 서버에 서브프로세스로 실행하는 엔드투엔드 테스트 하나가 포함됩니다.
라이선스
MIT
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
- FlicenseNot gradedqualityDmaintenanceA minimal Model Context Protocol server that provides basic utility tools including mathematical operations, text processing, hashing, and JSON validation. Implements JSON-RPC stdio transport for local testing and development.
- FlicenseAqualityCmaintenanceA minimal starting point for a Model Context Protocol server with stdio transport and one tool, enabling quick setup and custom tool addition.1
- AlicenseAqualityCmaintenanceMinimal typed scaffold for a local Model Context Protocol stdio server, providing echo and server_status tools.2MIT
- AlicenseAqualityCmaintenanceExposes a verified tool registry (calculator, sandboxed file read, web fetch) over MCP stdio, enabling any MCP-capable client to reuse the same tools from the inspectable ReAct loop.3MIT
Related MCP Connectors
AI Reasoning Cache & Consensus Layer with 11 MCP tools via Streamable HTTP.
x402-paid agent tools: 18 over HTTP, 14 over stdio. USDC per call, no API key.
A Model Context Protocol server for Wix AI tools
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/harshadkhetpal/mini-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server