mirror of
https://github.com/aljazceru/mcp-python-sdk.git
synced 2025-12-19 06:54:18 +01:00
Include server examples folder in pyright check (#667)
This commit is contained in:
@@ -4,4 +4,4 @@ import sys
|
||||
|
||||
from mcp_simple_auth.server import main
|
||||
|
||||
sys.exit(main())
|
||||
sys.exit(main()) # type: ignore[call-arg]
|
||||
|
||||
@@ -2,4 +2,4 @@ import sys
|
||||
|
||||
from .server import main
|
||||
|
||||
sys.exit(main())
|
||||
sys.exit(main()) # type: ignore[call-arg]
|
||||
|
||||
@@ -2,4 +2,4 @@ import sys
|
||||
|
||||
from .server import main
|
||||
|
||||
sys.exit(main())
|
||||
sys.exit(main()) # type: ignore[call-arg]
|
||||
|
||||
@@ -2,7 +2,7 @@ import anyio
|
||||
import click
|
||||
import mcp.types as types
|
||||
from mcp.server.lowlevel import Server
|
||||
from pydantic import FileUrl
|
||||
from pydantic import AnyUrl
|
||||
|
||||
SAMPLE_RESOURCES = {
|
||||
"greeting": "Hello! This is a sample text resource.",
|
||||
@@ -26,7 +26,7 @@ def main(port: int, transport: str) -> int:
|
||||
async def list_resources() -> list[types.Resource]:
|
||||
return [
|
||||
types.Resource(
|
||||
uri=FileUrl(f"file:///{name}.txt"),
|
||||
uri=AnyUrl(f"file:///{name}.txt"),
|
||||
name=name,
|
||||
description=f"A sample text resource named {name}",
|
||||
mimeType="text/plain",
|
||||
@@ -35,7 +35,9 @@ def main(port: int, transport: str) -> int:
|
||||
]
|
||||
|
||||
@app.read_resource()
|
||||
async def read_resource(uri: FileUrl) -> str | bytes:
|
||||
async def read_resource(uri: AnyUrl) -> str | bytes:
|
||||
if uri.path is None:
|
||||
raise ValueError(f"Invalid resource path: {uri}")
|
||||
name = uri.path.replace(".txt", "").lstrip("/")
|
||||
|
||||
if name not in SAMPLE_RESOURCES:
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
from .server import main
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
# Click will handle CLI arguments
|
||||
import sys
|
||||
|
||||
sys.exit(main()) # type: ignore[call-arg]
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from .server import main
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
main() # type: ignore[call-arg]
|
||||
|
||||
@@ -2,4 +2,4 @@ import sys
|
||||
|
||||
from .server import main
|
||||
|
||||
sys.exit(main())
|
||||
sys.exit(main()) # type: ignore[call-arg]
|
||||
|
||||
@@ -85,7 +85,7 @@ Issues = "https://github.com/modelcontextprotocol/python-sdk/issues"
|
||||
packages = ["src/mcp"]
|
||||
|
||||
[tool.pyright]
|
||||
include = ["src/mcp", "tests"]
|
||||
include = ["src/mcp", "tests", "examples/servers"]
|
||||
venvPath = "."
|
||||
venv = ".venv"
|
||||
strict = ["src/mcp/**/*.py"]
|
||||
|
||||
Reference in New Issue
Block a user