Skip to content

Commit d7dc77d

Browse files
committed
fix types in demos
includes demos in typechecks, and fixes all the types
1 parent df9a8db commit d7dc77d

58 files changed

Lines changed: 16972 additions & 5961 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.changeset/ripe-spoons-peel.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"ai-gateway-provider": patch
3+
---
4+
5+
agp: add keywords

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ trim_trailing_whitespace = false
1313

1414
[*.{js,jsx,ts,tsx,json,css,html}]
1515
indent_style = tab
16-
indent_size = 4
16+
indent_size = 2
1717

1818
[*.{yml,yaml}]
1919
indent_style = space

demos/mcp-client/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,17 @@
55
"scripts": {
66
"start": "vite dev",
77
"build": "vite build",
8-
"deploy": "npx wrangler deploy --var HOST:$(./get-subdomain.sh)"
8+
"deploy": "npx wrangler deploy --var HOST:$(./get-subdomain.sh)",
9+
"type-check": "tsc --noEmit"
910
},
1011
"keywords": [],
1112
"author": "",
1213
"dependencies": {
1314
"@cloudflare/vite-plugin": "^1.1.1",
15+
"@cloudflare/workers-types": "^4.20250509.0",
1416
"@modelcontextprotocol/sdk": "^1.11.1",
17+
"@types/react": "^19.1.3",
18+
"@types/react-dom": "^19.1.3",
1519
"@vitejs/plugin-react": "^4.4.1",
1620
"agents": "^0.0.88",
1721
"nanoid": "^5.1.5",

demos/mcp-server-bearer-auth/package-lock.json

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

demos/mcp-server-bearer-auth/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"format": "biome format --write",
99
"lint:fix": "biome lint --fix",
1010
"start": "wrangler dev",
11-
"cf-typegen": "wrangler types"
11+
"cf-typegen": "wrangler types",
12+
"type-check": "tsc --noEmit"
1213
},
1314
"devDependencies": {
1415
"marked": "^15.0.11",

demos/mcp-server-bearer-auth/src/index.ts

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@ import { z } from "zod";
44
import { Hono } from "hono";
55
import { layout, homeContent } from "./utils";
66

7-
type Bindings = Env;
8-
97
const app = new Hono<{
10-
Bindings: Bindings;
8+
Bindings: Env;
119
}>();
1210

1311
type Props = {
@@ -16,21 +14,30 @@ type Props = {
1614

1715
type State = null;
1816

19-
export class MyMCP extends McpAgent<Bindings, State, Props> {
17+
export class MyMCP extends McpAgent<Env, State, Props> {
2018
server = new McpServer({
2119
name: "Demo",
2220
version: "1.0.0",
2321
});
2422

2523
async init() {
26-
this.server.tool("add", { a: z.number(), b: z.number() }, async ({ a, b }) => ({
27-
content: [{ type: "text", text: String(a + b) }],
28-
}));
24+
this.server.tool(
25+
"add",
26+
{ a: z.number(), b: z.number() },
27+
async ({ a, b }) => ({
28+
content: [{ type: "text", text: String(a + b) }],
29+
})
30+
);
2931

3032
// Tool that returns the user's bearer token
3133
// This is just for demonstration purposes, don't actually create a tool that does this!
3234
this.server.tool("getToken", {}, async () => ({
33-
content: [{ type: "text", text: String(`User's token: ${this.props.bearerToken}`) }],
35+
content: [
36+
{
37+
type: "text",
38+
text: String(`User's token: ${this.props.bearerToken}`),
39+
},
40+
],
3441
}));
3542
}
3643
}

0 commit comments

Comments
 (0)