
mrexodia/zeromcp
Developer tools이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기
mrexodia/zeromcp는 MCP 서버 후보로 수입 https://github.com/mrexodia/zeromcp.]
개요
mrexodia/zeromcp는 MCP 서버 후보로 수입 https://github.com/mrexodia/zeromcp.]
개요(AI 번역)
** 순수 파이썬의 소수 MCP 서버 구현. **
Model Context Protocol의 경량화, 손수 만든 구현은 대부분의 사용자들이 실제로 필요로 하는 것을 집중했습니다. Clean Python Type annotations를 가진 exposing 도구.
특징
- ✨ **영 종점 ** - Pure Python, 표준 라이브러리 만
- Type-safe - 모든 것을 위한 Native Python 유형 주석
- ♨ **빠른 ** - 미니멀 오버헤드, 최대 성능
- 542️Handcrafted - 인간의 1에 의해 작성, spec에 대해 확인
- HTTP/SSE 수송** - Streamable 응답
- St **Stdio 수송 ** - 레거시 고객을 위해
- ☸ **Tiny ** - 프레임 워크 의존성이없는 컴팩트 코드베이스
설치
또는 uv로:
빠른 시작
선택적 MCP instructions 필드는 서버와 그 기능을 사용해야 하는 클라이언트에게 알려줍니다. 클라이언트는 모형의 체계 신속한에 이 지시를 추가할지도 모릅니다:
그런 다음 수동 검사기를 사용하여 MCP 서버를 테스트하십시오.
일하면 mcp.json를 구성할 수 있습니다.
Stdio 수송
MCP 클라이언트를 위해 stdio 수송만 지원하십시오:
그런 다음 mcp.json] (모든 클라이언트에 대한 다른)를 구성합니다.
유형 표기
Zeromcp는 Python Annotated를 사용하여 스키마 생성 유형:
이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요.
README
원문 README의 일부입니다. 원문 보기.
zeromcp
Minimal MCP server implementation in pure Python.
A lightweight, handcrafted implementation of the Model Context Protocol focused on what most users actually need: exposing tools with clean Python type annotations.
Features
- ✨ Zero dependencies - Pure Python, standard library only
- 🎯 Type-safe - Native Python type annotations for everything
- 🚀 Fast - Minimal overhead, maximum performance
- 🛠️ Handcrafted - Written by a human1, verified against the spec
- 🌐 HTTP/SSE transport - Streamable responses
- 📡 Stdio transport - For legacy clients
- 📦 Tiny - Compact codebase with no framework dependency
Installation
pip install zeromcp
Or with uv:
uv add zeromcp
Quick Start
from typing import Annotated
from zeromcp import McpServer
mcp = McpServer("my-server")
@mcp.tool
def greet(
name: Annotated[str, "Name to greet"],
age: Annotated[int | None, "Age of person"] = None
) -> str:
"""Generate a greeting message"""
if age:
return f"Hello, {name}! You are {age} years old."
return f"Hello, {name}!"
if __name__ == "__main__":
mcp.serve("127.0.0.1", 8000)
The optional MCP instructions field tells clients how the server and its features should be used. Clients may add these instructions to the model’s system prompt:
mcp = McpServer(
"my-server",
instructions="Use the greet tool when the user asks to greet someone.",
)
Then manually test your MCP server with the inspector:
npx -y @modelcontextprotocol/inspector
Once things are working you can configure the mcp.json:
{
"mcpServers": {
"my-server": {
"type": "http",
"url": "http://127.0.0.1:8000/mcp"
}
}
}
Stdio Transport
For MCP clients that only support stdio transport:
from zeromcp import McpServer
mcp = McpServer("my-server")
@mcp.tool
def greet(name: str) -> str:
"""Generate a greeting"""
return f"Hello, {name}!"
if __name__ == "__main__":
mcp.stdio()
Then configure in mcp.json (different for every client):
{
"mcpServers": {
"my-server": {
"command": "python",
"args": ["path/to/server.py"]
}
}
}
Type Annotations
zeromcp uses native Python Annotated types for schema generation:
from typing import Annotated, Optional, TypedDict, NotRequired
class GreetingResponse(TypedDict):
message: Annotated[str, "Greeting message"]
name: Annotated[str, "Name that was greeted"]
age: Annotated[NotRequired[int], "Age if provided"]
@mcp.tool
def greet(
name: Annotated[str, "Name to greet"],
age: Annotated[Optional[int], "Age of person"] = None
) -> GreetingResponse:
"""Generate a greeting message"""
if age is not None:
return {
설치
npx -y @modelcontextprotocol/inspector설정
{
"mcpServers": {
"my-server": {
"type": "http",
"url": "http://127.0.0.1:8000/mcp"
}
}
}