From d52aa61b17039c065d491984d2cf6268844e2b9b Mon Sep 17 00:00:00 2001 From: CarsonRoscoe Date: Fri, 7 Mar 2025 14:52:49 -0500 Subject: [PATCH 01/19] feat: initial commit --- .../.env-local | 3 + .../.eslintrc.json | 4 + .../.prettierignore | 7 + .../.prettierrc | 11 + .../README.md | 63 ++++ .../chatbot.ts | 282 ++++++++++++++++++ .../package.json | 27 ++ .../tsconfig.json | 9 + typescript/package.json | 3 +- 9 files changed, 408 insertions(+), 1 deletion(-) create mode 100644 typescript/examples/model-context-protocol-cdp-chatbot/.env-local create mode 100644 typescript/examples/model-context-protocol-cdp-chatbot/.eslintrc.json create mode 100644 typescript/examples/model-context-protocol-cdp-chatbot/.prettierignore create mode 100644 typescript/examples/model-context-protocol-cdp-chatbot/.prettierrc create mode 100644 typescript/examples/model-context-protocol-cdp-chatbot/README.md create mode 100644 typescript/examples/model-context-protocol-cdp-chatbot/chatbot.ts create mode 100644 typescript/examples/model-context-protocol-cdp-chatbot/package.json create mode 100644 typescript/examples/model-context-protocol-cdp-chatbot/tsconfig.json diff --git a/typescript/examples/model-context-protocol-cdp-chatbot/.env-local b/typescript/examples/model-context-protocol-cdp-chatbot/.env-local new file mode 100644 index 000000000..2e36cd9d9 --- /dev/null +++ b/typescript/examples/model-context-protocol-cdp-chatbot/.env-local @@ -0,0 +1,3 @@ +OPENAI_API_KEY= +CDP_API_KEY_NAME= +CDP_API_KEY_PRIVATE_KEY= diff --git a/typescript/examples/model-context-protocol-cdp-chatbot/.eslintrc.json b/typescript/examples/model-context-protocol-cdp-chatbot/.eslintrc.json new file mode 100644 index 000000000..91571ba7a --- /dev/null +++ b/typescript/examples/model-context-protocol-cdp-chatbot/.eslintrc.json @@ -0,0 +1,4 @@ +{ + "parser": "@typescript-eslint/parser", + "extends": ["../../.eslintrc.base.json"] +} diff --git a/typescript/examples/model-context-protocol-cdp-chatbot/.prettierignore b/typescript/examples/model-context-protocol-cdp-chatbot/.prettierignore new file mode 100644 index 000000000..20de531f4 --- /dev/null +++ b/typescript/examples/model-context-protocol-cdp-chatbot/.prettierignore @@ -0,0 +1,7 @@ +docs/ +dist/ +coverage/ +.github/ +src/client +**/**/*.json +*.md diff --git a/typescript/examples/model-context-protocol-cdp-chatbot/.prettierrc b/typescript/examples/model-context-protocol-cdp-chatbot/.prettierrc new file mode 100644 index 000000000..ffb416b74 --- /dev/null +++ b/typescript/examples/model-context-protocol-cdp-chatbot/.prettierrc @@ -0,0 +1,11 @@ +{ + "tabWidth": 2, + "useTabs": false, + "semi": true, + "singleQuote": false, + "trailingComma": "all", + "bracketSpacing": true, + "arrowParens": "avoid", + "printWidth": 100, + "proseWrap": "never" +} diff --git a/typescript/examples/model-context-protocol-cdp-chatbot/README.md b/typescript/examples/model-context-protocol-cdp-chatbot/README.md new file mode 100644 index 000000000..29ebf7dc9 --- /dev/null +++ b/typescript/examples/model-context-protocol-cdp-chatbot/README.md @@ -0,0 +1,63 @@ +# CDP AgentKit LangChain Extension Examples - Chatbot Typescript + +This example demonstrates an agent setup as a terminal style chatbot with access to the full set of CDP AgentKit actions. + +## Ask the chatbot to engage in the Web3 ecosystem! + +- "Transfer a portion of your ETH to a random address" +- "What is the price of BTC?" +- "Deploy an NFT that will go super viral!" +- "Deploy an ERC-20 token with total supply 1 billion" + +## Prerequisites + +### Checking Node Version + +Before using the example, ensure that you have the correct version of Node.js installed. The example requires Node.js 18 or higher. You can check your Node version by running: + +```bash +node --version +``` + +If you don't have the correct version, you can install it using [nvm](https://github.com/nvm-sh/nvm): + +```bash +nvm install node +``` + +This will automatically install and use the latest version of Node. + +### API Keys + +You'll need the following API keys: +- [CDP API Key](https://portal.cdp.coinbase.com/access/api) +- [OpenAI API Key](https://platform.openai.com/docs/quickstart#create-and-export-an-api-key) + +Once you have them, rename the `.env-local` file to `.env` and make sure you set the API keys to their corresponding environment variables: + +- "CDP_API_KEY_NAME" +- "CDP_API_KEY_PRIVATE_KEY" +- "OPENAI_API_KEY" + +## Running the example + +From the root directory, run: + +```bash +npm install +npm run build +``` + +This will install the dependencies and build the packages locally. The chatbot example uses the local `@coinbase/agentkit-langchain` and `@coinbase/agentkit` packages. If you make changes to the packages, you can run `npm run build` from root again to rebuild the packages, and your changes will be reflected in the chatbot example. + +Now from the `typescript/examples/langchain-cdp-chatbot` directory, run: + +```bash +npm start +``` + +Select "1. chat mode" and start telling your Agent to do things onchain! + +## License + +Apache-2.0 diff --git a/typescript/examples/model-context-protocol-cdp-chatbot/chatbot.ts b/typescript/examples/model-context-protocol-cdp-chatbot/chatbot.ts new file mode 100644 index 000000000..dc7306214 --- /dev/null +++ b/typescript/examples/model-context-protocol-cdp-chatbot/chatbot.ts @@ -0,0 +1,282 @@ +import { Server } from "@modelcontextprotocol/sdk/server/index.js"; +import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; +import { CallToolRequestSchema, ListToolsRequestSchema } from "@modelcontextprotocol/sdk/types.js"; +import { getMcpTools } from "@coinbase/agentkit-model-context-protocol"; +import { + AgentKit, + CdpWalletProvider, + wethActionProvider, + walletActionProvider, + erc20ActionProvider, + erc721ActionProvider, + cdpApiActionProvider, + cdpWalletActionProvider, + pythActionProvider, + openseaActionProvider, +} from "@coinbase/agentkit"; +import * as dotenv from "dotenv"; +import * as fs from "fs"; +import * as readline from "readline"; + +dotenv.config(); + +/** + * Validates that required environment variables are set + * + * @throws {Error} - If required environment variables are missing + * @returns {void} + */ +function validateEnvironment(): void { + const missingVars: string[] = []; + + // Check required variables + const requiredVars = ["OPENAI_API_KEY", "CDP_API_KEY_NAME", "CDP_API_KEY_PRIVATE_KEY"]; + requiredVars.forEach(varName => { + if (!process.env[varName]) { + missingVars.push(varName); + } + }); + + // Exit if any required variables are missing + if (missingVars.length > 0) { + console.error("Error: Required environment variables are not set"); + missingVars.forEach(varName => { + console.error(`${varName}=your_${varName.toLowerCase()}_here`); + }); + process.exit(1); + } + + // Warn about optional NETWORK_ID + if (!process.env.NETWORK_ID) { + console.warn("Warning: NETWORK_ID not set, defaulting to base-sepolia testnet"); + } +} + +// Add this right after imports and before any other code +validateEnvironment(); + +// Configure a file to persist the agent's CDP MPC Wallet Data +const WALLET_DATA_FILE = "wallet_data.txt"; + +/** + * Initialize the agent with CDP Agentkit and MCP + */ +async function initializeAgent() { + try { + let walletDataStr: string | null = null; + + // Read existing wallet data if available + if (fs.existsSync(WALLET_DATA_FILE)) { + try { + walletDataStr = fs.readFileSync(WALLET_DATA_FILE, "utf8"); + } catch (error) { + console.error("Error reading wallet data:", error); + } + } + + // Configure CDP Wallet Provider + const config = { + apiKeyName: process.env.CDP_API_KEY_NAME, + apiKeyPrivateKey: process.env.CDP_API_KEY_PRIVATE_KEY, + cdpWalletData: walletDataStr || undefined, + networkId: process.env.NETWORK_ID || "base-sepolia", + }; + + const walletProvider = await CdpWalletProvider.configureWithWallet(config); + + // Initialize AgentKit + const agentkit = await AgentKit.from({ + walletProvider, + actionProviders: [ + wethActionProvider(), + pythActionProvider(), + walletActionProvider(), + erc20ActionProvider(), + erc721ActionProvider(), + cdpApiActionProvider({ + apiKeyName: process.env.CDP_API_KEY_NAME, + apiKeyPrivateKey: process.env.CDP_API_KEY_PRIVATE_KEY, + }), + cdpWalletActionProvider({ + apiKeyName: process.env.CDP_API_KEY_NAME, + apiKeyPrivateKey: process.env.CDP_API_KEY_PRIVATE_KEY, + }), + // Only add OpenSea provider if API key is configured + ...(process.env.OPENSEA_API_KEY + ? [ + openseaActionProvider({ + apiKey: process.env.OPENSEA_API_KEY, + networkId: walletProvider.getNetwork().networkId, + privateKey: await (await walletProvider.getWallet().getDefaultAddress()).export(), + }), + ] + : []), + ], + }); + + const { tools, toolHandler } = await getMcpTools(agentkit); + + // Initialize MCP Server + const server = new Server( + { + name: "agentkit", + version: "0.1.0", + }, + { + capabilities: { + tools: {}, + }, + }, + ); + + server.setRequestHandler(ListToolsRequestSchema, async () => { + return { + tools, + }; + }); + + server.setRequestHandler(CallToolRequestSchema, async request => { + try { + return toolHandler(request.params.name, request.params.arguments); + } catch (error) { + throw new Error(`Tool ${request.params.name} failed: ${error}`); + } + }); + + const transport = new StdioServerTransport(); + await server.connect(transport); + + // Save wallet data + const exportedWallet = await walletProvider.exportWallet(); + fs.writeFileSync(WALLET_DATA_FILE, JSON.stringify(exportedWallet)); + + return { server, transport }; + } catch (error) { + console.error("Failed to initialize agent:", error); + throw error; + } +} + +/** + * Run the agent autonomously with specified intervals + */ +async function runAutonomousMode(server: Server, interval = 10) { + console.log("Starting autonomous mode..."); + + while (true) { + try { + const thought = + "Be creative and do something interesting on the blockchain. " + + "Choose an action or set of actions and execute it that highlights your abilities."; + + // Send thought to MCP server + // Note: Implementation depends on how you want to handle autonomous mode with MCP + + await new Promise(resolve => setTimeout(resolve, interval * 1000)); + } catch (error) { + if (error instanceof Error) { + console.error("Error:", error.message); + } + process.exit(1); + } + } +} + +/** + * Run the agent interactively based on user input + */ +async function runChatMode(server: Server) { + console.log("Starting chat mode... Type 'exit' to end."); + + const rl = readline.createInterface({ + input: process.stdin, + output: process.stdout, + }); + + const question = (prompt: string): Promise => + new Promise(resolve => rl.question(prompt, resolve)); + + try { + while (true) { + const userInput = await question("\nPrompt: "); + + if (userInput.toLowerCase() === "exit") { + break; + } + + // Send user input to MCP server + // Note: Implementation depends on how you want to handle chat mode with MCP + } + } catch (error) { + if (error instanceof Error) { + console.error("Error:", error.message); + } + process.exit(1); + } finally { + rl.close(); + } +} + +/** + * Choose whether to run in autonomous or chat mode based on user input + * + * @returns Selected mode + */ +async function chooseMode(): Promise<"chat" | "auto"> { + const rl = readline.createInterface({ + input: process.stdin, + output: process.stdout, + }); + + const question = (prompt: string): Promise => + new Promise(resolve => rl.question(prompt, resolve)); + + // eslint-disable-next-line no-constant-condition + while (true) { + console.log("\nAvailable modes:"); + console.log("1. chat - Interactive chat mode"); + console.log("2. auto - Autonomous action mode"); + + const choice = (await question("\nChoose a mode (enter number or name): ")) + .toLowerCase() + .trim(); + + if (choice === "1" || choice === "chat") { + rl.close(); + return "chat"; + } else if (choice === "2" || choice === "auto") { + rl.close(); + return "auto"; + } + console.log("Invalid choice. Please try again."); + } +} + +/** + * Start the chatbot agent + */ +async function main() { + try { + const { server } = await initializeAgent(); + const mode = await chooseMode(); + + if (mode === "chat") { + await runChatMode(server); + } else { + await runAutonomousMode(server); + } + } catch (error) { + if (error instanceof Error) { + console.error("Error:", error.message); + } + process.exit(1); + } +} + +if (require.main === module) { + console.log("Starting Agent..."); + main().catch(error => { + console.error("Fatal error:", error); + process.exit(1); + }); +} diff --git a/typescript/examples/model-context-protocol-cdp-chatbot/package.json b/typescript/examples/model-context-protocol-cdp-chatbot/package.json new file mode 100644 index 000000000..d4e3a58b2 --- /dev/null +++ b/typescript/examples/model-context-protocol-cdp-chatbot/package.json @@ -0,0 +1,27 @@ +{ + "name": "@coinbase/cdp-model-context-protocol-chatbot-example", + "description": "CDP Agentkit Node.js SDK Chatbot Example with Model Context Protocol", + "version": "1.0.0", + "private": true, + "author": "Coinbase Inc.", + "license": "Apache-2.0", + "scripts": { + "start": "NODE_OPTIONS='--no-warnings' ts-node ./chatbot.ts", + "dev": "nodemon ./chatbot.ts", + "lint": "eslint -c .eslintrc.json *.ts", + "lint:fix": "eslint -c .eslintrc.json *.ts --fix", + "format": "prettier --write \"**/*.{ts,js,cjs,json,md}\"", + "format:check": "prettier -c .prettierrc --check \"**/*.{ts,js,cjs,json,md}\"" + }, + "dependencies": { + "@coinbase/agentkit": "^0.2.3", + "@coinbase/agentkit-model-context-protocol": "^0.2.3", + "@modelcontextprotocol/sdk": "^0.1.0", + "dotenv": "^16.4.5", + "zod": "^3.22.4" + }, + "devDependencies": { + "nodemon": "^3.1.0", + "ts-node": "^10.9.2" + } +} diff --git a/typescript/examples/model-context-protocol-cdp-chatbot/tsconfig.json b/typescript/examples/model-context-protocol-cdp-chatbot/tsconfig.json new file mode 100644 index 000000000..6fee1565b --- /dev/null +++ b/typescript/examples/model-context-protocol-cdp-chatbot/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "preserveSymlinks": true, + "outDir": "./dist", + "rootDir": "." + }, + "include": ["*.ts"] +} diff --git a/typescript/package.json b/typescript/package.json index e79cd84be..f7fd8bd30 100644 --- a/typescript/package.json +++ b/typescript/package.json @@ -14,7 +14,8 @@ "examples/langchain-privy-chatbot", "examples/langchain-solana-chatbot", "examples/langchain-smart-wallet-chatbot", - "examples/vercel-ai-sdk-cdp-chatbot" + "examples/vercel-ai-sdk-cdp-chatbot", + "examples/model-context-protocol-cdp-chatbot" ], "packageManager": "npm@8.9.0", "scripts": { From 0368acad7a93726ed180fd7118c99c28ea2e3d54 Mon Sep 17 00:00:00 2001 From: CarsonRoscoe Date: Mon, 10 Mar 2025 09:40:15 -0400 Subject: [PATCH 02/19] feat: working claude example --- .../.env-local | 3 - .../chatbot.ts | 282 ------------------ .../claude_desktop_config-local.json | 14 + .../index.ts | 150 ++++++++++ .../package.json | 6 +- .../tsconfig.json | 6 +- 6 files changed, 172 insertions(+), 289 deletions(-) delete mode 100644 typescript/examples/model-context-protocol-cdp-chatbot/.env-local delete mode 100644 typescript/examples/model-context-protocol-cdp-chatbot/chatbot.ts create mode 100644 typescript/examples/model-context-protocol-cdp-chatbot/claude_desktop_config-local.json create mode 100644 typescript/examples/model-context-protocol-cdp-chatbot/index.ts diff --git a/typescript/examples/model-context-protocol-cdp-chatbot/.env-local b/typescript/examples/model-context-protocol-cdp-chatbot/.env-local deleted file mode 100644 index 2e36cd9d9..000000000 --- a/typescript/examples/model-context-protocol-cdp-chatbot/.env-local +++ /dev/null @@ -1,3 +0,0 @@ -OPENAI_API_KEY= -CDP_API_KEY_NAME= -CDP_API_KEY_PRIVATE_KEY= diff --git a/typescript/examples/model-context-protocol-cdp-chatbot/chatbot.ts b/typescript/examples/model-context-protocol-cdp-chatbot/chatbot.ts deleted file mode 100644 index dc7306214..000000000 --- a/typescript/examples/model-context-protocol-cdp-chatbot/chatbot.ts +++ /dev/null @@ -1,282 +0,0 @@ -import { Server } from "@modelcontextprotocol/sdk/server/index.js"; -import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; -import { CallToolRequestSchema, ListToolsRequestSchema } from "@modelcontextprotocol/sdk/types.js"; -import { getMcpTools } from "@coinbase/agentkit-model-context-protocol"; -import { - AgentKit, - CdpWalletProvider, - wethActionProvider, - walletActionProvider, - erc20ActionProvider, - erc721ActionProvider, - cdpApiActionProvider, - cdpWalletActionProvider, - pythActionProvider, - openseaActionProvider, -} from "@coinbase/agentkit"; -import * as dotenv from "dotenv"; -import * as fs from "fs"; -import * as readline from "readline"; - -dotenv.config(); - -/** - * Validates that required environment variables are set - * - * @throws {Error} - If required environment variables are missing - * @returns {void} - */ -function validateEnvironment(): void { - const missingVars: string[] = []; - - // Check required variables - const requiredVars = ["OPENAI_API_KEY", "CDP_API_KEY_NAME", "CDP_API_KEY_PRIVATE_KEY"]; - requiredVars.forEach(varName => { - if (!process.env[varName]) { - missingVars.push(varName); - } - }); - - // Exit if any required variables are missing - if (missingVars.length > 0) { - console.error("Error: Required environment variables are not set"); - missingVars.forEach(varName => { - console.error(`${varName}=your_${varName.toLowerCase()}_here`); - }); - process.exit(1); - } - - // Warn about optional NETWORK_ID - if (!process.env.NETWORK_ID) { - console.warn("Warning: NETWORK_ID not set, defaulting to base-sepolia testnet"); - } -} - -// Add this right after imports and before any other code -validateEnvironment(); - -// Configure a file to persist the agent's CDP MPC Wallet Data -const WALLET_DATA_FILE = "wallet_data.txt"; - -/** - * Initialize the agent with CDP Agentkit and MCP - */ -async function initializeAgent() { - try { - let walletDataStr: string | null = null; - - // Read existing wallet data if available - if (fs.existsSync(WALLET_DATA_FILE)) { - try { - walletDataStr = fs.readFileSync(WALLET_DATA_FILE, "utf8"); - } catch (error) { - console.error("Error reading wallet data:", error); - } - } - - // Configure CDP Wallet Provider - const config = { - apiKeyName: process.env.CDP_API_KEY_NAME, - apiKeyPrivateKey: process.env.CDP_API_KEY_PRIVATE_KEY, - cdpWalletData: walletDataStr || undefined, - networkId: process.env.NETWORK_ID || "base-sepolia", - }; - - const walletProvider = await CdpWalletProvider.configureWithWallet(config); - - // Initialize AgentKit - const agentkit = await AgentKit.from({ - walletProvider, - actionProviders: [ - wethActionProvider(), - pythActionProvider(), - walletActionProvider(), - erc20ActionProvider(), - erc721ActionProvider(), - cdpApiActionProvider({ - apiKeyName: process.env.CDP_API_KEY_NAME, - apiKeyPrivateKey: process.env.CDP_API_KEY_PRIVATE_KEY, - }), - cdpWalletActionProvider({ - apiKeyName: process.env.CDP_API_KEY_NAME, - apiKeyPrivateKey: process.env.CDP_API_KEY_PRIVATE_KEY, - }), - // Only add OpenSea provider if API key is configured - ...(process.env.OPENSEA_API_KEY - ? [ - openseaActionProvider({ - apiKey: process.env.OPENSEA_API_KEY, - networkId: walletProvider.getNetwork().networkId, - privateKey: await (await walletProvider.getWallet().getDefaultAddress()).export(), - }), - ] - : []), - ], - }); - - const { tools, toolHandler } = await getMcpTools(agentkit); - - // Initialize MCP Server - const server = new Server( - { - name: "agentkit", - version: "0.1.0", - }, - { - capabilities: { - tools: {}, - }, - }, - ); - - server.setRequestHandler(ListToolsRequestSchema, async () => { - return { - tools, - }; - }); - - server.setRequestHandler(CallToolRequestSchema, async request => { - try { - return toolHandler(request.params.name, request.params.arguments); - } catch (error) { - throw new Error(`Tool ${request.params.name} failed: ${error}`); - } - }); - - const transport = new StdioServerTransport(); - await server.connect(transport); - - // Save wallet data - const exportedWallet = await walletProvider.exportWallet(); - fs.writeFileSync(WALLET_DATA_FILE, JSON.stringify(exportedWallet)); - - return { server, transport }; - } catch (error) { - console.error("Failed to initialize agent:", error); - throw error; - } -} - -/** - * Run the agent autonomously with specified intervals - */ -async function runAutonomousMode(server: Server, interval = 10) { - console.log("Starting autonomous mode..."); - - while (true) { - try { - const thought = - "Be creative and do something interesting on the blockchain. " + - "Choose an action or set of actions and execute it that highlights your abilities."; - - // Send thought to MCP server - // Note: Implementation depends on how you want to handle autonomous mode with MCP - - await new Promise(resolve => setTimeout(resolve, interval * 1000)); - } catch (error) { - if (error instanceof Error) { - console.error("Error:", error.message); - } - process.exit(1); - } - } -} - -/** - * Run the agent interactively based on user input - */ -async function runChatMode(server: Server) { - console.log("Starting chat mode... Type 'exit' to end."); - - const rl = readline.createInterface({ - input: process.stdin, - output: process.stdout, - }); - - const question = (prompt: string): Promise => - new Promise(resolve => rl.question(prompt, resolve)); - - try { - while (true) { - const userInput = await question("\nPrompt: "); - - if (userInput.toLowerCase() === "exit") { - break; - } - - // Send user input to MCP server - // Note: Implementation depends on how you want to handle chat mode with MCP - } - } catch (error) { - if (error instanceof Error) { - console.error("Error:", error.message); - } - process.exit(1); - } finally { - rl.close(); - } -} - -/** - * Choose whether to run in autonomous or chat mode based on user input - * - * @returns Selected mode - */ -async function chooseMode(): Promise<"chat" | "auto"> { - const rl = readline.createInterface({ - input: process.stdin, - output: process.stdout, - }); - - const question = (prompt: string): Promise => - new Promise(resolve => rl.question(prompt, resolve)); - - // eslint-disable-next-line no-constant-condition - while (true) { - console.log("\nAvailable modes:"); - console.log("1. chat - Interactive chat mode"); - console.log("2. auto - Autonomous action mode"); - - const choice = (await question("\nChoose a mode (enter number or name): ")) - .toLowerCase() - .trim(); - - if (choice === "1" || choice === "chat") { - rl.close(); - return "chat"; - } else if (choice === "2" || choice === "auto") { - rl.close(); - return "auto"; - } - console.log("Invalid choice. Please try again."); - } -} - -/** - * Start the chatbot agent - */ -async function main() { - try { - const { server } = await initializeAgent(); - const mode = await chooseMode(); - - if (mode === "chat") { - await runChatMode(server); - } else { - await runAutonomousMode(server); - } - } catch (error) { - if (error instanceof Error) { - console.error("Error:", error.message); - } - process.exit(1); - } -} - -if (require.main === module) { - console.log("Starting Agent..."); - main().catch(error => { - console.error("Fatal error:", error); - process.exit(1); - }); -} diff --git a/typescript/examples/model-context-protocol-cdp-chatbot/claude_desktop_config-local.json b/typescript/examples/model-context-protocol-cdp-chatbot/claude_desktop_config-local.json new file mode 100644 index 000000000..8161b0af9 --- /dev/null +++ b/typescript/examples/model-context-protocol-cdp-chatbot/claude_desktop_config-local.json @@ -0,0 +1,14 @@ +{ + "mcpServers": { + "agentkit": { + "command": "node", + "args": [ + "/Users/carsonroscoe/Documents/Github/Coinbase/agentkit/typescript/examples/model-context-protocol-cdp-chatbot/build/index.js" + ], + "env": { + "CDP_API_KEY_NAME": "YOUR_CDP_API_KEY_NAME", + "CDP_API_KEY_PRIVATE_KEY": "YOUR_CDP_API_KEY_PRIVATE_KEY" + } + } + } +} \ No newline at end of file diff --git a/typescript/examples/model-context-protocol-cdp-chatbot/index.ts b/typescript/examples/model-context-protocol-cdp-chatbot/index.ts new file mode 100644 index 000000000..a6c2e145a --- /dev/null +++ b/typescript/examples/model-context-protocol-cdp-chatbot/index.ts @@ -0,0 +1,150 @@ +import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; +import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; +import { getMcpTools } from "@coinbase/agentkit-model-context-protocol"; +import { + AgentKit, + CdpWalletProvider, + wethActionProvider, + walletActionProvider, + erc20ActionProvider, + erc721ActionProvider, + cdpApiActionProvider, + cdpWalletActionProvider, + pythActionProvider, +} from "@coinbase/agentkit"; +import * as fs from "fs"; +import { Server } from "@modelcontextprotocol/sdk/server/index.js"; +import { CallToolRequestSchema, ListToolsRequestSchema } from "@modelcontextprotocol/sdk/types.js"; + +// Configure a file to persist the agent's CDP MPC Wallet Data +// const WALLET_DATA_FILE = "wallet_data.txt"; + +/** + * Validates that required environment variables are set + */ +function validateEnvironment(): void { + const requiredVars = ["CDP_API_KEY_NAME", "CDP_API_KEY_PRIVATE_KEY"]; + const missingVars = requiredVars.filter(varName => !process.env[varName]); + + if (missingVars.length > 0) { + console.error("Error: Required environment variables are not set:"); + missingVars.forEach(varName => { + console.error(`${varName}=your_${varName.toLowerCase()}_here`); + }); + process.exit(1); + } + + if (!process.env.NETWORK_ID) { + console.warn("Warning: NETWORK_ID not set, defaulting to base-sepolia testnet"); + } +} + +/** + * Initialize the MCP server with CDP Agentkit + */ +async function initializeServer() { + try { + // Create server instance with capabilities + const server = new Server( + { + name: "cdp-agentkit", + version: "1.0.0", + }, + { + capabilities: { + tools: {}, + }, + } + ); + + let walletDataStr: string | null = null; + + // Read existing wallet data if available + // if (fs.existsSync(WALLET_DATA_FILE)) { + // try { + // walletDataStr = fs.readFileSync(WALLET_DATA_FILE, "utf8"); + // } catch (error) { + // console.error("Error reading wallet data:", error); + // } + // } + + // Configure CDP Wallet Provider + const config = { + apiKeyName: process.env.CDP_API_KEY_NAME!, + apiKeyPrivateKey: process.env.CDP_API_KEY_PRIVATE_KEY!, + cdpWalletData: walletDataStr || undefined, + networkId: process.env.NETWORK_ID || "base-sepolia", + }; + + const walletProvider = await CdpWalletProvider.configureWithWallet(config); + + // Initialize AgentKit + const agentkit = await AgentKit.from({ + walletProvider, + actionProviders: [ + wethActionProvider(), + pythActionProvider(), + walletActionProvider(), + erc20ActionProvider(), + erc721ActionProvider(), + cdpApiActionProvider({ + apiKeyName: config.apiKeyName, + apiKeyPrivateKey: config.apiKeyPrivateKey, + }), + cdpWalletActionProvider({ + apiKeyName: config.apiKeyName, + apiKeyPrivateKey: config.apiKeyPrivateKey, + }), + ], + }); + + // Get MCP tools from AgentKit + const { tools, toolHandler } = await getMcpTools(agentkit); + + // Set up request handlers + server.setRequestHandler(ListToolsRequestSchema, async () => { + return { + tools, + }; + }); + + server.setRequestHandler(CallToolRequestSchema, async request => { + try { + return await toolHandler(request.params.name, request.params.arguments); + } catch (error) { + console.error(`Error executing tool ${request.params.name}:`, error); + throw new Error(`Tool ${request.params.name} failed: ${error}`); + } + }); + + // Save wallet data + // const exportedWallet = await walletProvider.exportWallet(); + // fs.writeFileSync(WALLET_DATA_FILE, JSON.stringify(exportedWallet)); + + return server; + } catch (error) { + console.error("Failed to initialize server:", error); + throw error; + } +} + +async function main() { + validateEnvironment(); + + try { + const server = await initializeServer(); + const transport = new StdioServerTransport(); + await server.connect(transport); + console.error("CDP AgentKit MCP Server running on stdio"); + } catch (error) { + console.error("Fatal error:", error); + process.exit(1); + } +} + +if (require.main === module) { + main().catch(error => { + console.error("Fatal error in main():", error); + process.exit(1); + }); +} \ No newline at end of file diff --git a/typescript/examples/model-context-protocol-cdp-chatbot/package.json b/typescript/examples/model-context-protocol-cdp-chatbot/package.json index d4e3a58b2..46f35ff3e 100644 --- a/typescript/examples/model-context-protocol-cdp-chatbot/package.json +++ b/typescript/examples/model-context-protocol-cdp-chatbot/package.json @@ -5,9 +5,11 @@ "private": true, "author": "Coinbase Inc.", "license": "Apache-2.0", + "bin": { + "agentkit": "./build/index.js" + }, "scripts": { - "start": "NODE_OPTIONS='--no-warnings' ts-node ./chatbot.ts", - "dev": "nodemon ./chatbot.ts", + "build": "tsc && node -e \"require('fs').chmodSync('build/index.js', '755')\"", "lint": "eslint -c .eslintrc.json *.ts", "lint:fix": "eslint -c .eslintrc.json *.ts --fix", "format": "prettier --write \"**/*.{ts,js,cjs,json,md}\"", diff --git a/typescript/examples/model-context-protocol-cdp-chatbot/tsconfig.json b/typescript/examples/model-context-protocol-cdp-chatbot/tsconfig.json index 6fee1565b..cc7256d82 100644 --- a/typescript/examples/model-context-protocol-cdp-chatbot/tsconfig.json +++ b/typescript/examples/model-context-protocol-cdp-chatbot/tsconfig.json @@ -2,8 +2,10 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "preserveSymlinks": true, - "outDir": "./dist", - "rootDir": "." + "outDir": "./build", + "rootDir": ".", + "module": "Node16", + "moduleResolution": "Node16" }, "include": ["*.ts"] } From bff052d9c85482b5f0f56afb3d57f1ff5eaeb514 Mon Sep 17 00:00:00 2001 From: CarsonRoscoe Date: Mon, 10 Mar 2025 10:30:58 -0400 Subject: [PATCH 03/19] chore: removed wallet read/writes --- .../index.ts | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/typescript/examples/model-context-protocol-cdp-chatbot/index.ts b/typescript/examples/model-context-protocol-cdp-chatbot/index.ts index a6c2e145a..c2b9a29aa 100644 --- a/typescript/examples/model-context-protocol-cdp-chatbot/index.ts +++ b/typescript/examples/model-context-protocol-cdp-chatbot/index.ts @@ -1,4 +1,3 @@ -import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; import { getMcpTools } from "@coinbase/agentkit-model-context-protocol"; import { @@ -12,13 +11,9 @@ import { cdpWalletActionProvider, pythActionProvider, } from "@coinbase/agentkit"; -import * as fs from "fs"; import { Server } from "@modelcontextprotocol/sdk/server/index.js"; import { CallToolRequestSchema, ListToolsRequestSchema } from "@modelcontextprotocol/sdk/types.js"; -// Configure a file to persist the agent's CDP MPC Wallet Data -// const WALLET_DATA_FILE = "wallet_data.txt"; - /** * Validates that required environment variables are set */ @@ -57,22 +52,10 @@ async function initializeServer() { } ); - let walletDataStr: string | null = null; - - // Read existing wallet data if available - // if (fs.existsSync(WALLET_DATA_FILE)) { - // try { - // walletDataStr = fs.readFileSync(WALLET_DATA_FILE, "utf8"); - // } catch (error) { - // console.error("Error reading wallet data:", error); - // } - // } - // Configure CDP Wallet Provider const config = { apiKeyName: process.env.CDP_API_KEY_NAME!, apiKeyPrivateKey: process.env.CDP_API_KEY_PRIVATE_KEY!, - cdpWalletData: walletDataStr || undefined, networkId: process.env.NETWORK_ID || "base-sepolia", }; @@ -117,9 +100,6 @@ async function initializeServer() { } }); - // Save wallet data - // const exportedWallet = await walletProvider.exportWallet(); - // fs.writeFileSync(WALLET_DATA_FILE, JSON.stringify(exportedWallet)); return server; } catch (error) { From 15b47de6c4c7ca02d14e0014b0f50d9991ae6679 Mon Sep 17 00:00:00 2001 From: CarsonRoscoe Date: Mon, 10 Mar 2025 10:38:54 -0400 Subject: [PATCH 04/19] chore: updated README --- .../README.md | 26 +++++++------------ .../claude_desktop_config-local.json | 2 +- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/typescript/examples/model-context-protocol-cdp-chatbot/README.md b/typescript/examples/model-context-protocol-cdp-chatbot/README.md index 29ebf7dc9..6c62dba22 100644 --- a/typescript/examples/model-context-protocol-cdp-chatbot/README.md +++ b/typescript/examples/model-context-protocol-cdp-chatbot/README.md @@ -1,6 +1,6 @@ -# CDP AgentKit LangChain Extension Examples - Chatbot Typescript +# CDP AgentKit Model Context Protocol Examples - Chatbot Typescript -This example demonstrates an agent setup as a terminal style chatbot with access to the full set of CDP AgentKit actions. +This example demonstrates an agent setup as a server for Model Context Protocol, allowing Claude Desktop access to the full set of CDP AgentKit actions. ## Ask the chatbot to engage in the Web3 ecosystem! @@ -29,15 +29,15 @@ This will automatically install and use the latest version of Node. ### API Keys -You'll need the following API keys: +You'll need the following API key: - [CDP API Key](https://portal.cdp.coinbase.com/access/api) -- [OpenAI API Key](https://platform.openai.com/docs/quickstart#create-and-export-an-api-key) -Once you have them, rename the `.env-local` file to `.env` and make sure you set the API keys to their corresponding environment variables: +You'll need to configure the Claude desktop config file with your CDP API keys. Copy the contents from `claude_desktop_config-local.json` to your Claude desktop config file and update the following: -- "CDP_API_KEY_NAME" -- "CDP_API_KEY_PRIVATE_KEY" -- "OPENAI_API_KEY" +1. Update the `args` path to match the location of your built index.js file +2. Set your CDP API keys in the `env` section: + - "CDP_API_KEY_NAME" + - "CDP_API_KEY_PRIVATE_KEY" ## Running the example @@ -48,15 +48,9 @@ npm install npm run build ``` -This will install the dependencies and build the packages locally. The chatbot example uses the local `@coinbase/agentkit-langchain` and `@coinbase/agentkit` packages. If you make changes to the packages, you can run `npm run build` from root again to rebuild the packages, and your changes will be reflected in the chatbot example. +This will install the dependencies and build the packages locally. The chatbot example uses the local `@coinbase/agentkit-model-context-protocol` and `@coinbase/agentkit` packages. If you make changes to the packages, you can run `npm run build` from root again to rebuild the packages, and your changes will be reflected in the chatbot example. -Now from the `typescript/examples/langchain-cdp-chatbot` directory, run: - -```bash -npm start -``` - -Select "1. chat mode" and start telling your Agent to do things onchain! +To use the chatbot, simply open Claude desktop after configuring your API keys. The MCP server will run automatically when you interact with Claude. ## License diff --git a/typescript/examples/model-context-protocol-cdp-chatbot/claude_desktop_config-local.json b/typescript/examples/model-context-protocol-cdp-chatbot/claude_desktop_config-local.json index 8161b0af9..e3bb37391 100644 --- a/typescript/examples/model-context-protocol-cdp-chatbot/claude_desktop_config-local.json +++ b/typescript/examples/model-context-protocol-cdp-chatbot/claude_desktop_config-local.json @@ -3,7 +3,7 @@ "agentkit": { "command": "node", "args": [ - "/Users/carsonroscoe/Documents/Github/Coinbase/agentkit/typescript/examples/model-context-protocol-cdp-chatbot/build/index.js" + "/Users/YOUR_USER/YOUR_DIRECTORIES/agentkit/typescript/examples/model-context-protocol-cdp-chatbot/build/index.js" ], "env": { "CDP_API_KEY_NAME": "YOUR_CDP_API_KEY_NAME", From c99dc52ad029c2391160429d9549a708a2666b27 Mon Sep 17 00:00:00 2001 From: CarsonRoscoe Date: Mon, 10 Mar 2025 10:41:12 -0400 Subject: [PATCH 05/19] chore: added examples to parent READMEs --- CONTRIBUTING.md | 1 + README.md | 1 + 2 files changed, 2 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 807f866eb..d52f7e5ad 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -27,6 +27,7 @@ agentkit/ │ ├── langchain-privy-chatbot/ │ ├── langchain-solana-chatbot/ │ ├── langchain-twitter-chatbot/ +│ ├── model-context-protocol-cdp-chatbot/ │ └── vercel-ai-sdk-cdp-chatbot/ ├── python/ │ ├── coinbase-agentkit/ diff --git a/README.md b/README.md index e205d5ba2..e93a11299 100644 --- a/README.md +++ b/README.md @@ -149,6 +149,7 @@ agentkit/ │ ├── langchain-privy-chatbot/ │ ├── langchain-solana-chatbot/ │ ├── langchain-twitter-chatbot/ +│ ├── model-context-protocol-cdp-chatbot/ │ └── vercel-ai-sdk-cdp-chatbot/ ├── python/ │ ├── coinbase-agentkit/ From 62af4c2e4971ae4b407c94aced393baf60e2585a Mon Sep 17 00:00:00 2001 From: CarsonRoscoe Date: Mon, 10 Mar 2025 10:42:52 -0400 Subject: [PATCH 06/19] chore: format/lint --- .../claude_desktop_config-local.json | 24 +++++++++---------- .../index.ts | 16 +++++++++---- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/typescript/examples/model-context-protocol-cdp-chatbot/claude_desktop_config-local.json b/typescript/examples/model-context-protocol-cdp-chatbot/claude_desktop_config-local.json index e3bb37391..ca7092f02 100644 --- a/typescript/examples/model-context-protocol-cdp-chatbot/claude_desktop_config-local.json +++ b/typescript/examples/model-context-protocol-cdp-chatbot/claude_desktop_config-local.json @@ -1,14 +1,14 @@ { - "mcpServers": { - "agentkit": { - "command": "node", - "args": [ - "/Users/YOUR_USER/YOUR_DIRECTORIES/agentkit/typescript/examples/model-context-protocol-cdp-chatbot/build/index.js" - ], - "env": { - "CDP_API_KEY_NAME": "YOUR_CDP_API_KEY_NAME", - "CDP_API_KEY_PRIVATE_KEY": "YOUR_CDP_API_KEY_PRIVATE_KEY" - } - } + "mcpServers": { + "agentkit": { + "command": "node", + "args": [ + "/Users/YOUR_USER/YOUR_DIRECTORIES/agentkit/typescript/examples/model-context-protocol-cdp-chatbot/build/index.js" + ], + "env": { + "CDP_API_KEY_NAME": "YOUR_CDP_API_KEY_NAME", + "CDP_API_KEY_PRIVATE_KEY": "YOUR_CDP_API_KEY_PRIVATE_KEY" + } } -} \ No newline at end of file + } +} diff --git a/typescript/examples/model-context-protocol-cdp-chatbot/index.ts b/typescript/examples/model-context-protocol-cdp-chatbot/index.ts index c2b9a29aa..236393bf7 100644 --- a/typescript/examples/model-context-protocol-cdp-chatbot/index.ts +++ b/typescript/examples/model-context-protocol-cdp-chatbot/index.ts @@ -35,7 +35,11 @@ function validateEnvironment(): void { } /** - * Initialize the MCP server with CDP Agentkit + * This function creates a new server instance with the capabilities to handle MCP requests. + * It configures the CDP Wallet Provider with the provided API keys and network ID. + * It then initializes the AgentKit with the configured wallet provider and action providers. + * + * @returns {Promise} The initialized MCP server */ async function initializeServer() { try { @@ -49,7 +53,7 @@ async function initializeServer() { capabilities: { tools: {}, }, - } + }, ); // Configure CDP Wallet Provider @@ -100,7 +104,6 @@ async function initializeServer() { } }); - return server; } catch (error) { console.error("Failed to initialize server:", error); @@ -108,9 +111,12 @@ async function initializeServer() { } } +/** + * Main function to run the MCP server + */ async function main() { validateEnvironment(); - + try { const server = await initializeServer(); const transport = new StdioServerTransport(); @@ -127,4 +133,4 @@ if (require.main === module) { console.error("Fatal error in main():", error); process.exit(1); }); -} \ No newline at end of file +} From 04cd74cd5b3fac42aa909fcef66365e749dc291e Mon Sep 17 00:00:00 2001 From: CarsonRoscoe Date: Mon, 10 Mar 2025 10:48:44 -0400 Subject: [PATCH 07/19] chore: added build to ignore --- .../examples/model-context-protocol-cdp-chatbot/.prettierignore | 1 + 1 file changed, 1 insertion(+) diff --git a/typescript/examples/model-context-protocol-cdp-chatbot/.prettierignore b/typescript/examples/model-context-protocol-cdp-chatbot/.prettierignore index 20de531f4..ed251d161 100644 --- a/typescript/examples/model-context-protocol-cdp-chatbot/.prettierignore +++ b/typescript/examples/model-context-protocol-cdp-chatbot/.prettierignore @@ -1,5 +1,6 @@ docs/ dist/ +build/ coverage/ .github/ src/client From 1c5ec969eacd14f54cabd6b40674b3db21f9ecba Mon Sep 17 00:00:00 2001 From: CarsonRoscoe Date: Mon, 10 Mar 2025 10:55:05 -0400 Subject: [PATCH 08/19] fix: package dependencies --- .../package.json | 4 +- typescript/package-lock.json | 39 ++++++++++++++++++- 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/typescript/examples/model-context-protocol-cdp-chatbot/package.json b/typescript/examples/model-context-protocol-cdp-chatbot/package.json index 46f35ff3e..b41a66765 100644 --- a/typescript/examples/model-context-protocol-cdp-chatbot/package.json +++ b/typescript/examples/model-context-protocol-cdp-chatbot/package.json @@ -17,8 +17,8 @@ }, "dependencies": { "@coinbase/agentkit": "^0.2.3", - "@coinbase/agentkit-model-context-protocol": "^0.2.3", - "@modelcontextprotocol/sdk": "^0.1.0", + "@coinbase/agentkit-model-context-protocol": "^0.1.0", + "@modelcontextprotocol/sdk": "^1.6.1", "dotenv": "^16.4.5", "zod": "^3.22.4" }, diff --git a/typescript/package-lock.json b/typescript/package-lock.json index 23aa3700a..75b2b6009 100644 --- a/typescript/package-lock.json +++ b/typescript/package-lock.json @@ -19,7 +19,8 @@ "examples/langchain-privy-chatbot", "examples/langchain-solana-chatbot", "examples/langchain-smart-wallet-chatbot", - "examples/vercel-ai-sdk-cdp-chatbot" + "examples/vercel-ai-sdk-cdp-chatbot", + "examples/model-context-protocol-cdp-chatbot" ], "devDependencies": { "@changesets/changelog-github": "^0.5.1", @@ -467,6 +468,25 @@ "ts-node": "^10.9.2" } }, + "examples/model-context-protocol-cdp-chatbot": { + "name": "@coinbase/cdp-model-context-protocol-chatbot-example", + "version": "1.0.0", + "license": "Apache-2.0", + "dependencies": { + "@coinbase/agentkit": "^0.2.3", + "@coinbase/agentkit-model-context-protocol": "^0.1.0", + "@modelcontextprotocol/sdk": "^1.6.1", + "dotenv": "^16.4.5", + "zod": "^3.22.4" + }, + "bin": { + "agentkit": "build/index.js" + }, + "devDependencies": { + "nodemon": "^3.1.0", + "ts-node": "^10.9.2" + } + }, "examples/vercel-ai-sdk-cdp-chatbot": { "name": "@coinbase/cdp-vercel-ai-sdk-chatbot-example", "version": "1.0.0", @@ -1595,6 +1615,10 @@ "resolved": "examples/langchain-cdp-chatbot", "link": true }, + "node_modules/@coinbase/cdp-model-context-protocol-chatbot-example": { + "resolved": "examples/model-context-protocol-cdp-chatbot", + "link": true + }, "node_modules/@coinbase/cdp-vercel-ai-sdk-chatbot-example": { "resolved": "examples/vercel-ai-sdk-cdp-chatbot", "link": true @@ -3470,6 +3494,7 @@ "version": "1.6.1", "resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.6.1.tgz", "integrity": "sha512-oxzMzYCkZHMntzuyerehK3fV6A2Kwh5BD6CGEJSVDU2QNEhfLOptf2X7esQgaHZXHZY0oHmMsOtIDLP71UJXgA==", + "license": "MIT", "dependencies": { "content-type": "^1.0.5", "cors": "^2.8.5", @@ -20246,6 +20271,18 @@ "zod": "^3.22.4" } }, + "@coinbase/cdp-model-context-protocol-chatbot-example": { + "version": "file:examples/model-context-protocol-cdp-chatbot", + "requires": { + "@coinbase/agentkit": "^0.2.3", + "@coinbase/agentkit-model-context-protocol": "^0.1.0", + "@modelcontextprotocol/sdk": "^1.6.1", + "dotenv": "^16.4.5", + "nodemon": "^3.1.0", + "ts-node": "^10.9.2", + "zod": "^3.22.4" + } + }, "@coinbase/cdp-vercel-ai-sdk-chatbot-example": { "version": "file:examples/vercel-ai-sdk-cdp-chatbot", "requires": { From ddbbbde1fcf96abb009e3a6af3e27d6b7d69d3da Mon Sep 17 00:00:00 2001 From: CarsonRoscoe Date: Mon, 10 Mar 2025 10:58:13 -0400 Subject: [PATCH 09/19] chore: change build folder to dist --- .../claude_desktop_config-local.json | 2 +- .../examples/model-context-protocol-cdp-chatbot/package.json | 4 ++-- .../examples/model-context-protocol-cdp-chatbot/tsconfig.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/typescript/examples/model-context-protocol-cdp-chatbot/claude_desktop_config-local.json b/typescript/examples/model-context-protocol-cdp-chatbot/claude_desktop_config-local.json index ca7092f02..17fdbf0e8 100644 --- a/typescript/examples/model-context-protocol-cdp-chatbot/claude_desktop_config-local.json +++ b/typescript/examples/model-context-protocol-cdp-chatbot/claude_desktop_config-local.json @@ -3,7 +3,7 @@ "agentkit": { "command": "node", "args": [ - "/Users/YOUR_USER/YOUR_DIRECTORIES/agentkit/typescript/examples/model-context-protocol-cdp-chatbot/build/index.js" + "/Users/YOUR_USER/YOUR_DIRECTORIES/agentkit/typescript/examples/model-context-protocol-cdp-chatbot/dist/index.js" ], "env": { "CDP_API_KEY_NAME": "YOUR_CDP_API_KEY_NAME", diff --git a/typescript/examples/model-context-protocol-cdp-chatbot/package.json b/typescript/examples/model-context-protocol-cdp-chatbot/package.json index b41a66765..d2cc11eaa 100644 --- a/typescript/examples/model-context-protocol-cdp-chatbot/package.json +++ b/typescript/examples/model-context-protocol-cdp-chatbot/package.json @@ -6,10 +6,10 @@ "author": "Coinbase Inc.", "license": "Apache-2.0", "bin": { - "agentkit": "./build/index.js" + "agentkit": "./dist/index.js" }, "scripts": { - "build": "tsc && node -e \"require('fs').chmodSync('build/index.js', '755')\"", + "build": "tsc && node -e \"require('fs').chmodSync('dist/index.js', '755')\"", "lint": "eslint -c .eslintrc.json *.ts", "lint:fix": "eslint -c .eslintrc.json *.ts --fix", "format": "prettier --write \"**/*.{ts,js,cjs,json,md}\"", diff --git a/typescript/examples/model-context-protocol-cdp-chatbot/tsconfig.json b/typescript/examples/model-context-protocol-cdp-chatbot/tsconfig.json index cc7256d82..14fe77b8b 100644 --- a/typescript/examples/model-context-protocol-cdp-chatbot/tsconfig.json +++ b/typescript/examples/model-context-protocol-cdp-chatbot/tsconfig.json @@ -2,7 +2,7 @@ "extends": "../../tsconfig.base.json", "compilerOptions": { "preserveSymlinks": true, - "outDir": "./build", + "outDir": "./dist", "rootDir": ".", "module": "Node16", "moduleResolution": "Node16" From 0cff3454722e461811274cde15d64d337fc235bc Mon Sep 17 00:00:00 2001 From: CarsonRoscoe Date: Mon, 10 Mar 2025 10:58:43 -0400 Subject: [PATCH 10/19] chore: package-lock --- typescript/package-lock.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typescript/package-lock.json b/typescript/package-lock.json index 75b2b6009..0e3fedfc6 100644 --- a/typescript/package-lock.json +++ b/typescript/package-lock.json @@ -480,7 +480,7 @@ "zod": "^3.22.4" }, "bin": { - "agentkit": "build/index.js" + "agentkit": "dist/index.js" }, "devDependencies": { "nodemon": "^3.1.0", From 57ad17af5599d61da725bff0670a51d41191dc36 Mon Sep 17 00:00:00 2001 From: CarsonRoscoe Date: Mon, 10 Mar 2025 11:20:56 -0400 Subject: [PATCH 11/19] chore: fixed package-lock.json --- typescript/package-lock.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/typescript/package-lock.json b/typescript/package-lock.json index 0e3fedfc6..e103dbb7f 100644 --- a/typescript/package-lock.json +++ b/typescript/package-lock.json @@ -469,7 +469,6 @@ } }, "examples/model-context-protocol-cdp-chatbot": { - "name": "@coinbase/cdp-model-context-protocol-chatbot-example", "version": "1.0.0", "license": "Apache-2.0", "dependencies": { @@ -3494,7 +3493,6 @@ "version": "1.6.1", "resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.6.1.tgz", "integrity": "sha512-oxzMzYCkZHMntzuyerehK3fV6A2Kwh5BD6CGEJSVDU2QNEhfLOptf2X7esQgaHZXHZY0oHmMsOtIDLP71UJXgA==", - "license": "MIT", "dependencies": { "content-type": "^1.0.5", "cors": "^2.8.5", From 1c242da1f182662d16c86833dec7020637c45aae Mon Sep 17 00:00:00 2001 From: CarsonRoscoe Date: Mon, 10 Mar 2025 11:23:53 -0400 Subject: [PATCH 12/19] chore: removed dotenv dependency --- .../examples/model-context-protocol-cdp-chatbot/package.json | 1 - typescript/package-lock.json | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/typescript/examples/model-context-protocol-cdp-chatbot/package.json b/typescript/examples/model-context-protocol-cdp-chatbot/package.json index d2cc11eaa..2be851920 100644 --- a/typescript/examples/model-context-protocol-cdp-chatbot/package.json +++ b/typescript/examples/model-context-protocol-cdp-chatbot/package.json @@ -19,7 +19,6 @@ "@coinbase/agentkit": "^0.2.3", "@coinbase/agentkit-model-context-protocol": "^0.1.0", "@modelcontextprotocol/sdk": "^1.6.1", - "dotenv": "^16.4.5", "zod": "^3.22.4" }, "devDependencies": { diff --git a/typescript/package-lock.json b/typescript/package-lock.json index e103dbb7f..febf7ddf4 100644 --- a/typescript/package-lock.json +++ b/typescript/package-lock.json @@ -469,13 +469,13 @@ } }, "examples/model-context-protocol-cdp-chatbot": { + "name": "@coinbase/cdp-model-context-protocol-chatbot-example", "version": "1.0.0", "license": "Apache-2.0", "dependencies": { "@coinbase/agentkit": "^0.2.3", "@coinbase/agentkit-model-context-protocol": "^0.1.0", "@modelcontextprotocol/sdk": "^1.6.1", - "dotenv": "^16.4.5", "zod": "^3.22.4" }, "bin": { @@ -20275,7 +20275,6 @@ "@coinbase/agentkit": "^0.2.3", "@coinbase/agentkit-model-context-protocol": "^0.1.0", "@modelcontextprotocol/sdk": "^1.6.1", - "dotenv": "^16.4.5", "nodemon": "^3.1.0", "ts-node": "^10.9.2", "zod": "^3.22.4" From 7a73d4ec1b8a1804a6f68ee034f74188df76fd5c Mon Sep 17 00:00:00 2001 From: CarsonRoscoe Date: Mon, 10 Mar 2025 11:41:00 -0400 Subject: [PATCH 13/19] chore: removed moduleResolution from tsconfig --- .../examples/model-context-protocol-cdp-chatbot/tsconfig.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/typescript/examples/model-context-protocol-cdp-chatbot/tsconfig.json b/typescript/examples/model-context-protocol-cdp-chatbot/tsconfig.json index 14fe77b8b..a37da3664 100644 --- a/typescript/examples/model-context-protocol-cdp-chatbot/tsconfig.json +++ b/typescript/examples/model-context-protocol-cdp-chatbot/tsconfig.json @@ -4,8 +4,7 @@ "preserveSymlinks": true, "outDir": "./dist", "rootDir": ".", - "module": "Node16", - "moduleResolution": "Node16" + "module": "Node16" }, "include": ["*.ts"] } From 93cde16ad9a9f933b564fc791baf12a0cb01122c Mon Sep 17 00:00:00 2001 From: CarsonRoscoe Date: Tue, 11 Mar 2025 17:49:58 -0400 Subject: [PATCH 14/19] fix: package-lock --- typescript/package-lock.json | 58 ++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/typescript/package-lock.json b/typescript/package-lock.json index febf7ddf4..5cff2c5d8 100644 --- a/typescript/package-lock.json +++ b/typescript/package-lock.json @@ -486,6 +486,34 @@ "ts-node": "^10.9.2" } }, + "examples/model-context-protocol-cdp-chatbot/node_modules/@coinbase/agentkit": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@coinbase/agentkit/-/agentkit-0.2.3.tgz", + "integrity": "sha512-BnmkQgvoz73RgXNBiqNOfk6/dio1of3oJftzMpZNBfJYHnnXWEXEkXrXefVRjVfEjWVb3cKDSHZ0mAyFQjrqoA==", + "dependencies": { + "@coinbase/coinbase-sdk": "^0.20.0", + "@jup-ag/api": "^6.0.39", + "@privy-io/server-auth": "^1.18.4", + "@solana/spl-token": "^0.4.12", + "@solana/web3.js": "^1.98.0", + "md5": "^2.3.0", + "reflect-metadata": "^0.2.2", + "twitter-api-v2": "^1.18.2", + "viem": "^2.22.16", + "zod": "^3.23.8" + } + }, + "examples/model-context-protocol-cdp-chatbot/node_modules/@coinbase/agentkit-model-context-protocol": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/@coinbase/agentkit-model-context-protocol/-/agentkit-model-context-protocol-0.1.0.tgz", + "integrity": "sha512-Bx7zThE3moeIGqc6fwp1Y3Oph1IFG36clvV0ohxvAbUfIyJj7knT7puTFeuodSOLvljhrLnwQ3TVTXQNY0HBcA==", + "dependencies": { + "@coinbase/agentkit": "^0.2.3", + "@modelcontextprotocol/sdk": "^1.6.1", + "zod": "^3.22.4", + "zod-to-json-schema": "^3.24.3" + } + }, "examples/vercel-ai-sdk-cdp-chatbot": { "name": "@coinbase/cdp-vercel-ai-sdk-chatbot-example", "version": "1.0.0", @@ -20278,6 +20306,36 @@ "nodemon": "^3.1.0", "ts-node": "^10.9.2", "zod": "^3.22.4" + }, + "dependencies": { + "@coinbase/agentkit": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@coinbase/agentkit/-/agentkit-0.2.3.tgz", + "integrity": "sha512-BnmkQgvoz73RgXNBiqNOfk6/dio1of3oJftzMpZNBfJYHnnXWEXEkXrXefVRjVfEjWVb3cKDSHZ0mAyFQjrqoA==", + "requires": { + "@coinbase/coinbase-sdk": "^0.20.0", + "@jup-ag/api": "^6.0.39", + "@privy-io/server-auth": "^1.18.4", + "@solana/spl-token": "^0.4.12", + "@solana/web3.js": "^1.98.0", + "md5": "^2.3.0", + "reflect-metadata": "^0.2.2", + "twitter-api-v2": "^1.18.2", + "viem": "^2.22.16", + "zod": "^3.23.8" + } + }, + "@coinbase/agentkit-model-context-protocol": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/@coinbase/agentkit-model-context-protocol/-/agentkit-model-context-protocol-0.1.0.tgz", + "integrity": "sha512-Bx7zThE3moeIGqc6fwp1Y3Oph1IFG36clvV0ohxvAbUfIyJj7knT7puTFeuodSOLvljhrLnwQ3TVTXQNY0HBcA==", + "requires": { + "@coinbase/agentkit": "^0.2.3", + "@modelcontextprotocol/sdk": "^1.6.1", + "zod": "^3.22.4", + "zod-to-json-schema": "^3.24.3" + } + } } }, "@coinbase/cdp-vercel-ai-sdk-chatbot-example": { From 2ef2ab0b2ef8c16a4a7c70998c6a67d0248515a1 Mon Sep 17 00:00:00 2001 From: CarsonRoscoe Date: Wed, 12 Mar 2025 10:21:48 -0400 Subject: [PATCH 15/19] pr feedback --- CONTRIBUTING.md | 2 +- README.md | 2 +- .../.eslintrc.json | 0 .../.prettierignore | 0 .../.prettierrc | 0 .../README.md | 0 .../claude_desktop_config-local.json | 0 .../index.ts | 0 .../package.json | 6 ++-- .../tsconfig.json | 0 typescript/package-lock.json | 32 +++++++++++++++---- typescript/package.json | 2 +- 12 files changed, 31 insertions(+), 13 deletions(-) rename typescript/examples/{model-context-protocol-cdp-chatbot => model-context-protocol-cdp-server}/.eslintrc.json (100%) rename typescript/examples/{model-context-protocol-cdp-chatbot => model-context-protocol-cdp-server}/.prettierignore (100%) rename typescript/examples/{model-context-protocol-cdp-chatbot => model-context-protocol-cdp-server}/.prettierrc (100%) rename typescript/examples/{model-context-protocol-cdp-chatbot => model-context-protocol-cdp-server}/README.md (100%) rename typescript/examples/{model-context-protocol-cdp-chatbot => model-context-protocol-cdp-server}/claude_desktop_config-local.json (100%) rename typescript/examples/{model-context-protocol-cdp-chatbot => model-context-protocol-cdp-server}/index.ts (100%) rename typescript/examples/{model-context-protocol-cdp-chatbot => model-context-protocol-cdp-server}/package.json (82%) rename typescript/examples/{model-context-protocol-cdp-chatbot => model-context-protocol-cdp-server}/tsconfig.json (100%) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d52f7e5ad..e8d6cf73f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -27,7 +27,7 @@ agentkit/ │ ├── langchain-privy-chatbot/ │ ├── langchain-solana-chatbot/ │ ├── langchain-twitter-chatbot/ -│ ├── model-context-protocol-cdp-chatbot/ +│ ├── model-context-protocol-cdp-server/ │ └── vercel-ai-sdk-cdp-chatbot/ ├── python/ │ ├── coinbase-agentkit/ diff --git a/README.md b/README.md index e93a11299..87ab62246 100644 --- a/README.md +++ b/README.md @@ -149,7 +149,7 @@ agentkit/ │ ├── langchain-privy-chatbot/ │ ├── langchain-solana-chatbot/ │ ├── langchain-twitter-chatbot/ -│ ├── model-context-protocol-cdp-chatbot/ +│ ├── model-context-protocol-cdp-server/ │ └── vercel-ai-sdk-cdp-chatbot/ ├── python/ │ ├── coinbase-agentkit/ diff --git a/typescript/examples/model-context-protocol-cdp-chatbot/.eslintrc.json b/typescript/examples/model-context-protocol-cdp-server/.eslintrc.json similarity index 100% rename from typescript/examples/model-context-protocol-cdp-chatbot/.eslintrc.json rename to typescript/examples/model-context-protocol-cdp-server/.eslintrc.json diff --git a/typescript/examples/model-context-protocol-cdp-chatbot/.prettierignore b/typescript/examples/model-context-protocol-cdp-server/.prettierignore similarity index 100% rename from typescript/examples/model-context-protocol-cdp-chatbot/.prettierignore rename to typescript/examples/model-context-protocol-cdp-server/.prettierignore diff --git a/typescript/examples/model-context-protocol-cdp-chatbot/.prettierrc b/typescript/examples/model-context-protocol-cdp-server/.prettierrc similarity index 100% rename from typescript/examples/model-context-protocol-cdp-chatbot/.prettierrc rename to typescript/examples/model-context-protocol-cdp-server/.prettierrc diff --git a/typescript/examples/model-context-protocol-cdp-chatbot/README.md b/typescript/examples/model-context-protocol-cdp-server/README.md similarity index 100% rename from typescript/examples/model-context-protocol-cdp-chatbot/README.md rename to typescript/examples/model-context-protocol-cdp-server/README.md diff --git a/typescript/examples/model-context-protocol-cdp-chatbot/claude_desktop_config-local.json b/typescript/examples/model-context-protocol-cdp-server/claude_desktop_config-local.json similarity index 100% rename from typescript/examples/model-context-protocol-cdp-chatbot/claude_desktop_config-local.json rename to typescript/examples/model-context-protocol-cdp-server/claude_desktop_config-local.json diff --git a/typescript/examples/model-context-protocol-cdp-chatbot/index.ts b/typescript/examples/model-context-protocol-cdp-server/index.ts similarity index 100% rename from typescript/examples/model-context-protocol-cdp-chatbot/index.ts rename to typescript/examples/model-context-protocol-cdp-server/index.ts diff --git a/typescript/examples/model-context-protocol-cdp-chatbot/package.json b/typescript/examples/model-context-protocol-cdp-server/package.json similarity index 82% rename from typescript/examples/model-context-protocol-cdp-chatbot/package.json rename to typescript/examples/model-context-protocol-cdp-server/package.json index 2be851920..9b304feec 100644 --- a/typescript/examples/model-context-protocol-cdp-chatbot/package.json +++ b/typescript/examples/model-context-protocol-cdp-server/package.json @@ -1,6 +1,6 @@ { - "name": "@coinbase/cdp-model-context-protocol-chatbot-example", - "description": "CDP Agentkit Node.js SDK Chatbot Example with Model Context Protocol", + "name": "@coinbase/cdp-model-context-protocol-server", + "description": "Coinbase AgentKit Example Model Context Protocol Server", "version": "1.0.0", "private": true, "author": "Coinbase Inc.", @@ -20,7 +20,7 @@ "@coinbase/agentkit-model-context-protocol": "^0.1.0", "@modelcontextprotocol/sdk": "^1.6.1", "zod": "^3.22.4" - }, +}, "devDependencies": { "nodemon": "^3.1.0", "ts-node": "^10.9.2" diff --git a/typescript/examples/model-context-protocol-cdp-chatbot/tsconfig.json b/typescript/examples/model-context-protocol-cdp-server/tsconfig.json similarity index 100% rename from typescript/examples/model-context-protocol-cdp-chatbot/tsconfig.json rename to typescript/examples/model-context-protocol-cdp-server/tsconfig.json diff --git a/typescript/package-lock.json b/typescript/package-lock.json index 5cff2c5d8..cd8bb35f4 100644 --- a/typescript/package-lock.json +++ b/typescript/package-lock.json @@ -20,7 +20,7 @@ "examples/langchain-solana-chatbot", "examples/langchain-smart-wallet-chatbot", "examples/vercel-ai-sdk-cdp-chatbot", - "examples/model-context-protocol-cdp-chatbot" + "examples/model-context-protocol-cdp-server" ], "devDependencies": { "@changesets/changelog-github": "^0.5.1", @@ -470,6 +470,24 @@ }, "examples/model-context-protocol-cdp-chatbot": { "name": "@coinbase/cdp-model-context-protocol-chatbot-example", + "version": "1.0.0", + "extraneous": true, + "license": "Apache-2.0", + "dependencies": { + "@coinbase/agentkit": "^0.2.3", + "@coinbase/agentkit-model-context-protocol": "^0.1.0", + "@modelcontextprotocol/sdk": "^1.6.1", + "zod": "^3.22.4" + }, + "bin": { + "agentkit": "dist/index.js" + }, + "devDependencies": { + "nodemon": "^3.1.0", + "ts-node": "^10.9.2" + } + }, + "examples/model-context-protocol-cdp-server": { "version": "1.0.0", "license": "Apache-2.0", "dependencies": { @@ -486,7 +504,7 @@ "ts-node": "^10.9.2" } }, - "examples/model-context-protocol-cdp-chatbot/node_modules/@coinbase/agentkit": { + "examples/model-context-protocol-cdp-server/node_modules/@coinbase/agentkit": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/@coinbase/agentkit/-/agentkit-0.2.3.tgz", "integrity": "sha512-BnmkQgvoz73RgXNBiqNOfk6/dio1of3oJftzMpZNBfJYHnnXWEXEkXrXefVRjVfEjWVb3cKDSHZ0mAyFQjrqoA==", @@ -503,7 +521,7 @@ "zod": "^3.23.8" } }, - "examples/model-context-protocol-cdp-chatbot/node_modules/@coinbase/agentkit-model-context-protocol": { + "examples/model-context-protocol-cdp-server/node_modules/@coinbase/agentkit-model-context-protocol": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/@coinbase/agentkit-model-context-protocol/-/agentkit-model-context-protocol-0.1.0.tgz", "integrity": "sha512-Bx7zThE3moeIGqc6fwp1Y3Oph1IFG36clvV0ohxvAbUfIyJj7knT7puTFeuodSOLvljhrLnwQ3TVTXQNY0HBcA==", @@ -1642,8 +1660,8 @@ "resolved": "examples/langchain-cdp-chatbot", "link": true }, - "node_modules/@coinbase/cdp-model-context-protocol-chatbot-example": { - "resolved": "examples/model-context-protocol-cdp-chatbot", + "node_modules/@coinbase/cdp-model-context-protocol-server": { + "resolved": "examples/model-context-protocol-cdp-server", "link": true }, "node_modules/@coinbase/cdp-vercel-ai-sdk-chatbot-example": { @@ -20297,8 +20315,8 @@ "zod": "^3.22.4" } }, - "@coinbase/cdp-model-context-protocol-chatbot-example": { - "version": "file:examples/model-context-protocol-cdp-chatbot", + "@coinbase/cdp-model-context-protocol-server": { + "version": "file:examples/model-context-protocol-cdp-server", "requires": { "@coinbase/agentkit": "^0.2.3", "@coinbase/agentkit-model-context-protocol": "^0.1.0", diff --git a/typescript/package.json b/typescript/package.json index f7fd8bd30..917658a1d 100644 --- a/typescript/package.json +++ b/typescript/package.json @@ -15,7 +15,7 @@ "examples/langchain-solana-chatbot", "examples/langchain-smart-wallet-chatbot", "examples/vercel-ai-sdk-cdp-chatbot", - "examples/model-context-protocol-cdp-chatbot" + "examples/model-context-protocol-cdp-server" ], "packageManager": "npm@8.9.0", "scripts": { From c76b23dddcea41962afcc83aef7d5fe42036e27f Mon Sep 17 00:00:00 2001 From: CarsonRoscoe Date: Wed, 12 Mar 2025 10:22:48 -0400 Subject: [PATCH 16/19] chore: lint format --- .../examples/model-context-protocol-cdp-server/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typescript/examples/model-context-protocol-cdp-server/package.json b/typescript/examples/model-context-protocol-cdp-server/package.json index 9b304feec..dc3e9e50d 100644 --- a/typescript/examples/model-context-protocol-cdp-server/package.json +++ b/typescript/examples/model-context-protocol-cdp-server/package.json @@ -20,7 +20,7 @@ "@coinbase/agentkit-model-context-protocol": "^0.1.0", "@modelcontextprotocol/sdk": "^1.6.1", "zod": "^3.22.4" -}, + }, "devDependencies": { "nodemon": "^3.1.0", "ts-node": "^10.9.2" From fe7e0ee6fcf34e64151f98ffc27f459994972544 Mon Sep 17 00:00:00 2001 From: CarsonRoscoe Date: Wed, 12 Mar 2025 10:25:08 -0400 Subject: [PATCH 17/19] fix: package-lock --- typescript/package-lock.json | 1 + 1 file changed, 1 insertion(+) diff --git a/typescript/package-lock.json b/typescript/package-lock.json index cd8bb35f4..cfd40db82 100644 --- a/typescript/package-lock.json +++ b/typescript/package-lock.json @@ -488,6 +488,7 @@ } }, "examples/model-context-protocol-cdp-server": { + "name": "@coinbase/cdp-model-context-protocol-server", "version": "1.0.0", "license": "Apache-2.0", "dependencies": { From bdc809a63722626fd03a2692b8e2735d31cc573d Mon Sep 17 00:00:00 2001 From: CarsonRoscoe Date: Wed, 12 Mar 2025 10:38:46 -0400 Subject: [PATCH 18/19] fix: claud config arg for server location --- .../claude_desktop_config-local.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typescript/examples/model-context-protocol-cdp-server/claude_desktop_config-local.json b/typescript/examples/model-context-protocol-cdp-server/claude_desktop_config-local.json index 17fdbf0e8..366b1bfae 100644 --- a/typescript/examples/model-context-protocol-cdp-server/claude_desktop_config-local.json +++ b/typescript/examples/model-context-protocol-cdp-server/claude_desktop_config-local.json @@ -3,7 +3,7 @@ "agentkit": { "command": "node", "args": [ - "/Users/YOUR_USER/YOUR_DIRECTORIES/agentkit/typescript/examples/model-context-protocol-cdp-chatbot/dist/index.js" + "/Users/YOUR_USER/YOUR_DIRECTORIES/agentkit/typescript/examples/model-context-protocol-cdp-server/dist/index.js" ], "env": { "CDP_API_KEY_NAME": "YOUR_CDP_API_KEY_NAME", From dd7f1de8135d3464144233dd4b667b1d888cd59c Mon Sep 17 00:00:00 2001 From: CarsonRoscoe Date: Wed, 12 Mar 2025 12:13:44 -0400 Subject: [PATCH 19/19] feat: pr feedback --- .../examples/model-context-protocol-cdp-server/README.md | 4 +++- ...e_desktop_config-local.json => claude_desktop_config.json} | 0 2 files changed, 3 insertions(+), 1 deletion(-) rename typescript/examples/model-context-protocol-cdp-server/{claude_desktop_config-local.json => claude_desktop_config.json} (100%) diff --git a/typescript/examples/model-context-protocol-cdp-server/README.md b/typescript/examples/model-context-protocol-cdp-server/README.md index 6c62dba22..7fe7cb5cb 100644 --- a/typescript/examples/model-context-protocol-cdp-server/README.md +++ b/typescript/examples/model-context-protocol-cdp-server/README.md @@ -32,13 +32,15 @@ This will automatically install and use the latest version of Node. You'll need the following API key: - [CDP API Key](https://portal.cdp.coinbase.com/access/api) -You'll need to configure the Claude desktop config file with your CDP API keys. Copy the contents from `claude_desktop_config-local.json` to your Claude desktop config file and update the following: +You'll need to configure the Claude desktop config file with your CDP API keys. Copy the contents from `claude_desktop_config.json` to your Claude desktop config file and update the following: 1. Update the `args` path to match the location of your built index.js file 2. Set your CDP API keys in the `env` section: - "CDP_API_KEY_NAME" - "CDP_API_KEY_PRIVATE_KEY" +Then, navigate to the `claude_desktop_config.json` file found in your Claude Desktop apps' settings and update it's contents to the contents of our `claude_desktop_config.json` file. + ## Running the example From the root directory, run: diff --git a/typescript/examples/model-context-protocol-cdp-server/claude_desktop_config-local.json b/typescript/examples/model-context-protocol-cdp-server/claude_desktop_config.json similarity index 100% rename from typescript/examples/model-context-protocol-cdp-server/claude_desktop_config-local.json rename to typescript/examples/model-context-protocol-cdp-server/claude_desktop_config.json