fix: pass conformance auth scenarios, add RFC 8707 resource validation (#2010)
This commit is contained in:
parent
7c7c13b648
commit
239d682b6f
2 changed files with 187 additions and 8 deletions
23
.github/actions/conformance/client.py
vendored
23
.github/actions/conformance/client.py
vendored
|
|
@ -275,6 +275,27 @@ async def run_client_credentials_basic(server_url: str) -> None:
|
|||
async def run_auth_code_client(server_url: str) -> None:
|
||||
"""Authorization code flow (default for auth/* scenarios)."""
|
||||
callback_handler = ConformanceOAuthCallbackHandler()
|
||||
storage = InMemoryTokenStorage()
|
||||
|
||||
# Check for pre-registered client credentials from context
|
||||
context_json = os.environ.get("MCP_CONFORMANCE_CONTEXT")
|
||||
if context_json:
|
||||
try:
|
||||
context = json.loads(context_json)
|
||||
client_id = context.get("client_id")
|
||||
client_secret = context.get("client_secret")
|
||||
if client_id:
|
||||
await storage.set_client_info(
|
||||
OAuthClientInformationFull(
|
||||
client_id=client_id,
|
||||
client_secret=client_secret,
|
||||
redirect_uris=[AnyUrl("http://localhost:3000/callback")],
|
||||
token_endpoint_auth_method="client_secret_basic" if client_secret else "none",
|
||||
)
|
||||
)
|
||||
logger.debug(f"Pre-loaded client credentials: client_id={client_id}")
|
||||
except json.JSONDecodeError:
|
||||
logger.exception("Failed to parse MCP_CONFORMANCE_CONTEXT")
|
||||
|
||||
oauth_auth = OAuthClientProvider(
|
||||
server_url=server_url,
|
||||
|
|
@ -284,7 +305,7 @@ async def run_auth_code_client(server_url: str) -> None:
|
|||
grant_types=["authorization_code", "refresh_token"],
|
||||
response_types=["code"],
|
||||
),
|
||||
storage=InMemoryTokenStorage(),
|
||||
storage=storage,
|
||||
redirect_handler=callback_handler.handle_redirect,
|
||||
callback_handler=callback_handler.handle_callback,
|
||||
client_metadata_url="https://conformance-test.local/client-metadata.json",
|
||||
|
|
|
|||
9
.github/workflows/conformance.yml
vendored
9
.github/workflows/conformance.yml
vendored
|
|
@ -1,10 +1,9 @@
|
|||
name: Conformance Tests
|
||||
|
||||
on:
|
||||
# Disabled: conformance tests are currently broken in CI
|
||||
# push:
|
||||
# branches: [main]
|
||||
# pull_request:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
|
|
@ -43,4 +42,4 @@ jobs:
|
|||
with:
|
||||
node-version: 24
|
||||
- run: uv sync --frozen --all-extras --package mcp
|
||||
- run: npx @modelcontextprotocol/conformance@0.1.10 client --command 'uv run --frozen python .github/actions/conformance/client.py' --suite all
|
||||
- run: npx @modelcontextprotocol/conformance@0.1.13 client --command 'uv run --frozen python .github/actions/conformance/client.py' --suite all
|
||||
|
|
|
|||
Loading…
Reference in a new issue