Skip to content

Commit 6afa87f

Browse files
authored
Merge pull request #93 from keycardai/larry/fix-example-workspace-members
fix: add examples as workspace members for standalone execution
2 parents a8d50b9 + 81ff861 commit 6afa87f

8 files changed

Lines changed: 147 additions & 19 deletions

File tree

packages/mcp-fastmcp/examples/delegated_access/README.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,22 +96,17 @@ Use the public URL from your tunnel as `MCP_SERVER_URL`.
9696
### 2. Set Environment Variables
9797

9898
```bash
99-
export KEYCARD_ZONE_ID="your-zone-id"
99+
export KEYCARD_ZONE_ID="your-zone-id" # or use KEYCARD_ZONE_URL
100100
export KEYCARD_CLIENT_ID="your-client-id"
101101
export KEYCARD_CLIENT_SECRET="your-client-secret"
102102
export MCP_SERVER_URL="https://your-tunnel-url.ngrok.io/" # Must be publicly reachable
103103
```
104104

105-
### 3. Install Dependencies
105+
### 3. Install Dependencies and Run the Server
106106

107107
```bash
108108
cd packages/mcp-fastmcp/examples/delegated_access
109109
uv sync
110-
```
111-
112-
### 4. Run the Server
113-
114-
```bash
115110
uv run python main.py
116111
```
117112

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

177172
| Variable | Required | Description |
178173
|----------|----------|-------------|
179-
| `KEYCARD_ZONE_ID` | Yes | Your Keycard zone ID |
174+
| `KEYCARD_ZONE_ID` | Yes* | Your Keycard zone ID |
175+
| `KEYCARD_ZONE_URL` | Yes* | Your full Keycard zone URL (alternative to `KEYCARD_ZONE_ID`) |
180176
| `KEYCARD_CLIENT_ID` | Yes | Client ID from application credentials |
181177
| `KEYCARD_CLIENT_SECRET` | Yes | Client secret from application credentials |
182178
| `MCP_SERVER_URL` | Yes | Server URL (must be publicly reachable for delegated access) |
183179

180+
\* Provide either `KEYCARD_ZONE_ID` or `KEYCARD_ZONE_URL`, not both.
181+
184182
## Learn More
185183

186184
- [Keycard Documentation](https://docs.keycard.ai)

packages/mcp-fastmcp/examples/delegated_access/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from keycardai.mcp.integrations.fastmcp import AccessContext, AuthProvider, ClientSecret
2020

2121
# Configure Keycard authentication with client credentials for delegated access
22-
# Get your zone_id and client credentials from console.keycard.ai
22+
# Set KEYCARD_ZONE_ID (or KEYCARD_ZONE_URL) and client credentials from console.keycard.ai
2323
auth_provider = AuthProvider(
2424
zone_id=os.getenv("KEYCARD_ZONE_ID", "your-zone-id"),
2525
mcp_server_name="GitHub API Server",

packages/mcp-fastmcp/examples/delegated_access/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[project]
2-
name = "delegated-access-example"
2+
name = "delegated-access-fastmcp-example"
33
version = "0.1.0"
44
description = "GitHub API integration with Keycard delegated access using the @grant decorator"
55
readme = "README.md"

packages/mcp-fastmcp/pyproject.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,6 @@ url = "https://test.pypi.org/simple/"
6161
publish-url = "https://test.pypi.org/legacy/"
6262
explicit = true
6363

64-
[tool.uv.sources]
65-
keycardai-oauth = { workspace = true }
66-
keycardai-mcp = { workspace = true }
6764

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

packages/mcp/examples/delegated_access/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[project]
2-
name = "delegated-access-example"
2+
name = "delegated-access-lowlevel-example"
33
version = "0.1.0"
44
description = "GitHub API integration with Keycard delegated access using the low-level MCP package"
55
readme = "README.md"

packages/mcp/pyproject.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,6 @@ url = "https://test.pypi.org/simple/"
7979
publish-url = "https://test.pypi.org/legacy/"
8080
explicit = true
8181

82-
[tool.uv.sources]
83-
keycardai-oauth = { workspace = true }
84-
keycardai-mcp-fastmcp = { workspace = true }
85-
8682
[tool.hatch.build.targets.wheel]
8783
packages = ["src/keycardai"]
8884

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ Issues = "https://github.com/keycardai/python-sdk/issues"
5151
[tool.uv.workspace]
5252
members = [
5353
".",
54-
"packages/*"
54+
"packages/*",
55+
"packages/*/examples/*"
5556
]
5657
# Exclude any packages that shouldn't be part of the workspace
5758
exclude = []

uv.lock

Lines changed: 136 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)