@kya-os/create-mcpi-app 0.6.4-canary.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.cjs +10 -0
- package/.turbo/turbo-build.log +25 -0
- package/README.md +290 -0
- package/dist/bundles/blank.js +98817 -0
- package/dist/bundles/ecommerce.js +98891 -0
- package/dist/bundles/hardware-world.js +99289 -0
- package/dist/bundles/manifest.json +23 -0
- package/dist/cli-runner.d.ts +2 -0
- package/dist/cli-runner.d.ts.map +1 -0
- package/dist/cli-runner.js +407 -0
- package/dist/cli-runner.js.map +1 -0
- package/dist/effects/index.d.ts +14 -0
- package/dist/effects/index.d.ts.map +1 -0
- package/dist/effects/index.js +51 -0
- package/dist/effects/index.js.map +1 -0
- package/dist/helpers/apply-identity-preset.d.ts +14 -0
- package/dist/helpers/apply-identity-preset.d.ts.map +1 -0
- package/dist/helpers/apply-identity-preset.js +169 -0
- package/dist/helpers/apply-identity-preset.js.map +1 -0
- package/dist/helpers/config-builder.d.ts +53 -0
- package/dist/helpers/config-builder.d.ts.map +1 -0
- package/dist/helpers/config-builder.js +46 -0
- package/dist/helpers/config-builder.js.map +1 -0
- package/dist/helpers/copy-template.d.ts +2 -0
- package/dist/helpers/copy-template.d.ts.map +1 -0
- package/dist/helpers/copy-template.js +11 -0
- package/dist/helpers/copy-template.js.map +1 -0
- package/dist/helpers/create.d.ts +31 -0
- package/dist/helpers/create.d.ts.map +1 -0
- package/dist/helpers/create.js +136 -0
- package/dist/helpers/create.js.map +1 -0
- package/dist/helpers/fetch-cloudflare-mcpi-template.d.ts +25 -0
- package/dist/helpers/fetch-cloudflare-mcpi-template.d.ts.map +1 -0
- package/dist/helpers/fetch-cloudflare-mcpi-template.js +558 -0
- package/dist/helpers/fetch-cloudflare-mcpi-template.js.map +1 -0
- package/dist/helpers/fetch-cloudflare-template.d.ts +11 -0
- package/dist/helpers/fetch-cloudflare-template.d.ts.map +1 -0
- package/dist/helpers/fetch-cloudflare-template.js +338 -0
- package/dist/helpers/fetch-cloudflare-template.js.map +1 -0
- package/dist/helpers/fetch-mcpi-template.d.ts +13 -0
- package/dist/helpers/fetch-mcpi-template.d.ts.map +1 -0
- package/dist/helpers/fetch-mcpi-template.js +237 -0
- package/dist/helpers/fetch-mcpi-template.js.map +1 -0
- package/dist/helpers/fetch-xmcp-template.d.ts +13 -0
- package/dist/helpers/fetch-xmcp-template.d.ts.map +1 -0
- package/dist/helpers/fetch-xmcp-template.js +127 -0
- package/dist/helpers/fetch-xmcp-template.js.map +1 -0
- package/dist/helpers/generate-cloudflare-files.d.ts +89 -0
- package/dist/helpers/generate-cloudflare-files.d.ts.map +1 -0
- package/dist/helpers/generate-cloudflare-files.js +1541 -0
- package/dist/helpers/generate-cloudflare-files.js.map +1 -0
- package/dist/helpers/generate-config.d.ts +2 -0
- package/dist/helpers/generate-config.d.ts.map +1 -0
- package/dist/helpers/generate-config.js +105 -0
- package/dist/helpers/generate-config.js.map +1 -0
- package/dist/helpers/generate-identity.d.ts +38 -0
- package/dist/helpers/generate-identity.d.ts.map +1 -0
- package/dist/helpers/generate-identity.js +123 -0
- package/dist/helpers/generate-identity.js.map +1 -0
- package/dist/helpers/get-package-versions.d.ts +37 -0
- package/dist/helpers/get-package-versions.d.ts.map +1 -0
- package/dist/helpers/get-package-versions.js +92 -0
- package/dist/helpers/get-package-versions.js.map +1 -0
- package/dist/helpers/identity-manager.d.ts +23 -0
- package/dist/helpers/identity-manager.d.ts.map +1 -0
- package/dist/helpers/identity-manager.js +144 -0
- package/dist/helpers/identity-manager.js.map +1 -0
- package/dist/helpers/index.d.ts +14 -0
- package/dist/helpers/index.d.ts.map +1 -0
- package/dist/helpers/index.js +18 -0
- package/dist/helpers/index.js.map +1 -0
- package/dist/helpers/install.d.ts +3 -0
- package/dist/helpers/install.d.ts.map +1 -0
- package/dist/helpers/install.js +57 -0
- package/dist/helpers/install.js.map +1 -0
- package/dist/helpers/kta-registration.d.ts +58 -0
- package/dist/helpers/kta-registration.d.ts.map +1 -0
- package/dist/helpers/kta-registration.js +77 -0
- package/dist/helpers/kta-registration.js.map +1 -0
- package/dist/helpers/rename.d.ts +2 -0
- package/dist/helpers/rename.d.ts.map +1 -0
- package/dist/helpers/rename.js +15 -0
- package/dist/helpers/rename.js.map +1 -0
- package/dist/helpers/validate-project-structure.d.ts +14 -0
- package/dist/helpers/validate-project-structure.d.ts.map +1 -0
- package/dist/helpers/validate-project-structure.js +102 -0
- package/dist/helpers/validate-project-structure.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/utils/check-node.d.ts +2 -0
- package/dist/utils/check-node.d.ts.map +1 -0
- package/dist/utils/check-node.js +12 -0
- package/dist/utils/check-node.js.map +1 -0
- package/dist/utils/fetch-remote-config.d.ts +74 -0
- package/dist/utils/fetch-remote-config.d.ts.map +1 -0
- package/dist/utils/fetch-remote-config.js +109 -0
- package/dist/utils/fetch-remote-config.js.map +1 -0
- package/dist/utils/is-folder-empty.d.ts +2 -0
- package/dist/utils/is-folder-empty.d.ts.map +1 -0
- package/dist/utils/is-folder-empty.js +55 -0
- package/dist/utils/is-folder-empty.js.map +1 -0
- package/dist/utils/validate-project-name.d.ts +15 -0
- package/dist/utils/validate-project-name.d.ts.map +1 -0
- package/dist/utils/validate-project-name.js +106 -0
- package/dist/utils/validate-project-name.js.map +1 -0
- package/index.js +4 -0
- package/package.json +73 -0
- package/vitest.integration.config.ts +16 -0
|
@@ -0,0 +1,558 @@
|
|
|
1
|
+
import fs from "fs-extra";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
import { spawn } from "child_process";
|
|
5
|
+
import crypto from "crypto";
|
|
6
|
+
import { generateIdentity } from "./generate-identity.js";
|
|
7
|
+
import { registerWithKTA, createKTARegistration, } from "./kta-registration.js";
|
|
8
|
+
import { getPackageVersions } from "./get-package-versions.js";
|
|
9
|
+
/**
|
|
10
|
+
* Fetches the Cloudflare MCP-I template
|
|
11
|
+
*
|
|
12
|
+
* Generates a complete project structure:
|
|
13
|
+
* - package.json with all scripts
|
|
14
|
+
* - wrangler.toml with all KV namespaces configured
|
|
15
|
+
* - .dev.vars with all secrets
|
|
16
|
+
* - src/index.ts
|
|
17
|
+
* - src/agent.ts
|
|
18
|
+
* - src/tools/greet.ts
|
|
19
|
+
* - src/mcpi-runtime-config.ts
|
|
20
|
+
* - KV namespaces auto-provisioned by Wrangler v4 on first deploy
|
|
21
|
+
*/
|
|
22
|
+
export async function fetchCloudflareMcpiTemplate(targetDir, options) {
|
|
23
|
+
// Handle legacy string argument (projectName) for backward compatibility
|
|
24
|
+
const opts = typeof options === "string"
|
|
25
|
+
? { packageManager: "npm", projectName: options }
|
|
26
|
+
: options;
|
|
27
|
+
// Extract project name from path if not provided
|
|
28
|
+
let projectName = opts.projectName;
|
|
29
|
+
if (!projectName) {
|
|
30
|
+
const pathParts = targetDir.split(path.sep);
|
|
31
|
+
projectName = pathParts[pathParts.length - 1] || "worker";
|
|
32
|
+
}
|
|
33
|
+
const { apikey, projectId, packageManager, skipCommands, register } = opts;
|
|
34
|
+
const projectNameUpper = projectName.toUpperCase().replace(/-/g, "_");
|
|
35
|
+
// Get package versions from scaffolder's package.json (single source of truth)
|
|
36
|
+
// This ensures scaffolded projects use tested, consistent versions
|
|
37
|
+
const versions = await getPackageVersions();
|
|
38
|
+
// Extract exact version (without caret) for template dependencies
|
|
39
|
+
// Templates use exact versions to ensure users get the tested version
|
|
40
|
+
const mcpICloudflareVersion = versions["@kya-os/mcp-i-cloudflare"].replace(/^[\^~]/, "");
|
|
41
|
+
// Unified KV binding name (matches env-mapper.ts UNIFIED_KV_BINDING_NAME)
|
|
42
|
+
// A single KV namespace per project instead of 5 individual ones.
|
|
43
|
+
const UNIFIED_KV_BINDING = "MCPI_KV";
|
|
44
|
+
console.log(chalk.blue(`\nšļø Generating Cloudflare MCP-I project: ${projectName}...`));
|
|
45
|
+
// 1. Create directory structure
|
|
46
|
+
await fs.ensureDir(path.join(targetDir, "src"));
|
|
47
|
+
await fs.ensureDir(path.join(targetDir, "src/tools"));
|
|
48
|
+
// 2. Generate Identity (Keys & DID)
|
|
49
|
+
let identity;
|
|
50
|
+
if (opts.skipIdentity) {
|
|
51
|
+
// Use a mock identity when skipping generation
|
|
52
|
+
identity = {
|
|
53
|
+
did: "did:key:zTestMockIdentity",
|
|
54
|
+
kid: "did:key:zTestMockIdentity#key-1",
|
|
55
|
+
privateKey: "mock-private-key",
|
|
56
|
+
publicKey: "mock-public-key",
|
|
57
|
+
createdAt: new Date().toISOString(),
|
|
58
|
+
type: "development",
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
console.log(chalk.blue("š Generating cryptographic identity..."));
|
|
63
|
+
identity = await generateIdentity();
|
|
64
|
+
}
|
|
65
|
+
// 2.5. Register with Know That AI if requested
|
|
66
|
+
let ktaRegistration;
|
|
67
|
+
if (register && !opts.skipIdentity) {
|
|
68
|
+
console.log(chalk.blue("š Registering with Know That AI..."));
|
|
69
|
+
try {
|
|
70
|
+
const registrationResult = await registerWithKTA({
|
|
71
|
+
name: projectName,
|
|
72
|
+
publicKey: identity.publicKey,
|
|
73
|
+
did: identity.did,
|
|
74
|
+
});
|
|
75
|
+
if (registrationResult.success) {
|
|
76
|
+
ktaRegistration = createKTARegistration(registrationResult.claimUrl ?? null);
|
|
77
|
+
console.log(chalk.green("ā
Agent registered with Know That AI"));
|
|
78
|
+
if (registrationResult.claimUrl) {
|
|
79
|
+
console.log(chalk.cyan(` š Claim URL: ${registrationResult.claimUrl}`));
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
console.log(chalk.dim(" (Shadow registration - did:key agent)"));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
console.log(chalk.yellow(`ā ļø Registration failed: ${registrationResult.error}`));
|
|
87
|
+
console.log(chalk.dim(" You can register later using: mcpi register"));
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
console.log(chalk.yellow(`ā ļø Registration failed: ${error instanceof Error ? error.message : "Unknown error"}`));
|
|
92
|
+
console.log(chalk.dim(" You can register later using: mcpi register"));
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
// 3. Create package.json with all scripts
|
|
96
|
+
const packageJson = {
|
|
97
|
+
name: projectName,
|
|
98
|
+
version: "0.1.0",
|
|
99
|
+
private: true,
|
|
100
|
+
scripts: {
|
|
101
|
+
deploy: "wrangler deploy",
|
|
102
|
+
dev: "wrangler dev",
|
|
103
|
+
start: "wrangler dev",
|
|
104
|
+
test: "vitest",
|
|
105
|
+
"cf-typegen": "wrangler types",
|
|
106
|
+
},
|
|
107
|
+
dependencies: {
|
|
108
|
+
"@kya-os/mcp-i-cloudflare": mcpICloudflareVersion,
|
|
109
|
+
"@modelcontextprotocol/sdk": "1.24.0",
|
|
110
|
+
agents: "0.2.30",
|
|
111
|
+
hono: "4.11.7",
|
|
112
|
+
},
|
|
113
|
+
devDependencies: {
|
|
114
|
+
"@cloudflare/vitest-pool-workers": "0.5.41",
|
|
115
|
+
"@cloudflare/workers-types": "4.20251126.0",
|
|
116
|
+
"@types/node": "20.8.3",
|
|
117
|
+
typescript: "5.5.2",
|
|
118
|
+
vitest: "2.0.5",
|
|
119
|
+
wrangler: "4.53.0",
|
|
120
|
+
},
|
|
121
|
+
};
|
|
122
|
+
await fs.writeJson(path.join(targetDir, "package.json"), packageJson, {
|
|
123
|
+
spaces: 2,
|
|
124
|
+
});
|
|
125
|
+
// 4. Create .dev.vars with ALL secrets
|
|
126
|
+
// Generate OAuth encryption secret (32+ characters)
|
|
127
|
+
const oauthEncryptionSecret = crypto.randomBytes(32).toString("hex");
|
|
128
|
+
const devVarsContent = `# Secrets for local development
|
|
129
|
+
# Generated by create-mcpi-app
|
|
130
|
+
|
|
131
|
+
# Agent Identity (DO NOT COMMIT THIS FILE)
|
|
132
|
+
MCP_IDENTITY_PRIVATE_KEY="${identity.privateKey}"
|
|
133
|
+
|
|
134
|
+
# OAuth Encryption Secret (required for OAuth/delegation flows)
|
|
135
|
+
# Used to encrypt OAuth state parameters for secure token exchange
|
|
136
|
+
OAUTH_ENCRYPTION_SECRET="${oauthEncryptionSecret}"
|
|
137
|
+
|
|
138
|
+
# AgentShield Configuration
|
|
139
|
+
${apikey ? `AGENTSHIELD_API_KEY="${apikey}"` : '# AGENTSHIELD_API_KEY="sk_YOUR_API_KEY_HERE"'}
|
|
140
|
+
|
|
141
|
+
# Admin API Key for cache management
|
|
142
|
+
# Uses the same key as AGENTSHIELD_API_KEY for convenience
|
|
143
|
+
# You can change this to a different key if you need separate admin access
|
|
144
|
+
${apikey ? `ADMIN_API_KEY="${apikey}"` : '# ADMIN_API_KEY="sk_YOUR_ADMIN_KEY_HERE"'}
|
|
145
|
+
`;
|
|
146
|
+
await fs.outputFile(path.join(targetDir, ".dev.vars"), devVarsContent);
|
|
147
|
+
// Helper function to escape JSON string for TOML basic string (double-quoted)
|
|
148
|
+
// TOML basic strings require escaping for: backslash (\), double quote ("), and control chars
|
|
149
|
+
const escapeForTOMLBasicString = (jsonStr) => {
|
|
150
|
+
return jsonStr
|
|
151
|
+
.replace(/\\/g, "\\\\") // Escape backslashes first
|
|
152
|
+
.replace(/"/g, '\\"'); // Escape double quotes
|
|
153
|
+
};
|
|
154
|
+
// 5. Create wrangler.toml with unified KV namespace (auto-provisioned)
|
|
155
|
+
const wranglerToml = `#:schema node_modules/wrangler/config-schema.json
|
|
156
|
+
name = "${projectName}"
|
|
157
|
+
main = "src/index.ts"
|
|
158
|
+
compatibility_date = "2025-01-01"
|
|
159
|
+
compatibility_flags = ["nodejs_compat"]
|
|
160
|
+
|
|
161
|
+
# Durable Object binding for MCP Agent state
|
|
162
|
+
[[durable_objects.bindings]]
|
|
163
|
+
name = "MCP_OBJECT"
|
|
164
|
+
class_name = "${toPascalCase(projectName)}MCP"
|
|
165
|
+
|
|
166
|
+
[[migrations]]
|
|
167
|
+
tag = "v1"
|
|
168
|
+
# Use new_sqlite_classes instead of new_classes - required by agents package for SQL storage
|
|
169
|
+
new_sqlite_classes = ["${toPascalCase(projectName)}MCP"]
|
|
170
|
+
|
|
171
|
+
# Cron trigger for proof batch queue flushing (OPTIONAL - CURRENTLY DISABLED)
|
|
172
|
+
#
|
|
173
|
+
# NOTE: Cloudflare Workers cron triggers are currently experiencing API parsing issues
|
|
174
|
+
# that prevent deployment. This section is commented out by default.
|
|
175
|
+
#
|
|
176
|
+
# Proofs will still work correctly without cron because:
|
|
177
|
+
# 1. First proof submits immediately (for dashboard setup detection)
|
|
178
|
+
# 2. Proofs auto-flush when batch size is reached (default: 10 proofs)
|
|
179
|
+
#
|
|
180
|
+
# If you want to enable cron-based flushing in the future:
|
|
181
|
+
# 1. Uncomment the section below
|
|
182
|
+
# 2. Adjust the schedule as needed (cron format: minute hour day month weekday)
|
|
183
|
+
# 3. Try deploying - if it fails with "Could not parse request body", cron triggers
|
|
184
|
+
# may not be supported for your account/region yet
|
|
185
|
+
#
|
|
186
|
+
# [[triggers.crons]]
|
|
187
|
+
# cron = "*/5 * * * *" # Every 5 minutes
|
|
188
|
+
#
|
|
189
|
+
# Note: Proofs are also flushed immediately when batch size is reached (default: 10 proofs),
|
|
190
|
+
# so cron is mainly for flushing small batches that haven't reached the size limit yet.
|
|
191
|
+
|
|
192
|
+
# āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
193
|
+
# KV NAMESPACE - Unified single namespace, auto-provisioned by Wrangler v4.45+
|
|
194
|
+
# āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
195
|
+
#
|
|
196
|
+
# One KV namespace handles all MCP-I storage (nonces, proofs, identity,
|
|
197
|
+
# delegations, tool protection). Key prefixes are naturally unique across
|
|
198
|
+
# all logical namespaces so there is zero collision risk.
|
|
199
|
+
#
|
|
200
|
+
# Just run: npm run deploy (KV namespace is created automatically!)
|
|
201
|
+
#
|
|
202
|
+
# āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
|
|
203
|
+
|
|
204
|
+
[[kv_namespaces]]
|
|
205
|
+
binding = "${projectNameUpper}_${UNIFIED_KV_BINDING}"
|
|
206
|
+
|
|
207
|
+
[vars]
|
|
208
|
+
# Agent DID (public identifier - safe to commit)
|
|
209
|
+
MCP_IDENTITY_AGENT_DID = "${identity.did}"
|
|
210
|
+
|
|
211
|
+
# Public identity key (safe to commit - not sensitive)
|
|
212
|
+
MCP_IDENTITY_PUBLIC_KEY = "${identity.publicKey}"
|
|
213
|
+
|
|
214
|
+
# Know That AI Registration (reputation tracking)
|
|
215
|
+
# Stored as JSON for ProofService compatibility with identity.kta structure
|
|
216
|
+
${ktaRegistration ? `KTA_REGISTRATION = "${escapeForTOMLBasicString(JSON.stringify(ktaRegistration))}"` : '# KTA_REGISTRATION = "{\\"registered\\":true,\\"registeredAt\\":\\"...\",\\"claimUrl\\":\\"...\\"}" # Run: mcpi register'}
|
|
217
|
+
|
|
218
|
+
# Private identity key (SECRET - NOT declared here)
|
|
219
|
+
# For local development: Add to .dev.vars file
|
|
220
|
+
# For production: Use wrangler secret put MCP_IDENTITY_PRIVATE_KEY
|
|
221
|
+
|
|
222
|
+
# ALLOWED_ORIGINS for CORS (update for production)
|
|
223
|
+
ALLOWED_ORIGINS = "https://claude.ai,https://app.anthropic.com"
|
|
224
|
+
|
|
225
|
+
# DO routing strategy: "singleton" (recommended), "session" for isolation, "shard" for high-load
|
|
226
|
+
DO_ROUTING_STRATEGY = "singleton"
|
|
227
|
+
# DO_SHARD_COUNT = "10" # Only needed if using shard strategy
|
|
228
|
+
|
|
229
|
+
XMCP_I_TS_SKEW_SEC = "120"
|
|
230
|
+
XMCP_I_SESSION_TTL = "1800"
|
|
231
|
+
|
|
232
|
+
# AgentShield Integration (https://kya.vouched.id)
|
|
233
|
+
AGENTSHIELD_API_URL = "https://kya.vouched.id"
|
|
234
|
+
|
|
235
|
+
# AGENTSHIELD_PROJECT_ID - Your project ID from AgentShield dashboard (e.g., "batman-txh0ae")
|
|
236
|
+
# Required for project-scoped tool protection configuration (recommended)
|
|
237
|
+
# Find it in your dashboard URL: https://kya.vouched.id/dashboard/projects/{PROJECT_ID}
|
|
238
|
+
# Or in your project settings
|
|
239
|
+
# This is not sensitive, so it's safe to keep a value here
|
|
240
|
+
${projectId ? `AGENTSHIELD_PROJECT_ID = "${projectId}"` : '# AGENTSHIELD_PROJECT_ID = "your-project-id"'}
|
|
241
|
+
|
|
242
|
+
MCPI_ENV = "development"
|
|
243
|
+
|
|
244
|
+
# Secrets (NOT declared here - see instructions below)
|
|
245
|
+
# For local development: Add secrets to .dev.vars file
|
|
246
|
+
# For production: Use wrangler secret put COMMAND_NAME
|
|
247
|
+
#
|
|
248
|
+
# Required secrets:
|
|
249
|
+
# $ wrangler secret put MCP_IDENTITY_PRIVATE_KEY
|
|
250
|
+
# $ wrangler secret put OAUTH_ENCRYPTION_SECRET # Required for OAuth/delegation flows
|
|
251
|
+
#
|
|
252
|
+
# Optional secrets (recommended for production):
|
|
253
|
+
# $ wrangler secret put AGENTSHIELD_API_KEY # For AgentShield integration
|
|
254
|
+
#
|
|
255
|
+
# Optional secrets (advanced):
|
|
256
|
+
# $ wrangler secret put ADMIN_API_KEY # For cache management endpoints
|
|
257
|
+
# # Falls back to AGENTSHIELD_API_KEY if not set
|
|
258
|
+
#
|
|
259
|
+
# Note: .dev.vars is git-ignored and contains actual secret values for local dev
|
|
260
|
+
|
|
261
|
+
# MCP Server URL (OPTIONAL - auto-detected from request origin by default)
|
|
262
|
+
# Only set this if you're using a custom domain or auto-detection isn't working
|
|
263
|
+
# IMPORTANT: Use base URL WITHOUT /mcp suffix - consent pages are at /consent, not /mcp/consent
|
|
264
|
+
# MCP_SERVER_URL = "https://${projectName}.YOUR-SUBDOMAIN.workers.dev"
|
|
265
|
+
`;
|
|
266
|
+
await fs.outputFile(path.join(targetDir, "wrangler.toml"), wranglerToml);
|
|
267
|
+
// 6. Create src/index.ts (Entry Point)
|
|
268
|
+
const indexTs = `import { createMCPIApp } from "@kya-os/mcp-i-cloudflare";
|
|
269
|
+
import { ${toPascalCase(projectName)}MCP } from "./agent";
|
|
270
|
+
import { getRuntimeConfig } from "./mcpi-runtime-config";
|
|
271
|
+
|
|
272
|
+
export default createMCPIApp({
|
|
273
|
+
AgentClass: ${toPascalCase(projectName)}MCP,
|
|
274
|
+
getRuntimeConfig,
|
|
275
|
+
envPrefix: "${projectNameUpper}", // Maps prefixed KV binding (e.g., ${projectNameUpper}_MCPI_KV) to standard names
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
// Export Durable Object class for Cloudflare Workers binding
|
|
279
|
+
export { ${toPascalCase(projectName)}MCP };
|
|
280
|
+
`;
|
|
281
|
+
await fs.outputFile(path.join(targetDir, "src/index.ts"), indexTs);
|
|
282
|
+
// 7. Create src/agent.ts (Agent Class)
|
|
283
|
+
const agentTs = `import { MCPICloudflareAgent, type CloudflareEnv } from "@kya-os/mcp-i-cloudflare";
|
|
284
|
+
import { getRuntimeConfig } from "./mcpi-runtime-config";
|
|
285
|
+
import { getTools } from "./mcpi-runtime-config";
|
|
286
|
+
import type { CloudflareRuntimeConfig } from "@kya-os/mcp-i-cloudflare";
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* MCP-I Agent Implementation
|
|
290
|
+
*
|
|
291
|
+
* This class extends MCPICloudflareAgent and provides the agent-specific
|
|
292
|
+
* configuration and tool registration. The Durable Object class (${toPascalCase(projectName)}MCP)
|
|
293
|
+
* is exported separately for Cloudflare Workers bindings.
|
|
294
|
+
*/
|
|
295
|
+
export class ${toPascalCase(projectName)}MCP extends MCPICloudflareAgent {
|
|
296
|
+
/**
|
|
297
|
+
* Get agent name
|
|
298
|
+
*/
|
|
299
|
+
protected getAgentName(): string {
|
|
300
|
+
return "${projectName}";
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Get agent version
|
|
305
|
+
*/
|
|
306
|
+
protected getAgentVersion(): string {
|
|
307
|
+
return "1.0.0";
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Get environment prefix for KV bindings
|
|
312
|
+
* This allows the framework to map the unified KV binding (e.g., ${projectNameUpper}_MCPI_KV)
|
|
313
|
+
* to all standard names (NONCE_CACHE, PROOF_ARCHIVE, etc.) automatically
|
|
314
|
+
*/
|
|
315
|
+
protected getEnvPrefix(): string | undefined {
|
|
316
|
+
return "${projectNameUpper}";
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Get runtime configuration
|
|
321
|
+
* This is called during agent initialization and has access to the environment
|
|
322
|
+
*/
|
|
323
|
+
protected getRuntimeConfigInternal(env: CloudflareEnv): CloudflareRuntimeConfig {
|
|
324
|
+
return getRuntimeConfig(env);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Register tools with the MCP server
|
|
329
|
+
* Tools are defined in mcpi-runtime-config.ts
|
|
330
|
+
*/
|
|
331
|
+
protected async registerTools(): Promise<void> {
|
|
332
|
+
// Get tools from the tools registry
|
|
333
|
+
const tools = getTools();
|
|
334
|
+
|
|
335
|
+
// Register each tool with proof generation
|
|
336
|
+
for (const toolDef of tools) {
|
|
337
|
+
// Pass the full JSON Schema object - registerToolWithProof will normalize it
|
|
338
|
+
// The MCP SDK expects a JSON Schema object with type, properties, and required fields
|
|
339
|
+
this.registerToolWithProof(
|
|
340
|
+
toolDef.name,
|
|
341
|
+
toolDef.description,
|
|
342
|
+
toolDef.inputSchema, // Pass full JSON Schema object
|
|
343
|
+
toolDef.handler
|
|
344
|
+
);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
`;
|
|
349
|
+
await fs.outputFile(path.join(targetDir, "src/agent.ts"), agentTs);
|
|
350
|
+
// 8. Create src/tools/greet.ts
|
|
351
|
+
const greetToolTs = `import type { ToolDefinition } from "@kya-os/mcp-i-cloudflare";
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Greet tool definition
|
|
355
|
+
*
|
|
356
|
+
* This tool demonstrates a simple MCP tool implementation.
|
|
357
|
+
* Tools are registered with the MCP server and can be called by MCP clients.
|
|
358
|
+
*/
|
|
359
|
+
export const greetTool: ToolDefinition = {
|
|
360
|
+
name: "greet",
|
|
361
|
+
description: "Greet the user",
|
|
362
|
+
inputSchema: {
|
|
363
|
+
type: "object",
|
|
364
|
+
properties: {
|
|
365
|
+
name: { type: "string", description: "Name of the person to greet" },
|
|
366
|
+
},
|
|
367
|
+
required: ["name"],
|
|
368
|
+
},
|
|
369
|
+
handler: async (args: { name: string }) => {
|
|
370
|
+
return {
|
|
371
|
+
content: [
|
|
372
|
+
{
|
|
373
|
+
type: "text",
|
|
374
|
+
text: \`Hello, \${args.name}! Welcome to ${projectName}.\`,
|
|
375
|
+
},
|
|
376
|
+
],
|
|
377
|
+
};
|
|
378
|
+
},
|
|
379
|
+
};
|
|
380
|
+
`;
|
|
381
|
+
await fs.outputFile(path.join(targetDir, "src/tools/greet.ts"), greetToolTs);
|
|
382
|
+
// 9. Create src/mcpi-runtime-config.ts
|
|
383
|
+
const runtimeConfigTs = `import { defineConfig, type CloudflareRuntimeConfig } from "@kya-os/mcp-i-cloudflare";
|
|
384
|
+
import type { CloudflareEnv } from "@kya-os/mcp-i-cloudflare";
|
|
385
|
+
import { greetTool } from "./tools/greet";
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Get runtime configuration for MCP-I Cloudflare Worker
|
|
389
|
+
*
|
|
390
|
+
* This function is called by the framework to get the runtime configuration.
|
|
391
|
+
*/
|
|
392
|
+
export function getRuntimeConfig(env: CloudflareEnv): CloudflareRuntimeConfig {
|
|
393
|
+
// Determine environment with proper type casting
|
|
394
|
+
const environment = (env.MCPI_ENV || env.ENVIRONMENT || "development") as "development" | "production";
|
|
395
|
+
|
|
396
|
+
// Extract proofing config from env if API key is present
|
|
397
|
+
const proofingConfig = env.AGENTSHIELD_API_KEY ? {
|
|
398
|
+
enabled: true,
|
|
399
|
+
batchQueue: {
|
|
400
|
+
destinations: [{
|
|
401
|
+
type: 'agentshield' as const,
|
|
402
|
+
apiKey: env.AGENTSHIELD_API_KEY,
|
|
403
|
+
apiUrl: env.AGENTSHIELD_API_URL || 'https://kya.vouched.id',
|
|
404
|
+
}],
|
|
405
|
+
},
|
|
406
|
+
} : undefined;
|
|
407
|
+
|
|
408
|
+
return defineConfig({
|
|
409
|
+
environment,
|
|
410
|
+
proofing: proofingConfig,
|
|
411
|
+
// Pass environment variables through vars so defineConfig can access them
|
|
412
|
+
vars: {
|
|
413
|
+
ENVIRONMENT: environment,
|
|
414
|
+
AGENTSHIELD_API_KEY: env.AGENTSHIELD_API_KEY,
|
|
415
|
+
AGENTSHIELD_API_URL: env.AGENTSHIELD_API_URL,
|
|
416
|
+
AGENTSHIELD_PROJECT_ID: env.AGENTSHIELD_PROJECT_ID,
|
|
417
|
+
},
|
|
418
|
+
// Add other configuration options as needed
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* Get all tools for this agent
|
|
424
|
+
*
|
|
425
|
+
* Tools are registered separately from the runtime config.
|
|
426
|
+
* This function is called by the agent to get the list of tools.
|
|
427
|
+
*/
|
|
428
|
+
export function getTools() {
|
|
429
|
+
return [
|
|
430
|
+
greetTool,
|
|
431
|
+
// Add more tools here
|
|
432
|
+
];
|
|
433
|
+
}
|
|
434
|
+
`;
|
|
435
|
+
await fs.outputFile(path.join(targetDir, "src/mcpi-runtime-config.ts"), runtimeConfigTs);
|
|
436
|
+
// 10. Create tsconfig.json
|
|
437
|
+
const tsConfig = {
|
|
438
|
+
compilerOptions: {
|
|
439
|
+
target: "esnext",
|
|
440
|
+
module: "esnext",
|
|
441
|
+
moduleResolution: "bundler",
|
|
442
|
+
types: ["@cloudflare/workers-types", "vitest/globals"],
|
|
443
|
+
strict: true,
|
|
444
|
+
skipLibCheck: true,
|
|
445
|
+
noEmit: true,
|
|
446
|
+
},
|
|
447
|
+
include: ["src/**/*"],
|
|
448
|
+
exclude: ["node_modules"],
|
|
449
|
+
};
|
|
450
|
+
await fs.writeJson(path.join(targetDir, "tsconfig.json"), tsConfig, {
|
|
451
|
+
spaces: 2,
|
|
452
|
+
});
|
|
453
|
+
// 12. Create .gitignore
|
|
454
|
+
const gitignore = `node_modules
|
|
455
|
+
dist
|
|
456
|
+
.wrangler
|
|
457
|
+
.dev.vars
|
|
458
|
+
`;
|
|
459
|
+
await fs.outputFile(path.join(targetDir, ".gitignore"), gitignore);
|
|
460
|
+
console.log(chalk.green("ā Created Cloudflare MCP-I template files"));
|
|
461
|
+
console.log(chalk.gray(" - Generated identity keys in .dev.vars"));
|
|
462
|
+
console.log(chalk.gray(" - Configured wrangler.toml with unified KV namespace (auto-provisioned)"));
|
|
463
|
+
console.log(chalk.gray(" - Created modular tool structure"));
|
|
464
|
+
// 13. Run npm install first (skip in tests)
|
|
465
|
+
if (!skipCommands) {
|
|
466
|
+
console.log(chalk.blue("\nš¦ Installing dependencies..."));
|
|
467
|
+
await runCommand(packageManager, ["install"], targetDir);
|
|
468
|
+
// 13a. Verify installed version matches expected version
|
|
469
|
+
console.log(chalk.blue("\nš Verifying package versions..."));
|
|
470
|
+
const expectedVersion = mcpICloudflareVersion;
|
|
471
|
+
try {
|
|
472
|
+
const installedPackagePath = path.join(targetDir, "node_modules", "@kya-os", "mcp-i-cloudflare", "package.json");
|
|
473
|
+
if (fs.existsSync(installedPackagePath)) {
|
|
474
|
+
const installedPackage = await fs.readJson(installedPackagePath);
|
|
475
|
+
const installedVersion = installedPackage.version;
|
|
476
|
+
if (installedVersion !== expectedVersion) {
|
|
477
|
+
console.log(chalk.yellow(`\nā ļø Warning: Expected @kya-os/mcp-i-cloudflare@${expectedVersion} but got ${installedVersion}`));
|
|
478
|
+
console.log(chalk.yellow(" This might cause issues with MCP-I handshake. Consider clearing package cache:"));
|
|
479
|
+
if (packageManager === "npm") {
|
|
480
|
+
console.log(chalk.gray(" npm cache clean --force"));
|
|
481
|
+
}
|
|
482
|
+
else if (packageManager === "pnpm") {
|
|
483
|
+
console.log(chalk.gray(" pnpm store prune"));
|
|
484
|
+
}
|
|
485
|
+
else if (packageManager === "yarn") {
|
|
486
|
+
console.log(chalk.gray(" yarn cache clean"));
|
|
487
|
+
}
|
|
488
|
+
console.log(chalk.yellow(" Then reinstall dependencies."));
|
|
489
|
+
}
|
|
490
|
+
else {
|
|
491
|
+
console.log(chalk.green(`ā
@kya-os/mcp-i-cloudflare@${installedVersion} installed correctly`));
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
else {
|
|
495
|
+
console.log(chalk.yellow("ā ļø Could not verify package installation"));
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
catch (error) {
|
|
499
|
+
console.log(chalk.yellow("ā ļø Could not verify package versions"));
|
|
500
|
+
if (process.env.DEBUG) {
|
|
501
|
+
console.error(error);
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
// 15. Final instructions
|
|
506
|
+
console.log(chalk.blue("\n" + "=".repeat(60)));
|
|
507
|
+
console.log(chalk.bold.green("š Cloudflare MCP-I project created successfully!"));
|
|
508
|
+
console.log(chalk.blue("=".repeat(60)));
|
|
509
|
+
console.log(chalk.bold("\nš Important Configuration Notes:"));
|
|
510
|
+
console.log(chalk.gray("\n1. ADMIN_API_KEY (in .dev.vars):"));
|
|
511
|
+
console.log(chalk.gray(" - Set to same value as AGENTSHIELD_API_KEY for convenience"));
|
|
512
|
+
console.log(chalk.gray(" - You can change it if you need separate admin endpoint security"));
|
|
513
|
+
console.log(chalk.gray(" - Required for admin endpoints like /admin/clear-cache\n"));
|
|
514
|
+
console.log(chalk.gray("2. KV Namespace (auto-provisioned by Wrangler v4):"));
|
|
515
|
+
console.log(chalk.gray(" - Single unified namespace for all MCP-I storage"));
|
|
516
|
+
console.log(chalk.green(" - ⨠Automatically created on first deploy - no setup needed!"));
|
|
517
|
+
console.log(chalk.gray(" - Wrangler updates wrangler.toml with namespace ID\n"));
|
|
518
|
+
console.log(chalk.bold("š Next Steps:"));
|
|
519
|
+
console.log(chalk.cyan(" cd " + projectName));
|
|
520
|
+
console.log(chalk.yellow(" wrangler login # Login to Cloudflare first!"));
|
|
521
|
+
console.log(chalk.cyan(" npm run dev # Start local development"));
|
|
522
|
+
console.log(chalk.cyan(" npm run deploy # Deploy (KV auto-created!)\n"));
|
|
523
|
+
}
|
|
524
|
+
function toPascalCase(str) {
|
|
525
|
+
const result = str
|
|
526
|
+
.replace(/(?:^\w|[A-Z]|\b\w)/g, (word, _index) => {
|
|
527
|
+
return word.toUpperCase();
|
|
528
|
+
})
|
|
529
|
+
.replace(/\s+/g, "")
|
|
530
|
+
.replace(/-/g, "")
|
|
531
|
+
.replace(/[^a-zA-Z0-9]/g, ""); // Remove all non-alphanumeric characters
|
|
532
|
+
// Fallback to "Project" if result is empty or invalid
|
|
533
|
+
let className = result || "Project";
|
|
534
|
+
// Prefix with underscore if starts with a number (invalid JavaScript identifier)
|
|
535
|
+
if (/^\d/.test(className)) {
|
|
536
|
+
className = "_" + className;
|
|
537
|
+
}
|
|
538
|
+
return className;
|
|
539
|
+
}
|
|
540
|
+
function runCommand(command, args, cwd) {
|
|
541
|
+
return new Promise((resolve, reject) => {
|
|
542
|
+
const child = spawn(command, args, {
|
|
543
|
+
cwd,
|
|
544
|
+
stdio: "inherit",
|
|
545
|
+
shell: process.platform === "win32",
|
|
546
|
+
});
|
|
547
|
+
child.on("error", reject);
|
|
548
|
+
child.on("exit", (code) => {
|
|
549
|
+
if (code === 0) {
|
|
550
|
+
resolve();
|
|
551
|
+
}
|
|
552
|
+
else {
|
|
553
|
+
reject(new Error(`Command failed with exit code ${code}`));
|
|
554
|
+
}
|
|
555
|
+
});
|
|
556
|
+
});
|
|
557
|
+
}
|
|
558
|
+
//# sourceMappingURL=fetch-cloudflare-mcpi-template.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch-cloudflare-mcpi-template.js","sourceRoot":"","sources":["../../src/helpers/fetch-cloudflare-mcpi-template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACtC,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EACL,eAAe,EACf,qBAAqB,GAEtB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAY/D;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAC/C,SAAiB,EACjB,OAA2C;IAE3C,yEAAyE;IACzE,MAAM,IAAI,GACR,OAAO,OAAO,KAAK,QAAQ;QACzB,CAAC,CAAC,EAAE,cAAc,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE;QACjD,CAAC,CAAC,OAAO,CAAC;IAEd,iDAAiD;IACjD,IAAI,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;IACnC,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,MAAM,SAAS,GAAG,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC5C,WAAW,GAAG,SAAS,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,QAAQ,CAAC;IAC5D,CAAC;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,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;YACxB,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;gBACf,OAAO,EAAE,CAAC;YACZ,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,IAAI,KAAK,CAAC,iCAAiC,IAAI,EAAE,CAAC,CAAC,CAAC;YAC7D,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface CloudflareTemplateOptions {
|
|
2
|
+
verifierVersion?: string;
|
|
3
|
+
packageManager?: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Scaffold Cloudflare Worker verifier project
|
|
7
|
+
* This creates a standalone Worker verifier with KV nonce caching
|
|
8
|
+
*/
|
|
9
|
+
export declare function fetchCloudflareTemplate(projectPath: string, options?: CloudflareTemplateOptions): Promise<void>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=fetch-cloudflare-template.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch-cloudflare-template.d.ts","sourceRoot":"","sources":["../../src/helpers/fetch-cloudflare-template.ts"],"names":[],"mappings":"AAIA,UAAU,yBAAyB;IACjC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;GAGG;AACH,wBAAsB,uBAAuB,CAC3C,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,yBAA8B,GACtC,OAAO,CAAC,IAAI,CAAC,CAoVf"}
|