Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions README.ko.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ MCP 서버를 만들고, 원클릭 배포. 시크릿 불필요.
```bash
npx @starter-series/create my-mcp-server --template mcp-server-python
cd my-mcp-server
python -m venv .venv && source .venv/bin/activate
python3.12 -m venv .venv && source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -e '.[dev]'
python -m pytest
```
Expand All @@ -48,7 +49,8 @@ python -m pytest
```bash
git clone https://github.com/starter-series/python-mcp-server-starter my-mcp-server
cd my-mcp-server
python -m venv .venv && source .venv/bin/activate
python3.12 -m venv .venv && source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -e '.[dev]'
python -m pytest
```
Expand Down Expand Up @@ -153,11 +155,17 @@ python -m mypy src/
# wheel + sdist 빌드
python -m build

# 실제 python -m 엔트리포인트 stdio smoke
python scripts/smoke_stdio.py

# 서버 실행 (stdio)
python -m my_mcp_server

# 설치된 console script로 동일 서버 실행
my-mcp-server

# 의존성 audit
pip-audit . --strict
```

## CI/CD
Expand Down Expand Up @@ -213,13 +221,15 @@ tests/

```bash
python -m pip install -e ".[dev]" # dev 의존성 포함 설치
python scripts/smoke_stdio.py # MCP 클라이언트로 python -m my_mcp_server 실행
python -m my_mcp_server # 서버 실행
my-mcp-server # 설치된 console script로 서버 실행
python -m pytest -v # 테스트 실행
python -m ruff check . # 린트
python -m ruff format . # 포맷
python -m mypy src/ # 타입 확인
python -m build # wheel + sdist 빌드
pip-audit . --strict # 의존성 audit
```

## 라이선스
Expand Down
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ Build your MCP server. One-click publish. Zero secrets needed.
```bash
npx @starter-series/create my-mcp-server --template mcp-server-python
cd my-mcp-server
python -m venv .venv && source .venv/bin/activate
python3.12 -m venv .venv && source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -e '.[dev]'
python -m pytest
```
Expand All @@ -51,7 +52,8 @@ python -m pytest
```bash
git clone https://github.com/starter-series/python-mcp-server-starter my-mcp-server
cd my-mcp-server
python -m venv .venv && source .venv/bin/activate
python3.12 -m venv .venv && source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -e '.[dev]'
python -m pytest
```
Expand Down Expand Up @@ -173,11 +175,17 @@ python -m mypy src/
# Build wheel + sdist
python -m build

# Stdio smoke against the actual python -m entrypoint
python scripts/smoke_stdio.py

# Run the server (stdio)
python -m my_mcp_server

# Same server via installed console script
my-mcp-server

# Dependency audit
pip-audit . --strict
```

## CI/CD
Expand Down Expand Up @@ -233,13 +241,15 @@ tests/

```bash
python -m pip install -e ".[dev]" # Install with dev deps
python scripts/smoke_stdio.py # Start python -m my_mcp_server through an MCP client
python -m my_mcp_server # Run server
my-mcp-server # Run installed console script
python -m pytest -v # Run tests
python -m ruff check . # Lint
python -m ruff format . # Format
python -m mypy src/ # Type check
python -m build # Build wheel + sdist
pip-audit . --strict # Dependency audit
```

## License
Expand Down
62 changes: 62 additions & 0 deletions scripts/smoke_stdio.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
"""Stdio smoke test for the packaged MCP entrypoint."""

from __future__ import annotations

import asyncio
import os
import sys
from collections.abc import Sequence

from mcp import ClientSession, StdioServerParameters
from mcp.client.stdio import stdio_client


def check(condition: bool, message: str) -> None:
if not condition:
raise RuntimeError(message)


async def run_stdio_smoke(
command: str = sys.executable,
args: Sequence[str] = ("-m", "my_mcp_server"),
) -> None:
params = StdioServerParameters(
command=command,
args=list(args),
env={**os.environ, "MCP_DEBUG": "false"},
)

async with (
stdio_client(params) as (read_stream, write_stream),
ClientSession(read_stream, write_stream) as session,
):
await session.initialize()

tools = await session.list_tools()
tool_names = {tool.name for tool in tools.tools}
check("greet" in tool_names, f"greet tool missing from {sorted(tool_names)}")

result = await session.call_tool("greet", {"name": "Smoke"})
check(not bool(result.isError), "greet tool returned an MCP error")
check(bool(result.content), "greet tool returned no content")
first = result.content[0]
check(first.type == "text", f"unexpected content type: {first.type}")
check(first.text == "Hello, Smoke!", f"unexpected greeting text: {first.text}")

resources = await session.list_resources()
resource_uris = {str(resource.uri) for resource in resources.resources}
check("info://server/status" in resource_uris, "server-info resource missing")

prompts = await session.list_prompts()
prompt_names = {prompt.name for prompt in prompts.prompts}
check("code-review" in prompt_names, "code-review prompt missing")


def main() -> int:
asyncio.run(run_stdio_smoke())
print("stdio smoke passed.")
return 0


if __name__ == "__main__":
raise SystemExit(main())
12 changes: 12 additions & 0 deletions tests/test_stdio_smoke.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from __future__ import annotations

import sys

import pytest

from scripts.smoke_stdio import run_stdio_smoke


@pytest.mark.asyncio
async def test_python_module_entrypoint_speaks_stdio_mcp() -> None:
await run_stdio_smoke(sys.executable, ("-m", "my_mcp_server"))
Loading