- Install the
claude-codepackage
npm install -g @anthropic-ai/claude-code-
Obtain your
APTOS_BOT_KEYby following the instructions here. -
Navigate to your project
cd your-awesome-project- Add the Aptos MCP server to your project using the Claude CLI:
claude mcp add -s local aptos-mcp npx -e APTOS_BOT_KEY=<your_bot_api_key> -- -y @aptos-labs/aptos-mcpReplace <your_bot_api_key> with the key you generated in step 2.
Note: The -s local flag adds the MCP server to your project's local configuration. You can also use:
-s userto add it globally for all projects-s projectto add it to the project's shared configuration (if you want to commit it to version control)
- Verify the MCP server was added successfully:
claude mcp listYou should see aptos-mcp in the list of configured servers.
- Start Claude Code:
claude- Verify the connection by prompting:
what aptos mcp version are you using?
The agent should reply with something like:
I'm using Aptos MCP version 0.0.2.
If you encounter issues with the CLI approach, you can use the JSON method to install it to the folder you are in:
claude mcp add-json aptos-mcp '{"command": "npx", "args": ["-y", "@aptos-labs/aptos-mcp"], "type": "stdio", "env": {"APTOS_BOT_KEY": "<your_bot_api_key>"}}'- If Claude doesn't recognize the Aptos MCP tools, ensure you've completely quit and restarted Claude Code after adding the configuration
- Run
claude mcp listto verify the server is properly configured - Check that your
APTOS_BOT_KEYis valid and has the necessary permissions