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
2 changes: 1 addition & 1 deletion .github/workflows/scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
run: npx @anthropic-ai/mcpb pack

- name: Run MTF scanner
run: uvx mpak-scanner scan *.mcpb --json > scan-results.json
run: uvx mpak-scanner scan *.mcpb --json -o scan-results.json

- name: Check for critical/high findings
run: |
Expand Down
1 change: 1 addition & 0 deletions .mcpbignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ __pycache__/
/build/
/dist/
/tests/
/tests-integration/
/test/
/e2e/
/examples/
Expand Down
11 changes: 11 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,16 @@
"EXAMPLE_API_KEY": "${user_config.api_key}"
}
}
},
"_meta": {
"org.mpaktrust": {
"permissions": {
"filesystem": "read",
"network": "outbound",
"environment": "read",
"subprocess": "none",
"native": "none"
}
}
}
}
12 changes: 6 additions & 6 deletions src/mcp_example/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@
_client: ExampleClient | None = None


def get_client(ctx: Context | None = None) -> ExampleClient:
async def get_client(ctx: Context | None = None) -> ExampleClient:
"""Get or create the API client instance."""
global _client
if _client is None:
api_key = os.environ.get("EXAMPLE_API_KEY")
if not api_key:
msg = "EXAMPLE_API_KEY environment variable is required"
if ctx:
ctx.error(msg)
await ctx.error(msg)
raise ValueError(msg)
_client = ExampleClient(api_key=api_key)
return _client
Expand Down Expand Up @@ -87,12 +87,12 @@ async def list_items(
Returns:
List of items
"""
client = get_client(ctx)
client = await get_client(ctx)
try:
return await client.list_items(limit=limit)
except ExampleAPIError as e:
if ctx:
ctx.error(f"API error: {e.message}")
await ctx.error(f"API error: {e.message}")
raise


Expand All @@ -110,12 +110,12 @@ async def get_item(
Returns:
Item details
"""
client = get_client(ctx)
client = await get_client(ctx)
try:
return await client.get_item(item_id)
except ExampleAPIError as e:
if ctx:
ctx.error(f"API error: {e.message}")
await ctx.error(f"API error: {e.message}")
raise


Expand Down
Loading