diff --git a/README.md b/README.md index b41a767..bba5dab 100644 --- a/README.md +++ b/README.md @@ -165,7 +165,7 @@ This repo ships a ready-made agent skill at [`skills/tech-detector/SKILL.md`](sk ## Roadmap - [x] Official MCP Registry listing (`io.github.devkindhq/whatweb-mcp`) -- [ ] Docker MCP Registry and Smithery listings +- [ ] Docker MCP Registry listing - [ ] Batch scanning (multiple targets in one call) - [ ] Optional CSV/JSON export tool - [ ] Scheduled re-scans with diffing (alert when a target's stack changes) diff --git a/requirements.txt b/requirements.txt index 16b15e9..fe77cea 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ -mcp==1.6.0 +mcp==1.28.1 pydantic==2.11.5 pydantic-settings==2.9.1 diff --git a/server.py b/server.py index 1ac4d01..bccae5c 100644 --- a/server.py +++ b/server.py @@ -27,7 +27,7 @@ TextContent, Tool, ) -from pydantic import BaseModel, Field +from pydantic import AnyUrl, BaseModel, Field from pydantic_settings import BaseSettings logging.basicConfig( @@ -348,7 +348,8 @@ async def list_resources() -> list[Resource]: @app.read_resource() -async def read_resource(uri: str) -> str: +async def read_resource(uri: AnyUrl) -> str: + uri = str(uri) if uri.startswith("whatweb://results/"): scan_id = uri.replace("whatweb://results/", "") result = scan_results.get(scan_id) diff --git a/smithery.yaml b/smithery.yaml deleted file mode 100644 index c71cfdd..0000000 --- a/smithery.yaml +++ /dev/null @@ -1,23 +0,0 @@ -name: whatweb-mcp -description: Website technology fingerprinting for AI agents, powered by WhatWeb. Multi-arch Docker. -vendor: Devkind -homepage: https://devkind.com.au/services -license: MIT -startCommand: - type: stdio - configSchema: - type: object - properties: - timeout: - type: number - description: Per-scan timeout in seconds - default: 300 - maxConcurrent: - type: number - description: Maximum concurrent scans - default: 2 - commandFunction: |- - (config) => ({ - command: "docker", - args: ["run", "-i", "--rm", "--memory=512m", "--cpus=0.5", "--pids-limit=100", "-e", `WHATWEB_TIMEOUT=${config.timeout ?? 300}`, "-e", `WHATWEB_MAX_CONCURRENT=${config.maxConcurrent ?? 2}`, "devkind/whatweb-mcp:latest"] - }) diff --git a/tests/test_resource.py b/tests/test_resource.py new file mode 100644 index 0000000..3dd45ea --- /dev/null +++ b/tests/test_resource.py @@ -0,0 +1,19 @@ +"""Tests for resources/read through the registered MCP handler.""" + +import asyncio +import json + +from mcp import types + +import server + + +def test_read_unknown_result_returns_not_found(): + handler = server.app.request_handlers[types.ReadResourceRequest] + req = types.ReadResourceRequest( + method="resources/read", + params=types.ReadResourceRequestParams(uri="whatweb://results/missing"), + ) + result = asyncio.run(handler(req)) + text = result.root.contents[0].text + assert json.loads(text) == {"error": "Resource not found"}