{"id":31034287,"url":"https://github.com/xz-dev/anymcp","last_synced_at":"2025-09-14T02:03:49.254Z","repository":{"id":313852251,"uuid":"1052694158","full_name":"xz-dev/anymcp","owner":"xz-dev","description":null,"archived":false,"fork":false,"pushed_at":"2025-09-09T04:26:43.000Z","size":75,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-09-09T06:49:55.191Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xz-dev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-08T12:21:27.000Z","updated_at":"2025-09-09T04:26:47.000Z","dependencies_parsed_at":"2025-09-09T06:49:57.998Z","dependency_job_id":"1ba8924e-4c17-43da-86f7-a5808a31298a","html_url":"https://github.com/xz-dev/anymcp","commit_stats":null,"previous_names":["xz-dev/anymcp"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/xz-dev/anymcp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xz-dev%2Fanymcp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xz-dev%2Fanymcp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xz-dev%2Fanymcp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xz-dev%2Fanymcp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xz-dev","download_url":"https://codeload.github.com/xz-dev/anymcp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xz-dev%2Fanymcp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":275051636,"owners_count":25396977,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-14T02:00:10.474Z","response_time":75,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-09-14T02:03:14.553Z","updated_at":"2025-09-14T02:03:49.243Z","avatar_url":"https://github.com/xz-dev.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AnyMCP - Self-Creating MCP Tool System\n\nAnyMCP is a BDD-driven MCP (Model Context Protocol) tool system that allows AI to autonomously create, test, and manage its own tools.\n\n## Features\n\n### Core Functions\n\n1. **search_tool** - Search available tools\n   - Keyword search support\n   - Return detailed tool information\n   - Display tool parameters and metadata\n\n2. **execute_tool** - Execute tools\n   - Dynamic Python tool execution\n   - Parameter passing support\n   - Timeout control\n\n3. **create_tool** - Create new tools\n   - Create tools using Python code\n   - Automatic execution wrapper\n   - Syntax validation\n\n4. **create_tool_test** - Create BDD tests for tools\n   - Auto-generate behave test files\n   - Create step definitions\n   - Support multiple test scenarios\n\n5. **test_tool** - Run BDD tests for a specific tool\n   - Execute behave tests for a tool\n   - Return test results\n   - Support verbose output mode\n\n6. **run_test** - Run any test file or all tests\n   - Run specific test files by name\n   - Run all tests with 'all' parameter\n   - Parse and return test statistics\n\n7. **shell_command** - Execute shell commands\n   - Run shell commands in project directory\n   - Configurable timeout\n   - Safety checks for dangerous commands\n   - Support custom working directory\n\n8. **list_tools** - List all available tools\n   - Show all tools in the tools directory\n   - Return tool count and storage location\n\n## Installation\n\n```bash\n# Clone repository\ngit clone \u003crepository\u003e\ncd anymcp\n\n# Install dependencies with uv\nuv sync\n```\n\n## Usage\n\n### Run as MCP Server\n\n```bash\nuv run python -m anymcp\n```\n\n### Configure in Claude Desktop\n\nEdit Claude Desktop configuration file:\n\n**macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`\n**Windows**: `%APPDATA%\\Claude\\claude_desktop_config.json`\n\n```json\n{\n  \"mcpServers\": {\n    \"anymcp\": {\n      \"command\": \"uv\",\n      \"args\": [\"run\", \"python\", \"-m\", \"anymcp\"],\n      \"cwd\": \"/path/to/anymcp\"\n    }\n  }\n}\n```\n\n## Example Tools\n\n### Simple Tool\n\n```python\n# String reversal tool\ndef execute(text: str) -\u003e str:\n    return text[::-1]\n```\n\n### Tool with Metadata\n\n```python\n__tool_name__ = \"Calculator\"\n__description__ = \"Performs basic arithmetic\"\n__version__ = \"1.0.0\"\n__parameters__ = {\n    \"operation\": {\"type\": \"string\", \"required\": True},\n    \"a\": {\"type\": \"number\", \"required\": True},\n    \"b\": {\"type\": \"number\", \"required\": True}\n}\n\ndef execute(operation: str, a: float, b: float) -\u003e float:\n    if operation == \"add\":\n        return a + b\n    elif operation == \"subtract\":\n        return a - b\n    elif operation == \"multiply\":\n        return a * b\n    elif operation == \"divide\":\n        if b == 0:\n            raise ValueError(\"Division by zero\")\n        return a / b\n```\n\n## BDD Testing\n\nThe project uses behave framework for BDD testing:\n\n```bash\n# Run all tests\nuv run behave\n\n# Run specific feature tests\nuv run behave features/search_tool.feature\n\n# Verbose output mode\nuv run behave -v\n\n# Show test summary\nuv run behave --summary\n```\n\n## Project Structure\n\n```\nanymcp/\n├── anymcp/              # Main source code\n│   ├── __init__.py\n│   ├── __main__.py      # Entry point\n│   ├── server.py        # MCP server implementation\n│   └── tool_manager.py  # Tool management core logic\n├── features/            # BDD test feature files\n│   ├── steps/          # Step definitions\n│   ├── *.feature       # Test scenarios in Gherkin format\n│   └── environment.py  # Behave environment configuration\n├── tools/              # Tool storage directory (all created tools stored here)\n│   └── *.py           # Python tool scripts (executable Python files)\n├── pyproject.toml      # Project configuration\n├── behave.ini         # Behave configuration\n└── README.md\n```\n\n## Development Guide\n\n### Adding New Features\n\n1. Write BDD test scenarios in `features/`\n2. Implement step definitions in `features/steps/`\n3. Implement functionality in `anymcp/tool_manager.py`\n4. Add MCP interface in `anymcp/server.py`\n5. Run tests to verify functionality\n\n### Tool Development Standards\n\nEach tool must:\n- Include an `execute()` function as entry point\n- Handle parameter validation\n- Return serializable results (string, number, dict, list)\n- Include proper error handling\n\n### Modern Python Practices\n\nThe project uses modern Python approaches:\n- `pathlib.Path` instead of `os.path`\n- `argparse` instead of direct `sys.argv` access\n- `asyncio` for asynchronous operations\n- Type hints for better code documentation\n\n## Example Usage\n\n```python\nimport asyncio\nfrom anymcp.tool_manager import ToolManager\n\nasync def main():\n    tool_manager = ToolManager()\n    \n    # List all available tools\n    tools = tool_manager.list_tools()\n    print(f\"Available tools: {tools}\")\n    \n    # Search for tools by keyword\n    tools = await tool_manager.search_tools(keyword=\"text\")\n    \n    # Create a new tool\n    code = '''\ndef execute(text: str) -\u003e str:\n    return text.upper()\n'''\n    await tool_manager.create_tool(\"uppercase\", code)\n    \n    # Execute the tool\n    result = await tool_manager.execute_tool(\n        \"uppercase\",\n        {\"text\": \"hello world\"}\n    )\n    print(result)  # {\"success\": True, \"result\": \"HELLO WORLD\"}\n    \n    # Run shell commands\n    cmd_result = await tool_manager.shell_command(\"ls -la tools/\")\n    print(cmd_result[\"stdout\"])\n    \n    # Create and run tests\n    test_scenarios = [\n        {\"input\": {\"text\": \"test\"}, \"expected\": \"TEST\"}\n    ]\n    await tool_manager.create_tool_test(\"uppercase\", test_scenarios)\n    test_result = await tool_manager.run_test(\"uppercase\")\n    print(f\"Test passed: {test_result['success']}\")\n\nasyncio.run(main())\n```\n\n## Tool Storage\n\nAll created tools are stored in the `tools/` directory as executable Python scripts. Each tool:\n- Is a standalone Python file that can be run directly\n- Contains an `execute()` function as the main entry point\n- Can include metadata like `__tool_name__`, `__description__`, `__version__`\n- Is automatically wrapped with argument parsing if needed\n\n## License\n\nMIT License","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxz-dev%2Fanymcp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxz-dev%2Fanymcp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxz-dev%2Fanymcp/lists"}