### The Bug:
When an entrypoint file imports its parent package and
calls add_tools_from_module() on that package, and the same entrypoint
file also defines tools using @app.tool or @tool decorators, then the
server fails to start with an `AttributeError`. This is because the
tools would be discovered via AST parsing, but those tools weren't added
to the module's namespace yet because the file is still executing.
For example, this would fail on startup:
```py
#!/usr/bin/env python3
"""local_filesystem MCP server"""
import sys
from typing import Annotated
from arcade_mcp_server import MCPApp
import local_filesystem
app = MCPApp(name="eric_server", version="1.0.0", log_level="DEBUG")
app.add_tools_from_module(local_filesystem)
@app.tool
def eric(name: Annotated[str, "The name of the person to greet"]) -> str:
"""Greet a person by name."""
return "return"
if __name__ == "__main__":
transport = sys.argv[1] if len(sys.argv) > 1 else "stdio"
app.run(transport="http", host="127.0.0.1", port=8074)
```
### The fix:
Skip the entrypoint file. This means that any tool defined inside of the
entrypoint file must be added via MCPApp.add_tool(...) or instead use
the recommended @app.tool.
|
||
|---|---|---|
| .. | ||
| arcade_core | ||
| pyproject.toml | ||
| README.md | ||
Arcade Core
Core library for the Arcade platform providing foundational components and utilities.
Overview
Arcade Core provides the essential building blocks for the Arcade platform:
- Tool Catalog & Toolkit Management: Core classes for managing and organizing tools
- Configuration & Schema Handling: Configuration management and validation
- Authentication & Authorization: Auth providers and security utilities
- Error Handling: Comprehensive error types and handling
- Telemetry & Observability: Monitoring and tracing capabilities
- Utilities: Common helper functions and validators
Installation
pip install arcade-core
Usage
- Install an arcade toolkit
pip install arcade-math
- Load the toolkit
import arcade_math
from arcade_core import ToolCatalog, Toolkit
# Create a tool catalog
catalog = ToolCatalog()
# Load a toolkit
toolkit = Toolkit.from_module(arcade_math)
License
MIT License - see LICENSE file for details.