Creating agents with agents
Create Lucid agents via AI—xgate MCP, lucid-agent-creator skill, and the create_lucid_agent tool. No self-hosting, no deploy step.
This guide explains the end-to-end flow for creating Lucid agents using JavaScript handlers: configure xgate MCP, install the skill, prompt your AI, and get a hosted agent.
What you get
A working agent hosted on the Lucid platform—no self-hosting, no deploy step. You describe what you want; your AI writes the JS handler and calls the MCP tool; the agent is created and immediately invokable.
Flow
1. Set up your preferred AI
Use Claude (Claude Code, Claude CLI) or Cursor as your coding agent.
2. Configure the xgate MCP
Add the xgate MCP server to your AI client's MCP config. You get the MCP URL and session token from xgate.
Normal flow (use the xgate frontend):
- Go to the xgate frontend (e.g. xgate.run or your local/dev UI).
- Connect your wallet there. The frontend runs SIWE (Sign-In With Ethereum) for you; you sign in the wallet UI (e.g. MetaMask)—no curl or manual steps.
- xgate provisions a server wallet for you and exposes MCP tools. You don't create or configure that wallet yourself.
- The frontend gives you the MCP URL and session token (or a ready-made MCP config). Add that to your client:
- Claude CLI / Claude Code:
~/.claude.jsonor project.mcp.json→mcpServers.xgatewithurlandheaders.Authorization: Bearer <token>. Use the URL and token from xgate. - Cursor:
~/.cursor/mcp.json→ sameurlandAuthorizationheader.
- Claude CLI / Claude Code:
If you're not using the frontend (e.g. local or custom flow), you can run SIWE via the xgate API (start → challenge → sign → verify) and use the returned sessionToken and walletSlug to build the MCP URL and auth. Prefer the frontend when available.
3. Install the skill
Claude (Claude Code / Claude CLI): Add the marketplace if needed, then run:
/plugin marketplace add daydreamsai/skills-market
/plugin install lucid-agent-creator@daydreams-skillsCursor: Copy the skill into your project — e.g. mkdir -p .claude/skills/lucid-agent-creator and copy plugins/lucid-agent-creator/skills/SKILL.md (and optionally GUIDE.md) from the skills-market repo into that folder.
The skill teaches the agent the JS handler code contract, create_lucid_agent usage, PaymentsConfig for paid agents, and optional identityConfig (ERC-8004).
4. Prompt your agent to make an agent
In natural language, ask your agent to create an agent. For example:
- "Create a Lucid agent that echoes input"
- "Create an agent that fetches weather by city"
- "Create a paid agent that processes data"
The agent will:
- Use the skill to write the JS handler code (scope, return value,
allowedHostsif needed) - Call the
create_lucid_agentMCP tool with slug, name, description, and entrypoints (including that code) - The tool runs in xgate MCP, uses your server wallet for setup-payment and payment-as-auth, and calls the Lucid API to create the agent
5. Result
The create_lucid_agent tool returns the created agent as its result. You get:
id– agent ID (e.g.ag_771fc5c2081e)slug– agent slug (e.g.test-echo-fixed)invokeUrl– full URL to invoke the first entrypoint (e.g.https://lucid-dev.daydreams.systems/agents/{id}/entrypoints/{key}/invoke)
Plus the rest of the agent object (name, description, entrypoints, etc.). The AI sees this tool result and can share it with you. No extra deploy or hosting step.
Summary
User → configures xgate MCP (SIWE → server wallet) → installs lucid-agent-creator skill → prompts agent to create an agent → agent uses skill + create_lucid_agent → working agent on platform
Notes
Lucid API base URL
The Lucid API base URL is hardcoded in the MCP server (defaults to https://lucid-dev.daydreams.systems/api). No configuration required; works out of the box. Can be overridden via env LUCID_API_URL if needed. The tool always calls that Lucid API instance; the agent never deals with URLs or endpoints.
Paid agents
If the agent has paid entrypoints, the setup fee is paid from your server wallet (USDC). Ensure that wallet has sufficient USDC for the one-time setup fee when creating paid agents.
Network
All agents created via MCP use Base network (base-sepolia testnet). The server wallet is on Base, so all agents use Base network. Entrypoint-level network fields are not accepted.
Identity registration
If you include identityConfig with autoRegister: true, note that auto-registration requires an agent wallet (walletsConfig.agent). The MCP tool does not set this, so identity config is stored for later use. You can:
- Add agent wallet in the dashboard
- Retry identity registration via the dashboard
Troubleshooting
"Insufficient funds"
Your server wallet doesn't have enough USDC. Add USDC to your server wallet and try again.
"Agent slug already exists"
The slug you're trying to use is already taken. Try a different slug.
"Lucid API is currently unavailable"
The Lucid API is down or unreachable. Try again later.
"Invalid JavaScript code"
The JS handler code has syntax errors. Check your code and fix any errors.
"Validation failed"
The input doesn't match the expected schema. Check the error details and fix the validation issues.