flask-apcore 0.2.0__tar.gz → 0.2.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- flask_apcore-0.2.1/PKG-INFO +365 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/pyproject.toml +9 -2
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/src/flask_apcore/__init__.py +1 -1
- flask_apcore-0.2.0/PKG-INFO +0 -27
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/.gitignore +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/.gitmessage +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/.pre-commit-config.yaml +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/CHANGELOG.md +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/README.md +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/docs/flask-apcore/prd.md +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/docs/flask-apcore/tech-design.md +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/docs/plans/2026-02-23-redesign-design.md +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/docs/plans/2026-02-23-redesign-implementation.md +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/docs/plans/2026-02-23-schema-explorer-design.md +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/docs/plans/2026-02-23-schema-explorer-implementation.md +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/docs/plans/2026-02-24-explorer-simplify-design.md +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/docs/plans/2026-02-24-explorer-simplify-implementation.md +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/examples/demo/.env.example +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/examples/demo/Dockerfile +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/examples/demo/README.md +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/examples/demo/app.py +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/examples/demo/docker-compose.yml +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/examples/demo/entrypoint.sh +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/ideas/flask-apcore-idea.md +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/src/flask_apcore/cli.py +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/src/flask_apcore/config.py +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/src/flask_apcore/context.py +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/src/flask_apcore/extension.py +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/src/flask_apcore/observability.py +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/src/flask_apcore/output/__init__.py +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/src/flask_apcore/output/registry_writer.py +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/src/flask_apcore/output/yaml_writer.py +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/src/flask_apcore/registry.py +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/src/flask_apcore/scanners/__init__.py +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/src/flask_apcore/scanners/base.py +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/src/flask_apcore/scanners/native.py +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/src/flask_apcore/schemas/__init__.py +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/src/flask_apcore/schemas/_constants.py +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/src/flask_apcore/schemas/marshmallow_backend.py +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/src/flask_apcore/schemas/pydantic_backend.py +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/src/flask_apcore/schemas/typehints_backend.py +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/src/flask_apcore/serializers.py +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/tests/__init__.py +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/tests/_test_target_module.py +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/tests/conftest.py +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/tests/test_cli_scan.py +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/tests/test_cli_serve.py +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/tests/test_config.py +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/tests/test_context.py +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/tests/test_extension.py +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/tests/test_integration.py +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/tests/test_observability.py +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/tests/test_public_api.py +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/tests/test_registry.py +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/tests/test_registry_writer.py +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/tests/test_scanner_base.py +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/tests/test_scanner_native.py +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/tests/test_schema_dispatcher.py +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/tests/test_schema_marshmallow.py +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/tests/test_schema_pydantic.py +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/tests/test_schema_typehints.py +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/tests/test_serializers.py +0 -0
- {flask_apcore-0.2.0 → flask_apcore-0.2.1}/tests/test_yaml_writer.py +0 -0
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: flask-apcore
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Summary: Flask Extension for apcore AI-Perceivable Core integration, exposes Flask routes as MCP tools with auto-discovery, schema inference, YAML binding, and built-in observability. Supports MCP server (stdio/HTTP) for LLM tool integration.
|
|
5
|
+
Project-URL: Homepage, https://github.com/aipartnerup/
|
|
6
|
+
Project-URL: Repository, https://github.com/aipartnerup/flask-apcore
|
|
7
|
+
Project-URL: Documentation, https://github.com/aipartnerup/flask-apcore#readme
|
|
8
|
+
Project-URL: Issues, https://github.com/aipartnerup/flash-apcore/issues
|
|
9
|
+
Author-email: aipartnerup <tercel.yi@gmail.com>
|
|
10
|
+
License-Expression: Apache-2.0
|
|
11
|
+
Keywords: ai,apcore,auto-discovery,binding,cli,extension,flask,integration,llm,mcp,module,observability,pydantic,schema,tools,yaml
|
|
12
|
+
Requires-Python: >=3.11
|
|
13
|
+
Requires-Dist: apcore>=0.6.0
|
|
14
|
+
Requires-Dist: flask>=3.0
|
|
15
|
+
Requires-Dist: pydantic>=2.0
|
|
16
|
+
Requires-Dist: pyyaml>=6.0
|
|
17
|
+
Provides-Extra: dev
|
|
18
|
+
Requires-Dist: apdev[dev]>=0.2.0; extra == 'dev'
|
|
19
|
+
Requires-Dist: coverage>=7.0; extra == 'dev'
|
|
20
|
+
Requires-Dist: mypy>=1.0; extra == 'dev'
|
|
21
|
+
Requires-Dist: pre-commit>=3.0; extra == 'dev'
|
|
22
|
+
Requires-Dist: pytest-asyncio>=0.21; extra == 'dev'
|
|
23
|
+
Requires-Dist: pytest-flask>=1.0; extra == 'dev'
|
|
24
|
+
Requires-Dist: pytest>=7.0; extra == 'dev'
|
|
25
|
+
Requires-Dist: ruff>=0.1; extra == 'dev'
|
|
26
|
+
Provides-Extra: mcp
|
|
27
|
+
Requires-Dist: apcore-mcp>=0.6.0; extra == 'mcp'
|
|
28
|
+
Provides-Extra: restx
|
|
29
|
+
Requires-Dist: flask-restx>=1.0; extra == 'restx'
|
|
30
|
+
Provides-Extra: smorest
|
|
31
|
+
Requires-Dist: flask-smorest>=0.42; extra == 'smorest'
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+
# flask-apcore
|
|
35
|
+
|
|
36
|
+
Flask Extension for [apcore](https://github.com/aipartnerup/apcore-python) (AI-Perceivable Core) integration. Expose your Flask routes as MCP tools with auto-discovery, Pydantic schema inference, and built-in observability.
|
|
37
|
+
|
|
38
|
+
## Features
|
|
39
|
+
|
|
40
|
+
- **Route scanning** -- auto-discover Flask routes and convert them to apcore modules
|
|
41
|
+
- **Annotation inference** -- `GET` -> readonly, `DELETE` -> destructive, `PUT` -> idempotent
|
|
42
|
+
- **Pydantic schema inference** -- input/output schemas extracted from type hints automatically
|
|
43
|
+
- **`@module` decorator** -- define standalone AI-callable modules with full schema enforcement
|
|
44
|
+
- **YAML binding** -- zero-code module definitions via external `.binding.yaml` files
|
|
45
|
+
- **MCP server** -- stdio and streamable-http transports via `flask apcore serve`
|
|
46
|
+
- **Observability** -- distributed tracing, metrics, and structured JSON logging
|
|
47
|
+
- **Input validation** -- validate tool inputs against Pydantic schemas before execution
|
|
48
|
+
- **CLI-first workflow** -- `flask apcore scan` + `flask apcore serve` for zero-intrusion integration
|
|
49
|
+
- **MCP Tool Explorer** -- browser UI for inspecting modules via `flask apcore serve --explorer`
|
|
50
|
+
|
|
51
|
+
## Requirements
|
|
52
|
+
|
|
53
|
+
- Python >= 3.11
|
|
54
|
+
- Flask >= 3.0
|
|
55
|
+
|
|
56
|
+
## Installation
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
# Core
|
|
60
|
+
pip install flask-apcore
|
|
61
|
+
|
|
62
|
+
# With MCP server support (required for `flask apcore serve`)
|
|
63
|
+
pip install flask-apcore[mcp]
|
|
64
|
+
|
|
65
|
+
# All optional extras
|
|
66
|
+
pip install flask-apcore[mcp,smorest,restx]
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Quick Start
|
|
70
|
+
|
|
71
|
+
### 1. Add Apcore to your Flask app
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
from flask import Flask
|
|
75
|
+
from flask_apcore import Apcore
|
|
76
|
+
|
|
77
|
+
app = Flask(__name__)
|
|
78
|
+
Apcore(app)
|
|
79
|
+
|
|
80
|
+
@app.route("/greet/<name>", methods=["GET"])
|
|
81
|
+
def greet(name: str) -> dict:
|
|
82
|
+
"""Greet a user by name."""
|
|
83
|
+
return {"message": f"Hello, {name}!"}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Or use the **factory pattern**:
|
|
87
|
+
|
|
88
|
+
```python
|
|
89
|
+
from flask import Flask
|
|
90
|
+
from flask_apcore import Apcore
|
|
91
|
+
|
|
92
|
+
apcore = Apcore()
|
|
93
|
+
|
|
94
|
+
def create_app():
|
|
95
|
+
app = Flask(__name__)
|
|
96
|
+
# ... register routes / blueprints ...
|
|
97
|
+
apcore.init_app(app)
|
|
98
|
+
return app
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### 2. Scan routes and start MCP server
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
export FLASK_APP=app.py
|
|
105
|
+
|
|
106
|
+
# Scan Flask routes -> register as apcore modules
|
|
107
|
+
flask apcore scan
|
|
108
|
+
|
|
109
|
+
# Start MCP server (stdio, for Claude Desktop / Cursor)
|
|
110
|
+
flask apcore serve
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
That's it. Your Flask routes are now MCP tools.
|
|
114
|
+
|
|
115
|
+
### 3. Connect an MCP client
|
|
116
|
+
|
|
117
|
+
For **Claude Desktop**, add to your config:
|
|
118
|
+
|
|
119
|
+
```json
|
|
120
|
+
{
|
|
121
|
+
"mcpServers": {
|
|
122
|
+
"my-flask-app": {
|
|
123
|
+
"command": "flask",
|
|
124
|
+
"args": ["apcore", "serve"],
|
|
125
|
+
"env": { "FLASK_APP": "app.py" }
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
For **HTTP transport** (remote access):
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
flask apcore serve --http --host 0.0.0.0 --port 9100
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Integration Paths
|
|
138
|
+
|
|
139
|
+
flask-apcore supports three ways to define AI-perceivable modules:
|
|
140
|
+
|
|
141
|
+
### Route Scanning (zero-intrusion)
|
|
142
|
+
|
|
143
|
+
Scan existing Flask routes without modifying any code:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
# Direct registration (in-memory)
|
|
147
|
+
flask apcore scan
|
|
148
|
+
|
|
149
|
+
# Generate YAML binding files (persistent)
|
|
150
|
+
flask apcore scan --output yaml --dir ./apcore_modules
|
|
151
|
+
|
|
152
|
+
# Preview without side effects
|
|
153
|
+
flask apcore scan --dry-run
|
|
154
|
+
|
|
155
|
+
# Filter routes by regex
|
|
156
|
+
flask apcore scan --include "user.*" --exclude ".*delete"
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### `@module` Decorator (precise control)
|
|
160
|
+
|
|
161
|
+
Define standalone modules with full schema enforcement:
|
|
162
|
+
|
|
163
|
+
```python
|
|
164
|
+
from flask_apcore import Apcore, module
|
|
165
|
+
from pydantic import BaseModel
|
|
166
|
+
|
|
167
|
+
class SummaryResult(BaseModel):
|
|
168
|
+
total: int
|
|
169
|
+
active: int
|
|
170
|
+
|
|
171
|
+
@module(id="user_stats.v1", tags=["analytics"])
|
|
172
|
+
def user_stats() -> SummaryResult:
|
|
173
|
+
"""Return user statistics."""
|
|
174
|
+
return SummaryResult(total=100, active=42)
|
|
175
|
+
|
|
176
|
+
app = Flask(__name__)
|
|
177
|
+
app.config["APCORE_MODULE_PACKAGES"] = ["myapp.modules"]
|
|
178
|
+
Apcore(app)
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### YAML Binding (zero-code)
|
|
182
|
+
|
|
183
|
+
Define modules externally in `.binding.yaml` files:
|
|
184
|
+
|
|
185
|
+
```yaml
|
|
186
|
+
# apcore_modules/greet.binding.yaml
|
|
187
|
+
bindings:
|
|
188
|
+
- module_id: greet.get
|
|
189
|
+
target: app.greet
|
|
190
|
+
description: "Greet a user by name"
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Set `APCORE_AUTO_DISCOVER=True` (default) to load bindings on startup.
|
|
194
|
+
|
|
195
|
+
## CLI Commands
|
|
196
|
+
|
|
197
|
+
### `flask apcore scan`
|
|
198
|
+
|
|
199
|
+
Scan Flask routes and generate apcore module definitions.
|
|
200
|
+
|
|
201
|
+
```
|
|
202
|
+
Options:
|
|
203
|
+
-s, --source [auto|native|smorest|restx] Scanner source (default: auto)
|
|
204
|
+
-o, --output [yaml] Output format; omit for direct registration
|
|
205
|
+
-d, --dir PATH Output directory (default: APCORE_MODULE_DIR)
|
|
206
|
+
--dry-run Preview without writing or registering
|
|
207
|
+
--include REGEX Only include matching module IDs
|
|
208
|
+
--exclude REGEX Exclude matching module IDs
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### `flask apcore serve`
|
|
212
|
+
|
|
213
|
+
Start an MCP server exposing registered modules as tools.
|
|
214
|
+
|
|
215
|
+
```
|
|
216
|
+
Options:
|
|
217
|
+
--stdio Use stdio transport (default)
|
|
218
|
+
--http Use streamable-http transport
|
|
219
|
+
--host TEXT HTTP host (default: 127.0.0.1)
|
|
220
|
+
-p, --port INT HTTP port (default: 9100)
|
|
221
|
+
--name TEXT MCP server name (default: apcore-mcp)
|
|
222
|
+
--validate-inputs Validate tool inputs against schemas
|
|
223
|
+
--log-level [DEBUG|INFO|WARNING|ERROR]
|
|
224
|
+
--explorer Enable the MCP Tool Explorer UI
|
|
225
|
+
--explorer-prefix TEXT URL prefix for explorer (default: /explorer)
|
|
226
|
+
--allow-execute Allow Try-it execution in the explorer
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
## Configuration
|
|
230
|
+
|
|
231
|
+
All settings use the `APCORE_` prefix in `app.config`:
|
|
232
|
+
|
|
233
|
+
```python
|
|
234
|
+
app.config.update(
|
|
235
|
+
# Core
|
|
236
|
+
APCORE_AUTO_DISCOVER=True, # Auto-load bindings and @module packages
|
|
237
|
+
APCORE_MODULE_DIR="apcore_modules/",# Directory for binding files
|
|
238
|
+
APCORE_BINDING_PATTERN="*.binding.yaml", # Glob pattern for binding files
|
|
239
|
+
APCORE_MODULE_PACKAGES=[], # Python packages to scan for @module functions
|
|
240
|
+
APCORE_SCANNER_SOURCE="auto", # Scanner: auto, native, smorest, restx
|
|
241
|
+
|
|
242
|
+
# Middleware & Execution
|
|
243
|
+
APCORE_MIDDLEWARES=[], # Middleware dotted paths (e.g. ["myapp.mw.AuthMW"])
|
|
244
|
+
APCORE_ACL_PATH=None, # ACL file path (e.g. "acl.yaml")
|
|
245
|
+
APCORE_CONTEXT_FACTORY=None, # Custom ContextFactory dotted path
|
|
246
|
+
APCORE_EXECUTOR_CONFIG=None, # Executor config dict (passed to apcore.Config)
|
|
247
|
+
APCORE_EXTENSIONS=[], # Extension plugin dotted paths
|
|
248
|
+
|
|
249
|
+
# MCP Server
|
|
250
|
+
APCORE_SERVE_TRANSPORT="stdio", # Transport: stdio, streamable-http, sse
|
|
251
|
+
APCORE_SERVE_HOST="127.0.0.1", # HTTP host
|
|
252
|
+
APCORE_SERVE_PORT=9100, # HTTP port
|
|
253
|
+
APCORE_SERVER_NAME="apcore-mcp", # MCP server name
|
|
254
|
+
APCORE_SERVER_VERSION=None, # MCP server version string
|
|
255
|
+
APCORE_SERVE_VALIDATE_INPUTS=False, # Validate inputs against schemas
|
|
256
|
+
APCORE_SERVE_LOG_LEVEL=None, # Log level: DEBUG, INFO, WARNING, ERROR
|
|
257
|
+
|
|
258
|
+
# Observability
|
|
259
|
+
APCORE_TRACING_ENABLED=False, # Enable distributed tracing
|
|
260
|
+
APCORE_TRACING_EXPORTER="stdout", # Exporter: stdout, memory, otlp
|
|
261
|
+
APCORE_TRACING_OTLP_ENDPOINT=None, # OTLP collector URL (e.g. "http://localhost:4317")
|
|
262
|
+
APCORE_TRACING_SERVICE_NAME="flask-apcore", # Service name for traces
|
|
263
|
+
APCORE_METRICS_ENABLED=False, # Enable metrics collection
|
|
264
|
+
APCORE_METRICS_BUCKETS=None, # Custom histogram buckets (list of floats)
|
|
265
|
+
APCORE_LOGGING_ENABLED=False, # Enable structured logging
|
|
266
|
+
APCORE_LOGGING_FORMAT="json", # Format: json, text
|
|
267
|
+
APCORE_LOGGING_LEVEL="INFO", # Level: trace, debug, info, warn, error, fatal
|
|
268
|
+
|
|
269
|
+
# MCP Serve Explorer (dev/staging only — no built-in auth)
|
|
270
|
+
APCORE_SERVE_EXPLORER=False, # Enable Tool Explorer UI in MCP server
|
|
271
|
+
APCORE_SERVE_EXPLORER_PREFIX="/explorer", # URL prefix for explorer
|
|
272
|
+
APCORE_SERVE_ALLOW_EXECUTE=False, # Allow Try-it execution in explorer
|
|
273
|
+
)
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
## Observability
|
|
277
|
+
|
|
278
|
+
Enable tracing, metrics, and structured logging:
|
|
279
|
+
|
|
280
|
+
```python
|
|
281
|
+
app.config.update(
|
|
282
|
+
APCORE_TRACING_ENABLED=True,
|
|
283
|
+
APCORE_TRACING_EXPORTER="otlp",
|
|
284
|
+
APCORE_TRACING_OTLP_ENDPOINT="http://localhost:4317",
|
|
285
|
+
APCORE_METRICS_ENABLED=True,
|
|
286
|
+
APCORE_LOGGING_ENABLED=True,
|
|
287
|
+
APCORE_LOGGING_FORMAT="json",
|
|
288
|
+
)
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
These are wired into the apcore Executor as middleware, providing tracing spans, latency metrics, and structured log entries for every module execution.
|
|
292
|
+
|
|
293
|
+
## MCP Tool Explorer
|
|
294
|
+
|
|
295
|
+
The MCP Tool Explorer is a browser UI provided by [apcore-mcp](https://github.com/aipartnerup/apcore-mcp) for inspecting registered modules and executing them interactively.
|
|
296
|
+
|
|
297
|
+
> **Security:** Explorer endpoints are unauthenticated. Only enable in development/staging. Do NOT enable in production without adding your own auth layer.
|
|
298
|
+
|
|
299
|
+
```bash
|
|
300
|
+
flask apcore serve --http --explorer --allow-execute
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
Browse to `http://127.0.0.1:9100/explorer/` to view the interactive explorer with Try-it execution.
|
|
304
|
+
|
|
305
|
+
## Docker Demo
|
|
306
|
+
|
|
307
|
+
A complete runnable demo is included in `examples/demo/`. It demonstrates the full pipeline: Flask CRUD routes with Pydantic schemas, route scanning, annotation inference, `@module` registration, MCP server, and observability.
|
|
308
|
+
|
|
309
|
+
```bash
|
|
310
|
+
cd examples/demo
|
|
311
|
+
docker compose up --build
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
After startup you'll see:
|
|
315
|
+
|
|
316
|
+
```
|
|
317
|
+
=== Scanning Flask routes ===
|
|
318
|
+
[flask-apcore] Found 5 API routes.
|
|
319
|
+
[flask-apcore] Generated 5 module definitions.
|
|
320
|
+
|
|
321
|
+
=== Starting MCP server on port 9100 ===
|
|
322
|
+
[flask-apcore] Starting MCP server 'task-manager-mcp' via streamable-http...
|
|
323
|
+
[flask-apcore] 6 modules registered.
|
|
324
|
+
INFO: Uvicorn running on http://0.0.0.0:9100
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
Verify:
|
|
328
|
+
|
|
329
|
+
```bash
|
|
330
|
+
curl http://localhost:9100/health
|
|
331
|
+
# {"status":"ok","uptime_seconds":5.2,"module_count":6}
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
See [examples/demo/README.md](examples/demo/README.md) for full details.
|
|
335
|
+
|
|
336
|
+
## Public API
|
|
337
|
+
|
|
338
|
+
```python
|
|
339
|
+
from flask_apcore import (
|
|
340
|
+
Apcore, # Flask Extension
|
|
341
|
+
module, # @module decorator
|
|
342
|
+
Registry, # Module registry
|
|
343
|
+
Executor, # Module executor with middleware pipeline
|
|
344
|
+
Context, # Request context
|
|
345
|
+
Identity, # User identity
|
|
346
|
+
ACL, # Access control list
|
|
347
|
+
Config, # Executor configuration
|
|
348
|
+
Middleware, # Middleware base class
|
|
349
|
+
ModuleAnnotations, # Behavioral hints (readonly, destructive, etc.)
|
|
350
|
+
ModuleDescriptor, # Module metadata
|
|
351
|
+
)
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
## Development
|
|
355
|
+
|
|
356
|
+
```bash
|
|
357
|
+
git clone https://github.com/aipartnerup/flask-apcore.git
|
|
358
|
+
cd flask-apcore
|
|
359
|
+
pip install -e ".[dev,mcp]"
|
|
360
|
+
pytest
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
## License
|
|
364
|
+
|
|
365
|
+
Apache-2.0
|
|
@@ -4,10 +4,11 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "flask-apcore"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.1"
|
|
8
8
|
description = "Flask Extension for apcore AI-Perceivable Core integration, exposes Flask routes as MCP tools with auto-discovery, schema inference, YAML binding, and built-in observability. Supports MCP server (stdio/HTTP) for LLM tool integration."
|
|
9
9
|
requires-python = ">=3.11"
|
|
10
|
-
|
|
10
|
+
readme = "README.md"
|
|
11
|
+
license = "Apache-2.0"
|
|
11
12
|
authors = [
|
|
12
13
|
{ name = "aipartnerup", email = "tercel.yi@gmail.com" },
|
|
13
14
|
]
|
|
@@ -69,3 +70,9 @@ base_package = "flask_apcore"
|
|
|
69
70
|
[tool.mypy]
|
|
70
71
|
python_version = "3.11"
|
|
71
72
|
strict = true
|
|
73
|
+
|
|
74
|
+
[project.urls]
|
|
75
|
+
Homepage = "https://github.com/aipartnerup/"
|
|
76
|
+
Repository = "https://github.com/aipartnerup/flask-apcore"
|
|
77
|
+
Documentation = "https://github.com/aipartnerup/flask-apcore#readme"
|
|
78
|
+
Issues = "https://github.com/aipartnerup/flash-apcore/issues"
|
flask_apcore-0.2.0/PKG-INFO
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: flask-apcore
|
|
3
|
-
Version: 0.2.0
|
|
4
|
-
Summary: Flask Extension for apcore AI-Perceivable Core integration, exposes Flask routes as MCP tools with auto-discovery, schema inference, YAML binding, and built-in observability. Supports MCP server (stdio/HTTP) for LLM tool integration.
|
|
5
|
-
Author-email: aipartnerup <tercel.yi@gmail.com>
|
|
6
|
-
License-Expression: MIT
|
|
7
|
-
Keywords: ai,apcore,auto-discovery,binding,cli,extension,flask,integration,llm,mcp,module,observability,pydantic,schema,tools,yaml
|
|
8
|
-
Requires-Python: >=3.11
|
|
9
|
-
Requires-Dist: apcore>=0.6.0
|
|
10
|
-
Requires-Dist: flask>=3.0
|
|
11
|
-
Requires-Dist: pydantic>=2.0
|
|
12
|
-
Requires-Dist: pyyaml>=6.0
|
|
13
|
-
Provides-Extra: dev
|
|
14
|
-
Requires-Dist: apdev[dev]>=0.2.0; extra == 'dev'
|
|
15
|
-
Requires-Dist: coverage>=7.0; extra == 'dev'
|
|
16
|
-
Requires-Dist: mypy>=1.0; extra == 'dev'
|
|
17
|
-
Requires-Dist: pre-commit>=3.0; extra == 'dev'
|
|
18
|
-
Requires-Dist: pytest-asyncio>=0.21; extra == 'dev'
|
|
19
|
-
Requires-Dist: pytest-flask>=1.0; extra == 'dev'
|
|
20
|
-
Requires-Dist: pytest>=7.0; extra == 'dev'
|
|
21
|
-
Requires-Dist: ruff>=0.1; extra == 'dev'
|
|
22
|
-
Provides-Extra: mcp
|
|
23
|
-
Requires-Dist: apcore-mcp>=0.6.0; extra == 'mcp'
|
|
24
|
-
Provides-Extra: restx
|
|
25
|
-
Requires-Dist: flask-restx>=1.0; extra == 'restx'
|
|
26
|
-
Provides-Extra: smorest
|
|
27
|
-
Requires-Dist: flask-smorest>=0.42; extra == 'smorest'
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{flask_apcore-0.2.0 → flask_apcore-0.2.1}/docs/plans/2026-02-23-schema-explorer-implementation.md
RENAMED
|
File without changes
|
|
File without changes
|
{flask_apcore-0.2.0 → flask_apcore-0.2.1}/docs/plans/2026-02-24-explorer-simplify-implementation.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|