diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..2c53173 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 Silverhand, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md index 259575c..9439015 100644 --- a/README.md +++ b/README.md @@ -1 +1,33 @@ # MCP Auth Python SDK + +[![GitHub branch check runs](https://img.shields.io/github/check-runs/mcp-auth/python/master)](https://github.com/mcp-auth/python/actions?query=branch%3Amaster) +[![codecov](https://codecov.io/gh/mcp-auth/python/graph/badge.svg?token=JXZ4C50SCV)](https://codecov.io/gh/mcp-auth/python) +[![Stable Version](https://img.shields.io/pypi/v/mcp-auth?label=stable)][PyPI Releases] +[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/mcp-auth)][PyPI] +[![PyPI - License](https://img.shields.io/pypi/l/mcp-auth)](https://github.com/mcp-auth/python/blob/master/LICENSE) + +[Website]: https://mcp-auth.dev/ +[PyPI]: https://pypi.org/project/mcp-auth/ +[PyPI Releases]: https://pypi.org/project/mcp-auth/#history + +The MCP specification [requires OAuth 2.1 and other RFCs](https://modelcontextprotocol.io/specification/2025-03-26/basic/authorization) to be implemented for authorization. MCP Auth aims to connect your MCP server to **any** compatible OAuth 2 or OpenID Connect provider, without spending hours on lengthy implementations. + +## Get started + +### Is my provider supported? + +Check out the [MCP-compatible providers](https://mcp-auth.dev/docs/providers-list) to see which providers are supported. It also includes a tool for real-time checking of provider compatibility. + +### Installation + +```bash +pip install mcp-auth +``` + +Or use your package manager of choice, such as `poetry` or `uv`. + +See [the documentation](https://mcp-auth.dev/docs/get-started) for the full guide. + +## Join the discussion + +Join the [MCP Auth org discussion](https://github.com/orgs/mcp-auth/discussions) to ask questions or share your feedback. diff --git a/pyproject.toml b/pyproject.toml index 7f85002..d623074 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,17 +1,19 @@ [project] name = "mcpauth" version = "0.0.0" -description = "Connect your MCP server to any eligible OAuth 2 or OpenID Connect provider" +description = "Plug-and-play auth for Python MCP servers." authors = [{ name = "Silverhand Inc.", email = "contact@silverhand.io" }] readme = "README.md" requires-python = ">=3.9" -license = { text = "MIT" } +license = "MIT" keywords = [ "authentication", "authorization", "mcp", + "modelcontextprotocol", "oauth2", "openid-connect", + "oidc", ] dependencies = [ "pydantic>=2.11.3", @@ -38,3 +40,6 @@ dev = [ [tool.coverage.run] branch = true source = ["mcpauth"] + +[tool.setuptools] +packages = ["mcpauth"] diff --git a/samples/server/starlette.py b/samples/server/starlette.py index 46d2303..340b613 100644 --- a/samples/server/starlette.py +++ b/samples/server/starlette.py @@ -6,11 +6,14 @@ from starlette.middleware import Middleware from starlette.responses import JSONResponse from starlette.requests import Request +import os + +MCP_AUTH_ISSUER = ( + os.getenv("MCP_AUTH_ISSUER") or "https://replace-with-your-issuer-url.com" +) mcpAuth = MCPAuth( - MCPAuthConfig( - server=fetch_server_config("https://auth.logto.io/oidc", AuthServerType.OIDC) - ) + MCPAuthConfig(server=fetch_server_config(MCP_AUTH_ISSUER, AuthServerType.OIDC)) ) protected_app = Starlette(