├── .python-version ├── LICENSE ├── README.md ├── pyproject.toml ├── src └── playwright_server │ ├── __init__.py │ └── server.py └── uv.lock /.python-version: -------------------------------------------------------------------------------- 1 | 3.11 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # playwright-server MCP server 2 | 3 | \A MCP server with playwright tools\ 4 | 5 | Playwright Server MCP server 6 | 7 | ## Components 8 | 9 | ### Resources 10 | 11 | The server implements a simple note storage system with: 12 | - Custom note:// URI scheme for accessing individual notes 13 | - Each note resource has a name, description and text/plain mimetype 14 | 15 | ### Prompts 16 | 17 | The server provides a single prompt: 18 | - summarize-notes: Creates summaries of all stored notes 19 | - Optional "style" argument to control detail level (brief/detailed) 20 | - Generates prompt combining all current notes with style preference 21 | 22 | ### Tools 23 | 24 | The server implements the following tools: 25 | - `playwright_navigate`: Navigates to a specified URL. This operation will automatically create a new session if there is no active session. 26 | - Requires a `url` argument (string). 27 | - `playwright_screenshot`: Takes a screenshot of the current page or a specific element. 28 | - Requires a `name` argument (string) for the screenshot file name. 29 | - Optional `selector` argument (string) to specify a CSS selector for the element to screenshot. If no selector is provided, a full-page screenshot is taken. 30 | - `playwright_click`: Clicks an element on the page using a CSS selector. 31 | - Requires a `selector` argument (string) to specify the CSS selector for the element to click. 32 | - `playwright_fill`: Fills out an input field. 33 | - Requires a `selector` argument (string) to specify the CSS selector for the input field. 34 | - Requires a `value` argument (string) to specify the value to fill. 35 | - `playwright_evaluate`: Executes JavaScript code in the browser console. 36 | - Requires a `script` argument (string) to specify the JavaScript code to execute. 37 | - `playwright_click_text`: Clicks an element on the page by its text content. 38 | - Requires a `text` argument (string) to specify the text content of the element to click. 39 | - `playwright_get_text_content`: Get the text content of all visiable elements. 40 | - `playwright_get_html_content`: Get the HTML content of the page. 41 | - Requires a `selector` argument (string) to specify the CSS selector for the element. 42 | 43 | ## Configuration 44 | 45 | [TODO: Add configuration details specific to your implementation] 46 | 47 | ## Quickstart 48 | 49 | ### Install 50 | 51 | #### Claude Desktop 52 | 53 | On MacOS: `~/Library/Application\ Support/Claude/claude_desktop_config.json` 54 | On Windows: `%APPDATA%/Claude/claude_desktop_config.json` 55 | 56 |
57 | Development/Unpublished Servers Configuration 58 | ``` 59 | "mcpServers": { 60 | "playwright-server": { 61 | "command": "uv", 62 | "args": [ 63 | "--directory", 64 | "C:\Users\xxxxx\Documents\project\python\mcp\playwright-server", 65 | "run", 66 | "playwright-server" 67 | ] 68 | } 69 | } 70 | ``` 71 |
72 | 73 |
74 | Published Servers Configuration 75 | ``` 76 | "mcpServers": { 77 | "playwright-server": { 78 | "command": "uvx", 79 | "args": [ 80 | "playwright-server" 81 | ] 82 | } 83 | } 84 | ``` 85 |
86 | 87 | ## Development 88 | 89 | ### Building and Publishing 90 | 91 | To prepare the package for distribution: 92 | 93 | 1. Sync dependencies and update lockfile: 94 | ```bash 95 | uv sync 96 | ``` 97 | 98 | 2. Build package distributions: 99 | ```bash 100 | uv build 101 | ``` 102 | 103 | This will create source and wheel distributions in the `dist/` directory. 104 | 105 | 3. Publish to PyPI: 106 | ```bash 107 | uv publish 108 | ``` 109 | 110 | Note: You'll need to set PyPI credentials via environment variables or command flags: 111 | - Token: `--token` or `UV_PUBLISH_TOKEN` 112 | - Or username/password: `--username`/`UV_PUBLISH_USERNAME` and `--password`/`UV_PUBLISH_PASSWORD` 113 | 114 | ### Debugging 115 | 116 | Since MCP servers run over stdio, debugging can be challenging. For the best debugging 117 | experience, we strongly recommend using the [MCP Inspector](https://github.com/modelcontextprotocol/inspector). 118 | 119 | 120 | You can launch the MCP Inspector via [`npm`](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) with this command: 121 | 122 | ```bash 123 | npx @modelcontextprotocol/inspector uv --directory C:\Users\YUNYING\Documents\project\python\mcp\playwright-server run playwright-server 124 | ``` 125 | 126 | 127 | Upon launching, the Inspector will display a URL that you can access in your browser to begin debugging. 128 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "playwright-server" 3 | version = "0.1.0" 4 | description = "\\A MCP server with playwright tools\\" 5 | readme = "README.md" 6 | requires-python = ">=3.11" 7 | dependencies = [ "mcp>=1.1.2", "playwright"] 8 | [[project.authors]] 9 | name = "YUNYING" 10 | email = "qcyunying@gmail.com" 11 | 12 | [build-system] 13 | requires = [ "hatchling",] 14 | build-backend = "hatchling.build" 15 | 16 | [project.scripts] 17 | playwright-server = "playwright_server:main" 18 | -------------------------------------------------------------------------------- /src/playwright_server/__init__.py: -------------------------------------------------------------------------------- 1 | from . import server 2 | import asyncio 3 | 4 | def main(): 5 | """Main entry point for the package.""" 6 | asyncio.run(server.main()) 7 | 8 | # Optionally expose other important items at package level 9 | __all__ = ['main', 'server'] -------------------------------------------------------------------------------- /src/playwright_server/server.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | 3 | from mcp.server.models import InitializationOptions 4 | import mcp.types as types 5 | from mcp.server import NotificationOptions, Server 6 | from pydantic import AnyUrl 7 | import mcp.server.stdio 8 | 9 | server = Server("playwright-server") 10 | 11 | @server.list_resources() 12 | async def handle_list_resources() -> list[types.Resource]: 13 | """ 14 | List available note resources. 15 | Each note is exposed as a resource with a custom note:// URI scheme. 16 | """ 17 | return [] 18 | 19 | @server.read_resource() 20 | async def handle_read_resource(uri: AnyUrl) -> str: 21 | """ 22 | Read a specific note's content by its URI. 23 | The note name is extracted from the URI host component. 24 | """ 25 | raise ValueError(f"Unsupported URI scheme: {uri.scheme}") 26 | 27 | 28 | @server.list_prompts() 29 | async def handle_list_prompts() -> list[types.Prompt]: 30 | """ 31 | List available prompts. 32 | Each prompt can have optional arguments to customize its behavior. 33 | """ 34 | return [] 35 | 36 | @server.get_prompt() 37 | async def handle_get_prompt( 38 | name: str, arguments: dict[str, str] | None 39 | ) -> types.GetPromptResult: 40 | """ 41 | Generate a prompt by combining arguments with server state. 42 | The prompt includes all current notes and can be customized via arguments. 43 | """ 44 | raise ValueError(f"Unknown prompt: {name}") 45 | 46 | 47 | @server.list_tools() 48 | async def handle_list_tools() -> list[types.Tool]: 49 | """ 50 | List available tools. 51 | Each tool specifies its arguments using JSON Schema validation. 52 | """ 53 | return [ 54 | # types.Tool( 55 | # name="playwright_new_session", 56 | # description="Create a new browser session", 57 | # inputSchema={ 58 | # "type": "object", 59 | # "properties": { 60 | # "url": {"type": "string", "description": "Initial URL to navigate to"} 61 | # } 62 | # } 63 | # ), 64 | types.Tool( 65 | name="playwright_navigate", 66 | description="Navigate to a URL,thip op will auto create a session", 67 | inputSchema={ 68 | "type": "object", 69 | "properties": { 70 | "url": {"type": "string"} 71 | }, 72 | "required": ["url"] 73 | } 74 | ), 75 | types.Tool( 76 | name="playwright_screenshot", 77 | description="Take a screenshot of the current page or a specific element", 78 | inputSchema={ 79 | "type": "object", 80 | "properties": { 81 | "name": {"type": "string"}, 82 | "selector": {"type": "string", "description": "CSS selector for element to screenshot,null is full page"}, 83 | }, 84 | "required": ["name"] 85 | } 86 | ), 87 | types.Tool( 88 | name="playwright_click", 89 | description="Click an element on the page using CSS selector", 90 | inputSchema={ 91 | "type": "object", 92 | "properties": { 93 | "selector": {"type": "string", "description": "CSS selector for element to click"} 94 | }, 95 | "required": ["selector"] 96 | } 97 | ), 98 | types.Tool( 99 | name="playwright_fill", 100 | description="Fill out an input field", 101 | inputSchema={ 102 | "type": "object", 103 | "properties": { 104 | "selector": {"type": "string", "description": "CSS selector for input field"}, 105 | "value": {"type": "string", "description": "Value to fill"} 106 | }, 107 | "required": ["selector", "value"] 108 | } 109 | ), 110 | types.Tool( 111 | name="playwright_evaluate", 112 | description="Execute JavaScript in the browser console", 113 | inputSchema={ 114 | "type": "object", 115 | "properties": { 116 | "script": {"type": "string", "description": "JavaScript code to execute"} 117 | }, 118 | "required": ["script"] 119 | } 120 | ), 121 | types.Tool( 122 | name="playwright_click_text", 123 | description="Click an element on the page by its text content", 124 | inputSchema={ 125 | "type": "object", 126 | "properties": { 127 | "text": {"type": "string", "description": "Text content of the element to click"} 128 | }, 129 | "required": ["text"] 130 | } 131 | ), 132 | types.Tool( 133 | name="playwright_get_text_content", 134 | description="Get the text content of all elements", 135 | inputSchema={ 136 | "type": "object", 137 | "properties": { 138 | }, 139 | } 140 | ), 141 | types.Tool( 142 | name="playwright_get_html_content", 143 | description="Get the HTML content of the page", 144 | inputSchema={ 145 | "type": "object", 146 | "properties": { 147 | "selector": {"type": "string", "description": "CSS selector for the element"} 148 | }, 149 | "required": ["selector"] 150 | } 151 | ) 152 | ] 153 | 154 | import uuid 155 | from playwright.async_api import async_playwright 156 | import base64 157 | import os 158 | 159 | import asyncio 160 | 161 | def update_page_after_click(func): 162 | async def wrapper(self, name: str, arguments: dict | None): 163 | if not self._sessions: 164 | return [types.TextContent(type="text", text="No active session. Please create a new session first.")] 165 | session_id = list(self._sessions.keys())[-1] 166 | page = self._sessions[session_id]["page"] 167 | 168 | new_page_future = asyncio.ensure_future(page.context.wait_for_event("page", timeout=3000)) 169 | 170 | result = await func(self, name, arguments) 171 | try: 172 | new_page = await new_page_future 173 | await new_page.wait_for_load_state() 174 | self._sessions[session_id]["page"] = new_page 175 | except: 176 | pass 177 | # if page.url != self._sessions[session_id]["page"].url: 178 | # await page.wait_for_load_state() 179 | # self._sessions[session_id]["page"] = page 180 | 181 | return result 182 | return wrapper 183 | 184 | class ToolHandler: 185 | _sessions: dict[str, any] = {} 186 | _playwright: any = None 187 | 188 | async def handle(self, name: str, arguments: dict | None) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]: 189 | raise NotImplementedError 190 | 191 | class NewSessionToolHandler(ToolHandler): 192 | async def handle(self, name: str, arguments: dict | None) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]: 193 | self._playwright = await async_playwright().start() 194 | browser = await self._playwright.chromium.launch(headless=False) 195 | page = await browser.new_page() 196 | session_id = str(uuid.uuid4()) 197 | self._sessions[session_id] = {"browser": browser, "page": page} 198 | url = arguments.get("url") 199 | if url: 200 | if not url.startswith("http://") and not url.startswith("https://"): 201 | url = "https://" + url 202 | await page.goto(url) 203 | return [types.TextContent(type="text", text="succ")] 204 | 205 | class NavigateToolHandler(ToolHandler): 206 | async def handle(self, name: str, arguments: dict | None) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]: 207 | if not self._sessions: 208 | await NewSessionToolHandler().handle("",{}) 209 | # return [types.TextContent(type="text", text="No active session. Please create a new session first.")] 210 | session_id = list(self._sessions.keys())[-1] 211 | page = self._sessions[session_id]["page"] 212 | url = arguments.get("url") 213 | if not url.startswith("http://") and not url.startswith("https://"): 214 | url = "https://" + url 215 | await page.goto(url) 216 | text_content=await GetTextContentToolHandler().handle("",{}) 217 | return [types.TextContent(type="text", text=f"Navigated to {url}\npage_text_content[:200]:\n\n{text_content[:200]}")] 218 | 219 | class ScreenshotToolHandler(ToolHandler): 220 | async def handle(self, name: str, arguments: dict | None) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]: 221 | if not self._sessions: 222 | return [types.TextContent(type="text", text="No active session. Please create a new session first.")] 223 | session_id = list(self._sessions.keys())[-1] 224 | page = self._sessions[session_id]["page"] 225 | name = arguments.get("name") 226 | selector = arguments.get("selector") 227 | # full_page = arguments.get("fullPage", False) 228 | if selector: 229 | element = await page.locator(selector) 230 | await element.screenshot(path=f"{name}.png") 231 | else: 232 | await page.screenshot(path=f"{name}.png", full_page=True) 233 | with open(f"{name}.png", "rb") as image_file: 234 | encoded_string = base64.b64encode(image_file.read()).decode("utf-8") 235 | os.remove(f"{name}.png") 236 | return [types.ImageContent(type="image", data=encoded_string, mimeType="image/png")] 237 | 238 | class ClickToolHandler(ToolHandler): 239 | @update_page_after_click 240 | async def handle(self, name: str, arguments: dict | None) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]: 241 | if not self._sessions: 242 | return [types.TextContent(type="text", text="No active session. Please create a new session first.")] 243 | session_id = list(self._sessions.keys())[-1] 244 | page = self._sessions[session_id]["page"] 245 | selector = arguments.get("selector") 246 | await page.locator(selector).click() 247 | return [types.TextContent(type="text", text=f"Clicked element with selector {selector}")] 248 | 249 | class FillToolHandler(ToolHandler): 250 | async def handle(self, name: str, arguments: dict | None) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]: 251 | if not self._sessions: 252 | return [types.TextContent(type="text", text="No active session. Please create a new session first.")] 253 | session_id = list(self._sessions.keys())[-1] 254 | page = self._sessions[session_id]["page"] 255 | selector = arguments.get("selector") 256 | value = arguments.get("value") 257 | await page.locator(selector).fill(value) 258 | return [types.TextContent(type="text", text=f"Filled element with selector {selector} with value {value}")] 259 | 260 | class EvaluateToolHandler(ToolHandler): 261 | async def handle(self, name: str, arguments: dict | None) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]: 262 | if not self._sessions: 263 | return [types.TextContent(type="text", text="No active session. Please create a new session first.")] 264 | session_id = list(self._sessions.keys())[-1] 265 | page = self._sessions[session_id]["page"] 266 | script = arguments.get("script") 267 | result = await page.evaluate(script) 268 | return [types.TextContent(type="text", text=f"Evaluated script, result: {result}")] 269 | 270 | class ClickTextToolHandler(ToolHandler): 271 | @update_page_after_click 272 | async def handle(self, name: str, arguments: dict | None) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]: 273 | if not self._sessions: 274 | return [types.TextContent(type="text", text="No active session. Please create a new session first.")] 275 | session_id = list(self._sessions.keys())[-1] 276 | page = self._sessions[session_id]["page"] 277 | text = arguments.get("text") 278 | await page.locator(f"text={text}").nth(0).click() 279 | return [types.TextContent(type="text", text=f"Clicked element with text {text}")] 280 | 281 | class GetTextContentToolHandler(ToolHandler): 282 | async def handle(self, name: str, arguments: dict | None) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]: 283 | if not self._sessions: 284 | return [types.TextContent(type="text", text="No active session. Please create a new session first.")] 285 | session_id = list(self._sessions.keys())[-1] 286 | page = self._sessions[session_id]["page"] 287 | # text_contents = await page.locator('body').all_inner_texts() 288 | 289 | 290 | async def get_unique_texts_js(page): 291 | unique_texts = await page.evaluate('''() => { 292 | var elements = Array.from(document.querySelectorAll('*')); // 先选择所有元素,再进行过滤 293 | var uniqueTexts = new Set(); 294 | 295 | for (var element of elements) { 296 | if (element.offsetWidth > 0 || element.offsetHeight > 0) { // 判断是否可见 297 | var childrenCount = element.querySelectorAll('*').length; 298 | if (childrenCount <= 3) { 299 | var innerText = element.innerText ? element.innerText.trim() : ''; 300 | if (innerText && innerText.length <= 1000) { 301 | uniqueTexts.add(innerText); 302 | } 303 | var value = element.getAttribute('value'); 304 | if (value) { 305 | uniqueTexts.add(value); 306 | } 307 | } 308 | } 309 | } 310 | //console.log( Array.from(uniqueTexts)); 311 | return Array.from(uniqueTexts); 312 | } 313 | ''') 314 | return unique_texts 315 | 316 | # 使用示例 317 | text_contents = await get_unique_texts_js(page) 318 | 319 | 320 | 321 | return [types.TextContent(type="text", text=f"Text content of all elements: {text_contents}")] 322 | 323 | class GetHtmlContentToolHandler(ToolHandler): 324 | async def handle(self, name: str, arguments: dict | None) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]: 325 | if not self._sessions: 326 | return [types.TextContent(type="text", text="No active session. Please create a new session first.")] 327 | session_id = list(self._sessions.keys())[-1] 328 | page = self._sessions[session_id]["page"] 329 | selector = arguments.get("selector") 330 | html_content = await page.locator(selector).inner_html() 331 | return [types.TextContent(type="text", text=f"HTML content of element with selector {selector}: {html_content}")] 332 | 333 | 334 | tool_handlers = { 335 | "playwright_navigate": NavigateToolHandler(), 336 | "playwright_screenshot": ScreenshotToolHandler(), 337 | "playwright_click": ClickToolHandler(), 338 | "playwright_fill": FillToolHandler(), 339 | "playwright_evaluate": EvaluateToolHandler(), 340 | "playwright_click_text": ClickTextToolHandler(), 341 | "playwright_get_text_content": GetTextContentToolHandler(), 342 | "playwright_get_html_content": GetHtmlContentToolHandler(), 343 | "playwright_new_session":NewSessionToolHandler(), 344 | } 345 | 346 | 347 | @server.call_tool() 348 | async def handle_call_tool( 349 | name: str, arguments: dict | None 350 | ) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]: 351 | """ 352 | Handle tool execution requests. 353 | Tools can modify server state and notify clients of changes. 354 | """ 355 | if name in tool_handlers: 356 | return await tool_handlers[name].handle(name, arguments) 357 | else: 358 | raise ValueError(f"Unknown tool: {name}") 359 | 360 | async def main(): 361 | # Run the server using stdin/stdout streams 362 | async with mcp.server.stdio.stdio_server() as (read_stream, write_stream): 363 | await server.run( 364 | read_stream, 365 | write_stream, 366 | InitializationOptions( 367 | server_name="playwright-plus-server", 368 | server_version="0.1.0", 369 | capabilities=server.get_capabilities( 370 | notification_options=NotificationOptions(), 371 | experimental_capabilities={}, 372 | ), 373 | ), 374 | ) 375 | 376 | if __name__ == "__main__": 377 | asyncio.run(main()) 378 | -------------------------------------------------------------------------------- /uv.lock: -------------------------------------------------------------------------------- 1 | version = 1 2 | requires-python = ">=3.11" 3 | 4 | [[package]] 5 | name = "annotated-types" 6 | version = "0.7.0" 7 | source = { registry = "https://pypi.org/simple" } 8 | sdist = { url = "https://files.pythonhosted.org/packages/ee/67/531ea369ba64dcff5ec9c3402f9f51bf748cec26dde048a2f973a4eea7f5/annotated_types-0.7.0.tar.gz", hash = "sha256:aff07c09a53a08bc8cfccb9c85b05f1aa9a2a6f23728d790723543408344ce89", size = 16081 } 9 | wheels = [ 10 | { url = "https://files.pythonhosted.org/packages/78/b6/6307fbef88d9b5ee7421e68d78a9f162e0da4900bc5f5793f6d3d0e34fb8/annotated_types-0.7.0-py3-none-any.whl", hash = "sha256:1f02e8b43a8fbbc3f3e0d4f0f4bfc8131bcb4eebe8849b8e5c773f3a1c582a53", size = 13643 }, 11 | ] 12 | 13 | [[package]] 14 | name = "anyio" 15 | version = "4.7.0" 16 | source = { registry = "https://pypi.org/simple" } 17 | dependencies = [ 18 | { name = "idna" }, 19 | { name = "sniffio" }, 20 | { name = "typing-extensions", marker = "python_full_version < '3.13'" }, 21 | ] 22 | sdist = { url = "https://files.pythonhosted.org/packages/f6/40/318e58f669b1a9e00f5c4453910682e2d9dd594334539c7b7817dabb765f/anyio-4.7.0.tar.gz", hash = "sha256:2f834749c602966b7d456a7567cafcb309f96482b5081d14ac93ccd457f9dd48", size = 177076 } 23 | wheels = [ 24 | { url = "https://files.pythonhosted.org/packages/a0/7a/4daaf3b6c08ad7ceffea4634ec206faeff697526421c20f07628c7372156/anyio-4.7.0-py3-none-any.whl", hash = "sha256:ea60c3723ab42ba6fff7e8ccb0488c898ec538ff4df1f1d5e642c3601d07e352", size = 93052 }, 25 | ] 26 | 27 | [[package]] 28 | name = "certifi" 29 | version = "2024.12.14" 30 | source = { registry = "https://pypi.org/simple" } 31 | sdist = { url = "https://files.pythonhosted.org/packages/0f/bd/1d41ee578ce09523c81a15426705dd20969f5abf006d1afe8aeff0dd776a/certifi-2024.12.14.tar.gz", hash = "sha256:b650d30f370c2b724812bee08008be0c4163b163ddaec3f2546c1caf65f191db", size = 166010 } 32 | wheels = [ 33 | { url = "https://files.pythonhosted.org/packages/a5/32/8f6669fc4798494966bf446c8c4a162e0b5d893dff088afddf76414f70e1/certifi-2024.12.14-py3-none-any.whl", hash = "sha256:1275f7a45be9464efc1173084eaa30f866fe2e47d389406136d332ed4967ec56", size = 164927 }, 34 | ] 35 | 36 | [[package]] 37 | name = "h11" 38 | version = "0.14.0" 39 | source = { registry = "https://pypi.org/simple" } 40 | sdist = { url = "https://files.pythonhosted.org/packages/f5/38/3af3d3633a34a3316095b39c8e8fb4853a28a536e55d347bd8d8e9a14b03/h11-0.14.0.tar.gz", hash = "sha256:8f19fbbe99e72420ff35c00b27a34cb9937e902a8b810e2c88300c6f0a3b699d", size = 100418 } 41 | wheels = [ 42 | { url = "https://files.pythonhosted.org/packages/95/04/ff642e65ad6b90db43e668d70ffb6736436c7ce41fcc549f4e9472234127/h11-0.14.0-py3-none-any.whl", hash = "sha256:e3fe4ac4b851c468cc8363d500db52c2ead036020723024a109d37346efaa761", size = 58259 }, 43 | ] 44 | 45 | [[package]] 46 | name = "httpcore" 47 | version = "1.0.7" 48 | source = { registry = "https://pypi.org/simple" } 49 | dependencies = [ 50 | { name = "certifi" }, 51 | { name = "h11" }, 52 | ] 53 | sdist = { url = "https://files.pythonhosted.org/packages/6a/41/d7d0a89eb493922c37d343b607bc1b5da7f5be7e383740b4753ad8943e90/httpcore-1.0.7.tar.gz", hash = "sha256:8551cb62a169ec7162ac7be8d4817d561f60e08eaa485234898414bb5a8a0b4c", size = 85196 } 54 | wheels = [ 55 | { url = "https://files.pythonhosted.org/packages/87/f5/72347bc88306acb359581ac4d52f23c0ef445b57157adedb9aee0cd689d2/httpcore-1.0.7-py3-none-any.whl", hash = "sha256:a3fff8f43dc260d5bd363d9f9cf1830fa3a458b332856f34282de498ed420edd", size = 78551 }, 56 | ] 57 | 58 | [[package]] 59 | name = "httpx" 60 | version = "0.28.1" 61 | source = { registry = "https://pypi.org/simple" } 62 | dependencies = [ 63 | { name = "anyio" }, 64 | { name = "certifi" }, 65 | { name = "httpcore" }, 66 | { name = "idna" }, 67 | ] 68 | sdist = { url = "https://files.pythonhosted.org/packages/b1/df/48c586a5fe32a0f01324ee087459e112ebb7224f646c0b5023f5e79e9956/httpx-0.28.1.tar.gz", hash = "sha256:75e98c5f16b0f35b567856f597f06ff2270a374470a5c2392242528e3e3e42fc", size = 141406 } 69 | wheels = [ 70 | { url = "https://files.pythonhosted.org/packages/2a/39/e50c7c3a983047577ee07d2a9e53faf5a69493943ec3f6a384bdc792deb2/httpx-0.28.1-py3-none-any.whl", hash = "sha256:d909fcccc110f8c7faf814ca82a9a4d816bc5a6dbfea25d6591d6985b8ba59ad", size = 73517 }, 71 | ] 72 | 73 | [[package]] 74 | name = "httpx-sse" 75 | version = "0.4.0" 76 | source = { registry = "https://pypi.org/simple" } 77 | sdist = { url = "https://files.pythonhosted.org/packages/4c/60/8f4281fa9bbf3c8034fd54c0e7412e66edbab6bc74c4996bd616f8d0406e/httpx-sse-0.4.0.tar.gz", hash = "sha256:1e81a3a3070ce322add1d3529ed42eb5f70817f45ed6ec915ab753f961139721", size = 12624 } 78 | wheels = [ 79 | { url = "https://files.pythonhosted.org/packages/e1/9b/a181f281f65d776426002f330c31849b86b31fc9d848db62e16f03ff739f/httpx_sse-0.4.0-py3-none-any.whl", hash = "sha256:f329af6eae57eaa2bdfd962b42524764af68075ea87370a2de920af5341e318f", size = 7819 }, 80 | ] 81 | 82 | [[package]] 83 | name = "idna" 84 | version = "3.10" 85 | source = { registry = "https://pypi.org/simple" } 86 | sdist = { url = "https://files.pythonhosted.org/packages/f1/70/7703c29685631f5a7590aa73f1f1d3fa9a380e654b86af429e0934a32f7d/idna-3.10.tar.gz", hash = "sha256:12f65c9b470abda6dc35cf8e63cc574b1c52b11df2c86030af0ac09b01b13ea9", size = 190490 } 87 | wheels = [ 88 | { url = "https://files.pythonhosted.org/packages/76/c6/c88e154df9c4e1a2a66ccf0005a88dfb2650c1dffb6f5ce603dfbd452ce3/idna-3.10-py3-none-any.whl", hash = "sha256:946d195a0d259cbba61165e88e65941f16e9b36ea6ddb97f00452bae8b1287d3", size = 70442 }, 89 | ] 90 | 91 | [[package]] 92 | name = "mcp" 93 | version = "1.1.2" 94 | source = { registry = "https://pypi.org/simple" } 95 | dependencies = [ 96 | { name = "anyio" }, 97 | { name = "httpx" }, 98 | { name = "httpx-sse" }, 99 | { name = "pydantic" }, 100 | { name = "sse-starlette" }, 101 | { name = "starlette" }, 102 | ] 103 | sdist = { url = "https://files.pythonhosted.org/packages/9b/f3/5cf212e60681ea6da0dbb6e0d1bc0ab2dbf5eebc749b69663d46f114fea1/mcp-1.1.2.tar.gz", hash = "sha256:694aa9df7a8641b24953c935eb72c63136dc948981021525a0add199bdfee402", size = 57628 } 104 | wheels = [ 105 | { url = "https://files.pythonhosted.org/packages/df/40/9883eac3718b860d4006eba1920bfcb628f0a1fe37fac46a4f4e391edca6/mcp-1.1.2-py3-none-any.whl", hash = "sha256:a4d32d60fd80a1702440ba4751b847a8a88957a1f7b059880953143e9759965a", size = 36652 }, 106 | ] 107 | 108 | [[package]] 109 | name = "playwright-server" 110 | version = "0.1.0" 111 | source = { editable = "." } 112 | dependencies = [ 113 | { name = "mcp" }, 114 | ] 115 | 116 | [package.metadata] 117 | requires-dist = [{ name = "mcp", specifier = ">=1.1.2" }] 118 | 119 | [[package]] 120 | name = "pydantic" 121 | version = "2.10.4" 122 | source = { registry = "https://pypi.org/simple" } 123 | dependencies = [ 124 | { name = "annotated-types" }, 125 | { name = "pydantic-core" }, 126 | { name = "typing-extensions" }, 127 | ] 128 | sdist = { url = "https://files.pythonhosted.org/packages/70/7e/fb60e6fee04d0ef8f15e4e01ff187a196fa976eb0f0ab524af4599e5754c/pydantic-2.10.4.tar.gz", hash = "sha256:82f12e9723da6de4fe2ba888b5971157b3be7ad914267dea8f05f82b28254f06", size = 762094 } 129 | wheels = [ 130 | { url = "https://files.pythonhosted.org/packages/f3/26/3e1bbe954fde7ee22a6e7d31582c642aad9e84ffe4b5fb61e63b87cd326f/pydantic-2.10.4-py3-none-any.whl", hash = "sha256:597e135ea68be3a37552fb524bc7d0d66dcf93d395acd93a00682f1efcb8ee3d", size = 431765 }, 131 | ] 132 | 133 | [[package]] 134 | name = "pydantic-core" 135 | version = "2.27.2" 136 | source = { registry = "https://pypi.org/simple" } 137 | dependencies = [ 138 | { name = "typing-extensions" }, 139 | ] 140 | sdist = { url = "https://files.pythonhosted.org/packages/fc/01/f3e5ac5e7c25833db5eb555f7b7ab24cd6f8c322d3a3ad2d67a952dc0abc/pydantic_core-2.27.2.tar.gz", hash = "sha256:eb026e5a4c1fee05726072337ff51d1efb6f59090b7da90d30ea58625b1ffb39", size = 413443 } 141 | wheels = [ 142 | { url = "https://files.pythonhosted.org/packages/c2/89/f3450af9d09d44eea1f2c369f49e8f181d742f28220f88cc4dfaae91ea6e/pydantic_core-2.27.2-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:8e10c99ef58cfdf2a66fc15d66b16c4a04f62bca39db589ae8cba08bc55331bc", size = 1893421 }, 143 | { url = "https://files.pythonhosted.org/packages/9e/e3/71fe85af2021f3f386da42d291412e5baf6ce7716bd7101ea49c810eda90/pydantic_core-2.27.2-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:26f32e0adf166a84d0cb63be85c562ca8a6fa8de28e5f0d92250c6b7e9e2aff7", size = 1814998 }, 144 | { url = "https://files.pythonhosted.org/packages/a6/3c/724039e0d848fd69dbf5806894e26479577316c6f0f112bacaf67aa889ac/pydantic_core-2.27.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8c19d1ea0673cd13cc2f872f6c9ab42acc4e4f492a7ca9d3795ce2b112dd7e15", size = 1826167 }, 145 | { url = "https://files.pythonhosted.org/packages/2b/5b/1b29e8c1fb5f3199a9a57c1452004ff39f494bbe9bdbe9a81e18172e40d3/pydantic_core-2.27.2-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:5e68c4446fe0810e959cdff46ab0a41ce2f2c86d227d96dc3847af0ba7def306", size = 1865071 }, 146 | { url = "https://files.pythonhosted.org/packages/89/6c/3985203863d76bb7d7266e36970d7e3b6385148c18a68cc8915fd8c84d57/pydantic_core-2.27.2-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:d9640b0059ff4f14d1f37321b94061c6db164fbe49b334b31643e0528d100d99", size = 2036244 }, 147 | { url = "https://files.pythonhosted.org/packages/0e/41/f15316858a246b5d723f7d7f599f79e37493b2e84bfc789e58d88c209f8a/pydantic_core-2.27.2-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:40d02e7d45c9f8af700f3452f329ead92da4c5f4317ca9b896de7ce7199ea459", size = 2737470 }, 148 | { url = "https://files.pythonhosted.org/packages/a8/7c/b860618c25678bbd6d1d99dbdfdf0510ccb50790099b963ff78a124b754f/pydantic_core-2.27.2-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1c1fd185014191700554795c99b347d64f2bb637966c4cfc16998a0ca700d048", size = 1992291 }, 149 | { url = "https://files.pythonhosted.org/packages/bf/73/42c3742a391eccbeab39f15213ecda3104ae8682ba3c0c28069fbcb8c10d/pydantic_core-2.27.2-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:d81d2068e1c1228a565af076598f9e7451712700b673de8f502f0334f281387d", size = 1994613 }, 150 | { url = "https://files.pythonhosted.org/packages/94/7a/941e89096d1175d56f59340f3a8ebaf20762fef222c298ea96d36a6328c5/pydantic_core-2.27.2-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:1a4207639fb02ec2dbb76227d7c751a20b1a6b4bc52850568e52260cae64ca3b", size = 2002355 }, 151 | { url = "https://files.pythonhosted.org/packages/6e/95/2359937a73d49e336a5a19848713555605d4d8d6940c3ec6c6c0ca4dcf25/pydantic_core-2.27.2-cp311-cp311-musllinux_1_1_armv7l.whl", hash = "sha256:3de3ce3c9ddc8bbd88f6e0e304dea0e66d843ec9de1b0042b0911c1663ffd474", size = 2126661 }, 152 | { url = "https://files.pythonhosted.org/packages/2b/4c/ca02b7bdb6012a1adef21a50625b14f43ed4d11f1fc237f9d7490aa5078c/pydantic_core-2.27.2-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:30c5f68ded0c36466acede341551106821043e9afaad516adfb6e8fa80a4e6a6", size = 2153261 }, 153 | { url = "https://files.pythonhosted.org/packages/72/9d/a241db83f973049a1092a079272ffe2e3e82e98561ef6214ab53fe53b1c7/pydantic_core-2.27.2-cp311-cp311-win32.whl", hash = "sha256:c70c26d2c99f78b125a3459f8afe1aed4d9687c24fd677c6a4436bc042e50d6c", size = 1812361 }, 154 | { url = "https://files.pythonhosted.org/packages/e8/ef/013f07248041b74abd48a385e2110aa3a9bbfef0fbd97d4e6d07d2f5b89a/pydantic_core-2.27.2-cp311-cp311-win_amd64.whl", hash = "sha256:08e125dbdc505fa69ca7d9c499639ab6407cfa909214d500897d02afb816e7cc", size = 1982484 }, 155 | { url = "https://files.pythonhosted.org/packages/10/1c/16b3a3e3398fd29dca77cea0a1d998d6bde3902fa2706985191e2313cc76/pydantic_core-2.27.2-cp311-cp311-win_arm64.whl", hash = "sha256:26f0d68d4b235a2bae0c3fc585c585b4ecc51382db0e3ba402a22cbc440915e4", size = 1867102 }, 156 | { url = "https://files.pythonhosted.org/packages/d6/74/51c8a5482ca447871c93e142d9d4a92ead74de6c8dc5e66733e22c9bba89/pydantic_core-2.27.2-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:9e0c8cfefa0ef83b4da9588448b6d8d2a2bf1a53c3f1ae5fca39eb3061e2f0b0", size = 1893127 }, 157 | { url = "https://files.pythonhosted.org/packages/d3/f3/c97e80721735868313c58b89d2de85fa80fe8dfeeed84dc51598b92a135e/pydantic_core-2.27.2-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:83097677b8e3bd7eaa6775720ec8e0405f1575015a463285a92bfdfe254529ef", size = 1811340 }, 158 | { url = "https://files.pythonhosted.org/packages/9e/91/840ec1375e686dbae1bd80a9e46c26a1e0083e1186abc610efa3d9a36180/pydantic_core-2.27.2-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:172fce187655fece0c90d90a678424b013f8fbb0ca8b036ac266749c09438cb7", size = 1822900 }, 159 | { url = "https://files.pythonhosted.org/packages/f6/31/4240bc96025035500c18adc149aa6ffdf1a0062a4b525c932065ceb4d868/pydantic_core-2.27.2-cp312-cp312-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:519f29f5213271eeeeb3093f662ba2fd512b91c5f188f3bb7b27bc5973816934", size = 1869177 }, 160 | { url = "https://files.pythonhosted.org/packages/fa/20/02fbaadb7808be578317015c462655c317a77a7c8f0ef274bc016a784c54/pydantic_core-2.27.2-cp312-cp312-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:05e3a55d124407fffba0dd6b0c0cd056d10e983ceb4e5dbd10dda135c31071d6", size = 2038046 }, 161 | { url = "https://files.pythonhosted.org/packages/06/86/7f306b904e6c9eccf0668248b3f272090e49c275bc488a7b88b0823444a4/pydantic_core-2.27.2-cp312-cp312-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:9c3ed807c7b91de05e63930188f19e921d1fe90de6b4f5cd43ee7fcc3525cb8c", size = 2685386 }, 162 | { url = "https://files.pythonhosted.org/packages/8d/f0/49129b27c43396581a635d8710dae54a791b17dfc50c70164866bbf865e3/pydantic_core-2.27.2-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6fb4aadc0b9a0c063206846d603b92030eb6f03069151a625667f982887153e2", size = 1997060 }, 163 | { url = "https://files.pythonhosted.org/packages/0d/0f/943b4af7cd416c477fd40b187036c4f89b416a33d3cc0ab7b82708a667aa/pydantic_core-2.27.2-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:28ccb213807e037460326424ceb8b5245acb88f32f3d2777427476e1b32c48c4", size = 2004870 }, 164 | { url = "https://files.pythonhosted.org/packages/35/40/aea70b5b1a63911c53a4c8117c0a828d6790483f858041f47bab0b779f44/pydantic_core-2.27.2-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:de3cd1899e2c279b140adde9357c4495ed9d47131b4a4eaff9052f23398076b3", size = 1999822 }, 165 | { url = "https://files.pythonhosted.org/packages/f2/b3/807b94fd337d58effc5498fd1a7a4d9d59af4133e83e32ae39a96fddec9d/pydantic_core-2.27.2-cp312-cp312-musllinux_1_1_armv7l.whl", hash = "sha256:220f892729375e2d736b97d0e51466252ad84c51857d4d15f5e9692f9ef12be4", size = 2130364 }, 166 | { url = "https://files.pythonhosted.org/packages/fc/df/791c827cd4ee6efd59248dca9369fb35e80a9484462c33c6649a8d02b565/pydantic_core-2.27.2-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:a0fcd29cd6b4e74fe8ddd2c90330fd8edf2e30cb52acda47f06dd615ae72da57", size = 2158303 }, 167 | { url = "https://files.pythonhosted.org/packages/9b/67/4e197c300976af185b7cef4c02203e175fb127e414125916bf1128b639a9/pydantic_core-2.27.2-cp312-cp312-win32.whl", hash = "sha256:1e2cb691ed9834cd6a8be61228471d0a503731abfb42f82458ff27be7b2186fc", size = 1834064 }, 168 | { url = "https://files.pythonhosted.org/packages/1f/ea/cd7209a889163b8dcca139fe32b9687dd05249161a3edda62860430457a5/pydantic_core-2.27.2-cp312-cp312-win_amd64.whl", hash = "sha256:cc3f1a99a4f4f9dd1de4fe0312c114e740b5ddead65bb4102884b384c15d8bc9", size = 1989046 }, 169 | { url = "https://files.pythonhosted.org/packages/bc/49/c54baab2f4658c26ac633d798dab66b4c3a9bbf47cff5284e9c182f4137a/pydantic_core-2.27.2-cp312-cp312-win_arm64.whl", hash = "sha256:3911ac9284cd8a1792d3cb26a2da18f3ca26c6908cc434a18f730dc0db7bfa3b", size = 1885092 }, 170 | { url = "https://files.pythonhosted.org/packages/41/b1/9bc383f48f8002f99104e3acff6cba1231b29ef76cfa45d1506a5cad1f84/pydantic_core-2.27.2-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:7d14bd329640e63852364c306f4d23eb744e0f8193148d4044dd3dacdaacbd8b", size = 1892709 }, 171 | { url = "https://files.pythonhosted.org/packages/10/6c/e62b8657b834f3eb2961b49ec8e301eb99946245e70bf42c8817350cbefc/pydantic_core-2.27.2-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:82f91663004eb8ed30ff478d77c4d1179b3563df6cdb15c0817cd1cdaf34d154", size = 1811273 }, 172 | { url = "https://files.pythonhosted.org/packages/ba/15/52cfe49c8c986e081b863b102d6b859d9defc63446b642ccbbb3742bf371/pydantic_core-2.27.2-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:71b24c7d61131bb83df10cc7e687433609963a944ccf45190cfc21e0887b08c9", size = 1823027 }, 173 | { url = "https://files.pythonhosted.org/packages/b1/1c/b6f402cfc18ec0024120602bdbcebc7bdd5b856528c013bd4d13865ca473/pydantic_core-2.27.2-cp313-cp313-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:fa8e459d4954f608fa26116118bb67f56b93b209c39b008277ace29937453dc9", size = 1868888 }, 174 | { url = "https://files.pythonhosted.org/packages/bd/7b/8cb75b66ac37bc2975a3b7de99f3c6f355fcc4d89820b61dffa8f1e81677/pydantic_core-2.27.2-cp313-cp313-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:ce8918cbebc8da707ba805b7fd0b382816858728ae7fe19a942080c24e5b7cd1", size = 2037738 }, 175 | { url = "https://files.pythonhosted.org/packages/c8/f1/786d8fe78970a06f61df22cba58e365ce304bf9b9f46cc71c8c424e0c334/pydantic_core-2.27.2-cp313-cp313-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:eda3f5c2a021bbc5d976107bb302e0131351c2ba54343f8a496dc8783d3d3a6a", size = 2685138 }, 176 | { url = "https://files.pythonhosted.org/packages/a6/74/d12b2cd841d8724dc8ffb13fc5cef86566a53ed358103150209ecd5d1999/pydantic_core-2.27.2-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bd8086fa684c4775c27f03f062cbb9eaa6e17f064307e86b21b9e0abc9c0f02e", size = 1997025 }, 177 | { url = "https://files.pythonhosted.org/packages/a0/6e/940bcd631bc4d9a06c9539b51f070b66e8f370ed0933f392db6ff350d873/pydantic_core-2.27.2-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:8d9b3388db186ba0c099a6d20f0604a44eabdeef1777ddd94786cdae158729e4", size = 2004633 }, 178 | { url = "https://files.pythonhosted.org/packages/50/cc/a46b34f1708d82498c227d5d80ce615b2dd502ddcfd8376fc14a36655af1/pydantic_core-2.27.2-cp313-cp313-musllinux_1_1_aarch64.whl", hash = "sha256:7a66efda2387de898c8f38c0cf7f14fca0b51a8ef0b24bfea5849f1b3c95af27", size = 1999404 }, 179 | { url = "https://files.pythonhosted.org/packages/ca/2d/c365cfa930ed23bc58c41463bae347d1005537dc8db79e998af8ba28d35e/pydantic_core-2.27.2-cp313-cp313-musllinux_1_1_armv7l.whl", hash = "sha256:18a101c168e4e092ab40dbc2503bdc0f62010e95d292b27827871dc85450d7ee", size = 2130130 }, 180 | { url = "https://files.pythonhosted.org/packages/f4/d7/eb64d015c350b7cdb371145b54d96c919d4db516817f31cd1c650cae3b21/pydantic_core-2.27.2-cp313-cp313-musllinux_1_1_x86_64.whl", hash = "sha256:ba5dd002f88b78a4215ed2f8ddbdf85e8513382820ba15ad5ad8955ce0ca19a1", size = 2157946 }, 181 | { url = "https://files.pythonhosted.org/packages/a4/99/bddde3ddde76c03b65dfd5a66ab436c4e58ffc42927d4ff1198ffbf96f5f/pydantic_core-2.27.2-cp313-cp313-win32.whl", hash = "sha256:1ebaf1d0481914d004a573394f4be3a7616334be70261007e47c2a6fe7e50130", size = 1834387 }, 182 | { url = "https://files.pythonhosted.org/packages/71/47/82b5e846e01b26ac6f1893d3c5f9f3a2eb6ba79be26eef0b759b4fe72946/pydantic_core-2.27.2-cp313-cp313-win_amd64.whl", hash = "sha256:953101387ecf2f5652883208769a79e48db18c6df442568a0b5ccd8c2723abee", size = 1990453 }, 183 | { url = "https://files.pythonhosted.org/packages/51/b2/b2b50d5ecf21acf870190ae5d093602d95f66c9c31f9d5de6062eb329ad1/pydantic_core-2.27.2-cp313-cp313-win_arm64.whl", hash = "sha256:ac4dbfd1691affb8f48c2c13241a2e3b60ff23247cbcf981759c768b6633cf8b", size = 1885186 }, 184 | ] 185 | 186 | [[package]] 187 | name = "sniffio" 188 | version = "1.3.1" 189 | source = { registry = "https://pypi.org/simple" } 190 | sdist = { url = "https://files.pythonhosted.org/packages/a2/87/a6771e1546d97e7e041b6ae58d80074f81b7d5121207425c964ddf5cfdbd/sniffio-1.3.1.tar.gz", hash = "sha256:f4324edc670a0f49750a81b895f35c3adb843cca46f0530f79fc1babb23789dc", size = 20372 } 191 | wheels = [ 192 | { url = "https://files.pythonhosted.org/packages/e9/44/75a9c9421471a6c4805dbf2356f7c181a29c1879239abab1ea2cc8f38b40/sniffio-1.3.1-py3-none-any.whl", hash = "sha256:2f6da418d1f1e0fddd844478f41680e794e6051915791a034ff65e5f100525a2", size = 10235 }, 193 | ] 194 | 195 | [[package]] 196 | name = "sse-starlette" 197 | version = "2.2.1" 198 | source = { registry = "https://pypi.org/simple" } 199 | dependencies = [ 200 | { name = "anyio" }, 201 | { name = "starlette" }, 202 | ] 203 | sdist = { url = "https://files.pythonhosted.org/packages/71/a4/80d2a11af59fe75b48230846989e93979c892d3a20016b42bb44edb9e398/sse_starlette-2.2.1.tar.gz", hash = "sha256:54470d5f19274aeed6b2d473430b08b4b379ea851d953b11d7f1c4a2c118b419", size = 17376 } 204 | wheels = [ 205 | { url = "https://files.pythonhosted.org/packages/d9/e0/5b8bd393f27f4a62461c5cf2479c75a2cc2ffa330976f9f00f5f6e4f50eb/sse_starlette-2.2.1-py3-none-any.whl", hash = "sha256:6410a3d3ba0c89e7675d4c273a301d64649c03a5ef1ca101f10b47f895fd0e99", size = 10120 }, 206 | ] 207 | 208 | [[package]] 209 | name = "starlette" 210 | version = "0.45.1" 211 | source = { registry = "https://pypi.org/simple" } 212 | dependencies = [ 213 | { name = "anyio" }, 214 | ] 215 | sdist = { url = "https://files.pythonhosted.org/packages/c1/be/b398217eb35b356d2d9bb84ec67071ea2842e02950fcf38b33df9d5b24ba/starlette-0.45.1.tar.gz", hash = "sha256:a8ae1fa3b1ab7ca83a4abd77871921a13fb5aeaf4874436fb96c29dfcd4ecfa3", size = 2573953 } 216 | wheels = [ 217 | { url = "https://files.pythonhosted.org/packages/6b/2c/a50484b035ee0e13ebb7a42391e391befbfc1b6a9ad5503e83badd182ada/starlette-0.45.1-py3-none-any.whl", hash = "sha256:5656c0524f586e9148d9a3c1dd5257fb42a99892fb0dc6877dd76ef4d184aac3", size = 71488 }, 218 | ] 219 | 220 | [[package]] 221 | name = "typing-extensions" 222 | version = "4.12.2" 223 | source = { registry = "https://pypi.org/simple" } 224 | sdist = { url = "https://files.pythonhosted.org/packages/df/db/f35a00659bc03fec321ba8bce9420de607a1d37f8342eee1863174c69557/typing_extensions-4.12.2.tar.gz", hash = "sha256:1a7ead55c7e559dd4dee8856e3a88b41225abfe1ce8df57b7c13915fe121ffb8", size = 85321 } 225 | wheels = [ 226 | { url = "https://files.pythonhosted.org/packages/26/9f/ad63fc0248c5379346306f8668cda6e2e2e9c95e01216d2b8ffd9ff037d0/typing_extensions-4.12.2-py3-none-any.whl", hash = "sha256:04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d", size = 37438 }, 227 | ] 228 | --------------------------------------------------------------------------------