Authed MCP Integration
This package provides integration between Authed authentication and the Model Context Protocol (MCP).
Overview
The Authed MCP integration allows you to:
- Create MCP servers with Authed authentication
- Create MCP clients that can authenticate with Authed
- Connect to pure MCP servers without Authed authentication (optional)
- Accept connections from pure MCP clients without Authed authentication (optional)
Installation
pip install authed-mcp
Quick Start
Server Setup
from authed import Authed
from mcp.server.fastmcp import FastMCP
from authed_mcp import AuthedMiddleware
from starlette.applications import Starlette
# Initialize Authed SDK
authed = Authed.initialize(
registry_url=os.getenv("AUTHED_REGISTRY_URL"),
agent_id=os.getenv("AUTHED_AGENT_ID"),
agent_secret=os.getenv("AUTHED_AGENT_SECRET"),
private_key=os.getenv("AUTHED_PRIVATE_KEY"),
public_key=os.getenv("AUTHED_PUBLIC_KEY")
)
# Create MCP server with Authed protection
app = Starlette(
middleware=[
Middleware(
AuthedMiddleware,
authed=authed,
# If True, all requests must be authenticated using Authed
# If False, allows unauthenticated requests
require_auth=True,
# Enable debug logging for authentication
debug=True
)
]
)
Client Setup
from authed import Authed
from mcp import ClientSession
from authed_mcp import get_auth_headers
# Initialize client
authed = Authed.initialize(
registry_url=os.getenv("AUTHED_REGISTRY_URL"),
agent_id=os.getenv("AUTHED_AGENT_ID"),
agent_secret=os.getenv("AUTHED_AGENT_SECRET"),
private_key=os.getenv("AUTHED_PRIVATE_KEY"),
public_key=os.getenv("AUTHED_PUBLIC_KEY")
)
# Connect with authentication
headers = await get_auth_headers(
authed=authed,
url="http://localhost:8000/sse",
method="GET",
# The agent ID of the server you're connecting to
# This must be different from your client's agent_id
target_agent_id=os.getenv("TARGET_AGENT_ID"),
# If True, allows connection to pure MCP servers without Authed authentication
# If False, requires the server to support Authed authentication
fallback=False,
# Enable debug logging for authentication
debug=True
)
Examples
Check out the examples directory for complete working examples:
examples/server/- Example MCP server with Authed authenticationexamples/client/- Example MCP client that connects to the server
Contributing
Contributions are welcome! Please check out our Contributing Guide.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Metadata
Release files for authed-mcp 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| authed_mcp-0.2.0.tar.gz | 5.2 kB | Without provenance | Details for authed_mcp-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| authed_mcp-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for authed_mcp-0.2.0-py3-none-any.whl |
Total release size: 10.8 kB
Release files / authed_mcp-0.2.0.tar.gz
| Download URL | authed_mcp-0.2.0.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5c96d2593efc9a7a509654921976b97b8807b6e559a959773dc22fc6878ac59c
|
|
BLAKE2b-256 checksum How to use checksums |
769beaa9cc6340e33464d1aad6e6e5aaf15227c2e0745aa9417e7e4ca96a3fe5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.6
|
Release files / authed_mcp-0.2.0-py3-none-any.whl
| Download URL | authed_mcp-0.2.0-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6585f938607c6867d4e65b86e4435541473a535c50ac357ef500bca3a5bf32aa
|
|
BLAKE2b-256 checksum How to use checksums |
7ab3afc294205a8e82d1c8a20105cd3e0ee9cd7bc52495c456119b0c2f32b426
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.6
|
Security for authed-mcp 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.