Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions packages/mcp-fastmcp/examples/delegated_access/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,22 +96,17 @@ Use the public URL from your tunnel as `MCP_SERVER_URL`.
### 2. Set Environment Variables

```bash
export KEYCARD_ZONE_ID="your-zone-id"
export KEYCARD_ZONE_ID="your-zone-id" # or use KEYCARD_ZONE_URL
export KEYCARD_CLIENT_ID="your-client-id"
export KEYCARD_CLIENT_SECRET="your-client-secret"
export MCP_SERVER_URL="https://your-tunnel-url.ngrok.io/" # Must be publicly reachable
```

### 3. Install Dependencies
### 3. Install Dependencies and Run the Server

```bash
cd packages/mcp-fastmcp/examples/delegated_access
uv sync
```

### 4. Run the Server

```bash
uv run python main.py
```

Expand Down Expand Up @@ -176,11 +171,14 @@ The example demonstrates comprehensive error handling patterns:

| Variable | Required | Description |
|----------|----------|-------------|
| `KEYCARD_ZONE_ID` | Yes | Your Keycard zone ID |
| `KEYCARD_ZONE_ID` | Yes* | Your Keycard zone ID |
| `KEYCARD_ZONE_URL` | Yes* | Your full Keycard zone URL (alternative to `KEYCARD_ZONE_ID`) |
| `KEYCARD_CLIENT_ID` | Yes | Client ID from application credentials |
| `KEYCARD_CLIENT_SECRET` | Yes | Client secret from application credentials |
| `MCP_SERVER_URL` | Yes | Server URL (must be publicly reachable for delegated access) |

\* Provide either `KEYCARD_ZONE_ID` or `KEYCARD_ZONE_URL`, not both.

## Learn More

- [Keycard Documentation](https://docs.keycard.ai)
Expand Down
2 changes: 1 addition & 1 deletion packages/mcp-fastmcp/examples/delegated_access/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from keycardai.mcp.integrations.fastmcp import AccessContext, AuthProvider, ClientSecret

# Configure Keycard authentication with client credentials for delegated access
# Get your zone_id and client credentials from console.keycard.ai
# Set KEYCARD_ZONE_ID (or KEYCARD_ZONE_URL) and client credentials from console.keycard.ai
auth_provider = AuthProvider(
zone_id=os.getenv("KEYCARD_ZONE_ID", "your-zone-id"),
mcp_server_name="GitHub API Server",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[project]
name = "delegated-access-example"
name = "delegated-access-fastmcp-example"
version = "0.1.0"
description = "GitHub API integration with Keycard delegated access using the @grant decorator"
readme = "README.md"
Expand Down
3 changes: 0 additions & 3 deletions packages/mcp-fastmcp/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ url = "https://test.pypi.org/simple/"
publish-url = "https://test.pypi.org/legacy/"
explicit = true

[tool.uv.sources]
keycardai-oauth = { workspace = true }
keycardai-mcp = { workspace = true }

[tool.hatch.build.targets.wheel]
packages = ["src/keycardai"]
Expand Down
2 changes: 1 addition & 1 deletion packages/mcp/examples/delegated_access/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[project]
name = "delegated-access-example"
name = "delegated-access-lowlevel-example"
version = "0.1.0"
description = "GitHub API integration with Keycard delegated access using the low-level MCP package"
readme = "README.md"
Expand Down
4 changes: 0 additions & 4 deletions packages/mcp/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,6 @@ url = "https://test.pypi.org/simple/"
publish-url = "https://test.pypi.org/legacy/"
explicit = true

[tool.uv.sources]
keycardai-oauth = { workspace = true }
keycardai-mcp-fastmcp = { workspace = true }

[tool.hatch.build.targets.wheel]
packages = ["src/keycardai"]

Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ Issues = "https://github.com/keycardai/python-sdk/issues"
[tool.uv.workspace]
members = [
".",
"packages/*"
"packages/*",
"packages/*/examples/*"
]
# Exclude any packages that shouldn't be part of the workspace
exclude = []
Expand Down
136 changes: 136 additions & 0 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading