mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-26 01:12:21 +00:00
* test(integration): drop the contracts.json manifest and the covers requirement Groups live as a GROUPS literal in run.py, the browser expectations move next to the browser tests, and the runner fails only on pytest failure, collection errors or a selected file that collects zero tests. The covers marker stays registered for the existing tests but is no longer checked. The mcp directory gets its own group Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * ci(integration): run mcp as its own shard with xdist and a peer proxy Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * ci(integration): INTEGRATION_COVERAGE=1 runs the proxy under coverage for the MCP modules The mcp shard sets it. The proxy and its peer start under coverage run in parallel mode, get SIGTERM after the tests so coverage flushes, and the combined text and HTML reports land in the suite results that CircleCI already stores as artifacts Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * ci(integration): let the test proxy flush coverage when uvicorn re-raises SIGTERM Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * test(integration): add SSE, stdio, scripted, OpenAPI and OAuth 2.1 MCP peer doubles Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * test(integration): add MCP transport and access-control matrices Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * test(integration): add MCP credential and OAuth flow coverage Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * test(integration): add MCP LLM endpoint, accounting, guardrail, resilience and lifecycle coverage Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * test(integration): stop the same-URL grant test from counting a late initialize as a leaked call and satisfy the test-tree lint Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * test(integration): assert the REST denied-server listing is refused or empty Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * test(integration): pin the REST denied-server listing to 403 access_denied Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --------- Co-authored-by: yuneng <yuneng@berri.ai> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
49 lines
1.7 KiB
Python
49 lines
1.7 KiB
Python
"""Stdio MCP peer the proxy spawns; every inbound JSON-RPC line is appended to the record file."""
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
sys.path[0] = str(Path(__file__).resolve().parents[2])
|
|
|
|
import asyncio # noqa: E402 # the script directory holds mcp.py, which would shadow the mcp package
|
|
import json # noqa: E402
|
|
import os # noqa: E402
|
|
from typing import Final # noqa: E402
|
|
|
|
import anyio # noqa: E402
|
|
from integration._support.mcp import math_service # noqa: E402
|
|
from mcp.server.stdio import stdio_server # noqa: E402
|
|
|
|
|
|
class Recording:
|
|
def __init__(self, source: anyio.AsyncFile[str], record: Path) -> None:
|
|
self.source = source
|
|
self.record = record
|
|
|
|
def __aiter__(self) -> "Recording":
|
|
return self
|
|
|
|
async def __anext__(self) -> str:
|
|
line: Final = await self.source.readline()
|
|
if not line:
|
|
raise StopAsyncIteration
|
|
with self.record.open("a") as sink:
|
|
passed: Final = {name: value for name, value in os.environ.items() if name.startswith("PEER_")}
|
|
sink.write(json.dumps({"body": json.loads(line), "env": passed}) + "\n")
|
|
return line
|
|
|
|
async def readline(self) -> str:
|
|
return await self.__anext__()
|
|
|
|
|
|
async def main() -> None:
|
|
record: Final = Path(sys.argv[1])
|
|
service: Final = math_service("integration-stdio", rich=sys.argv[2] == "rich")
|
|
stdin: Final = anyio.wrap_file(sys.stdin)
|
|
async with stdio_server(stdin=Recording(stdin, record)) as (read_stream, write_stream):
|
|
lowlevel: Final = service._lowlevel_server
|
|
await lowlevel.run(read_stream, write_stream, lowlevel.create_initialization_options())
|
|
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main())
|