{
  "markdown": "# Codify MCP\n\n**MCP server for custom automation tools using [Apify Agent](https://apify.com/cyberfly/apify-agent)**\n\n> Part of [Project Codify](https://codify.codey.eu.org)\n\n## Project Codify\nComplete end-to-end browser automation pipeline running inside browser (or locally). Codify and replay browser actions as robust (deterministic) and reusable scripts. \nFrom rapid prototyping and quick automation scripts to sophisticated deployments at scale.\n\n- [Login](https://apify.com/cyberfly) - reusable authentication sessions - reusable secure login (TBD) ❎\n\n- [Agent](https://apify.com/cyberfly) - turn scripts into browser actions - code or text script (future) ✅\n- [Coder](https://apify.com/cyberfly) - turn browser actions into scripts (TBD - currently integrated) ✅\n- [Robot](https://apify.com/cyberfly) - automation engine for scalability (TBD - currently integrated) ✅\n- [MCP](https://www.npmjs.com/package/codify-mcp) - automations become reusable tools you can reuse through AI ✅\n\nMore is on the way... Give it a [shot](https://codify.codey.eu.org) 🎬 or join the list to follow the project! 🔔\n\n## What It Does\n\nModel Context Protocol (MCP) server that lets AI assistants (e.g. Claude, Cursor, VS Code) execute browser automation tasks via Apify Agent. Tools are passed as clean JSON arguments — one per line. No manual setup or file creation.\n\n## Usage\n\nRun directly using `npx`:\n\n```bash\nnpx codify-mcp {{JSON_MCP_TOOL_1}} {{JSON_MCP_TOOL_2}} {{JSON_MCP_TOOL_3}}...\n```\n\nOr install locally:\n\n```bash\nnpm install -g codify-mcp\n```\n\n## Quick Start\n\n### 1. Apify Token\n\nOptional - you can also place the token inside the MCP server JSON later.\n\n```bash\napify login\n```\n\nThis saves your token to `~/.apify/auth.json`. \n\nAlternatively, set the environment variable:\n\n```bash\nexport APIFY_TOKEN=\"your_token_here\"\n```\n\n### 2. Create a Tool\n\n[Apify Coder](https://apify.com/cyberfly) can turn casual browser actions into reusable AI tools. \nCurrently, this feature is also integrated in [Apify Agent](https://apify.com/cyberfly/apify-agent)\n\nExport a tool and append the result as a JSON string to the MCP server `args` field or ask your AI to do it for you.\n\n```json\n{\n  \"name\": \"scrape_product\",\n  \"description\": \"Scrape product info from a page\",\n  \"inputSchema\": {\n    \"type\": \"object\",\n    \"properties\": {\n      \"url\": {\n        \"type\": \"string\",\n        \"description\": \"Product page URL\"\n      }\n    },\n    \"required\": [\"url\"]\n  },\n  \"implementation\": {\n    \"type\": \"apify-actor\",\n    \"actorId\": \"cyberfly/apify-agent\",\n    \"script\": \"await page.goto(inputs.url); const title = await page.textContent('h1'); return {title};\"\n  }\n}\n```\n\n### 3. Run the Server\n\n```bash\nnpx codify-mcp '{\"name\":\"scrape_product\",\"description\":\"...\",\"inputSchema\":{...},\"implementation\":{...}}'\n```\n\nOr with multiple tools:\n\n```bash\nnpx codify-mcp \\\n  '{\"name\":\"tool1\",...}' \\\n  '{\"name\":\"tool2\",...}' \\\n  '{\"name\":\"tool3\",...}'\n```\n\n### 4. Connect to Claude Desktop (or Cursor/VS Code)\n\nEdit your Claude Desktop config:\n\n**macOS/Linux:** `~/.config/Claude/claude_desktop_config.json`\n\n**Windows:** `%APPDATA%\\Claude\\claude_desktop_config.json`\n\n```json\n{\n  \"mcpServers\": {\n    \"codify-mcp\": {\n      \"command\": \"npx\",\n      \"args\": [\n        \"codify-mcp\",\n        \"{\\\"name\\\":\\\"scrape_product\\\",\\\"description\\\":\\\"...\\\",\\\"inputSchema\\\":{...},\\\"implementation\\\":{...}}\"\n      ],\n      \"env\": {\n        \"APIFY_TOKEN\": \"your_token_or_leave_empty_to_use_auth_file\"\n      }\n    }\n  }\n}\n```\n\nRestart Claude. Your tools are now available to the AI assistant.\n\n## Tool Definition Reference\n\n### Basic Structure\n\n```javascript\n{\n  // Required\n  \"name\": \"tool_name\",                    // alphanumeric + underscore/dash\n  \"description\": \"What the tool does\",    // shown to AI\n  \"inputSchema\": {\n    \"type\": \"object\",\n    \"properties\": {\n      \"paramName\": {\n        \"type\": \"string\",\n        \"description\": \"Parameter description\"\n      }\n    },\n    \"required\": [\"paramName\"]\n  },\n  \"implementation\": {\n    \"type\": \"apify-actor\",\n    \"actorId\": \"cyberfly/apify-agent\",    // actor to run\n    \"script\": \"await page.goto(inputs.url); ...\"  // Playwright code\n  },\n  \n  // Optional\n  \"version\": \"1.0.0\",\n  \"metadata\": { \"custom\": \"fields\" }\n}\n```\n\n### Implementation Details\n\n- **script**: Playwright automation code. Receives `inputs` object with user-provided parameters and `page` object for browser automation.\n- **actorId**: Apify actor to execute. Defaults to `cyberfly/apify-agent`.\n\n### Input Schema Examples\n\n**Simple text input:**\n```json\n{\n  \"url\": {\n    \"type\": \"string\",\n    \"description\": \"Website URL\"\n  }\n}\n```\n\n**Optional field:**\n```json\n{\n  \"timeout\": {\n    \"type\": \"integer\",\n    \"description\": \"Timeout in seconds\",\n    \"default\": 30\n  }\n}\n```\n\n**Enum (dropdown):**\n```json\n{\n  \"format\": {\n    \"type\": \"string\",\n    \"enum\": [\"json\", \"csv\", \"markdown\"],\n    \"description\": \"Output format\"\n  }\n}\n```\n\n## Usage Patterns\n\n### Single Tool (Development)\n\n```bash\nnpx codify-mcp '{\"name\":\"test\",\"description\":\"Test tool\",\"inputSchema\":{\"type\":\"object\",\"properties\":{}},\"implementation\":{\"type\":\"apify-actor\",\"script\":\"console.log('hello')\"}}'\n```\n\n### Multiple Tools (Production)\n\n```bash\nnpx codify-mcp \\\n  \"$(cat tools/scraper.json)\" \\\n  \"$(cat tools/logger.json)\" \\\n  \"$(cat tools/analyzer.json)\"\n```\n\n### With Environment Variable\n\n```bash\nAPIFY_TOKEN=\"apk_...\" npx codify-mcp '{\"name\":\"...\",\"description\":\"...\",\"inputSchema\":{},\"implementation\":{\"type\":\"apify-actor\",\"script\":\"...\"}}'\n```\n\n### With npm link (Local Testing)\n\n```bash\ncd /path/to/codify-mcp\nnpm link\n\n# Now use anywhere\ncodify-mcp '{\"name\":\"...\",\"description\":\"...\",\"inputSchema\":{},\"implementation\":{\"type\":\"apify-actor\",\"script\":\"...\"}}'\n```\n\n## Authentication\n\nToken resolution order:\n\n1. **APIFY_TOKEN environment variable** (if set and not empty)\n2. **~/.apify/auth.json** (from `apify login` CLI command)\n3. **Error**: No token found, tool execution will fail with clear message\n\n## Troubleshooting\n\n### \"No valid tools in arguments\"\n\nEnsure you're passing valid JSON strings as arguments:\n\n```bash\n# ✓ Correct\nnpx codify-mcp '{\"name\":\"test\",\"description\":\"Test\",\"inputSchema\":{\"type\":\"object\",\"properties\":{}},\"implementation\":{\"type\":\"apify-actor\",\"script\":\"return {ok:true}\"}}'\n\n# ✗ Wrong (missing quotes around JSON)\nnpx codify-mcp {name:\"test\"...}\n\n# ✗ Wrong (single quotes around JSON on Linux/Mac may need escaping)\nnpx codify-mcp '{name:\"test\"...}'  # Use double quotes inside\n```\n\n### \"Invalid or missing Apify token\"\n\nEnsure authentication is set up:\n\n```bash\n# Option 1: Login via CLI\napify login\n\n# Option 2: Set environment variable\nexport APIFY_TOKEN=\"apk_your_token_here\"\napify token\n```\n\n### \"Tool execution failed\"\n\nCheck your Playwright script syntax. The script must be valid JavaScript that:\n\n- Has access to `inputs` (user-provided parameters)\n- Has access to `page` (Playwright page object)\n- Returns a value or object\n\n```javascript\n// ✓ Valid\nawait page.goto(inputs.url);\nconst title = await page.textContent('h1');\nreturn { title };\n\n// ✗ Invalid (missing await)\npage.goto(inputs.url);\n```\n\n### Large Tool Sets (50+ tools)\n\nIf you have many tools, consider splitting into multiple MCP servers:\n\n```json\n{\n  \"mcpServers\": {\n    \"apify-scraper\": {\n      \"command\": \"npx\",\n      \"args\": [\"codify-mcp\", \"...tool1...\", \"...tool2...\"]\n    },\n    \"apify-analyzer\": {\n      \"command\": \"npx\",\n      \"args\": [\"codify-mcp\", \"...tool3...\", \"...tool4...\"]\n    }\n  }\n}\n```\n\n## Development\n\n### Running Locally\n\n```bash\nnpm link\ncodify-mcp '{\"name\":\"test\",...}'\n```\n\n### Structure\n\n```\nlib/\n  index.js              # Main entry: assembleWrapperCode(), start()\n  mcp/\n    resolver.js         # Module path bootstrapping\n    auth.js             # Token resolution\n    actor_caller.js     # Apify actor execution\n    server_setup.js     # MCP server + tool registration\n\nbin/\n  start.js    # Executable entry point (bin field in package.json)\n```\n\n## Key Design Principles\n\n- **No files**: Tools passed entirely via argv; no config files or manual setup.\n- **No base64**: Clean, readable command lines; no obfuscation.\n- **Self-contained**: All dependencies bundled; works offline once installed.\n- **Stateless**: Each invocation is independent; easy horizontal scaling.\n- **Token from env/CLI**: Seamless auth experience; respects Apify ecosystem conventions.\n\n## License\n\nApache-2.0\n\n## Contributing\n\nIssues and PRs welcome at [github.com/cybairfly/codify-mcp](https://github.com/cybairfly/codify-mcp)\n",
  "bytes": 8475,
  "sha": "07c2d447834138b248cd2a1addeac63f465aa2d74bd6b1636bd177d0782fd207",
  "repo_slug": "cybairfly/codify-mcp",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_cybairfly_codify_mcp_b81a4227/readme"
}