mdmodels 0.4.0__tar.gz → 0.4.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.
- {mdmodels-0.4.0 → mdmodels-0.4.1}/PKG-INFO +2 -2
- mdmodels-0.4.1/mdmodels/mcp/create.py +114 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/pyproject.toml +2 -2
- {mdmodels-0.4.0 → mdmodels-0.4.1}/uv.lock +60 -60
- mdmodels-0.4.0/mdmodels/mcp/create.py +0 -100
- {mdmodels-0.4.0 → mdmodels-0.4.1}/.github/scripts/start_ollama.sh +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/.github/workflows/lint.yml +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/.github/workflows/publish.yml +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/.github/workflows/test-publish.yml +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/.github/workflows/test.yml +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/.gitignore +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/Dockerfile +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/README.md +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/docs/.gitignore +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/docs/README.md +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/docs/astro.config.mjs +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/docs/package-lock.json +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/docs/package.json +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/docs/public/favicon.svg +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/docs/src/assets/houston.webp +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/docs/src/assets/logo.svg +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/docs/src/content/config.ts +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/docs/src/content/docs/basic/converting-formats.mdx +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/docs/src/content/docs/basic/creating-data.mdx +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/docs/src/content/docs/basic/index.mdx +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/docs/src/content/docs/basic/library.mdx +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/docs/src/content/docs/basic/multiple-models.mdx +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/docs/src/content/docs/basic/parsing.mdx +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/docs/src/content/docs/basic/querying.mdx +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/docs/src/content/docs/basic/serialization.mdx +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/docs/src/content/docs/basic/validation.mdx +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/docs/src/content/docs/databases/graphdb.mdx +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/docs/src/content/docs/databases/sql.mdx +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/docs/src/content/docs/databases/vector.mdx +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/docs/src/content/docs/installation.mdx +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/docs/src/content/docs/integrations/cli.mdx +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/docs/src/content/docs/integrations/fastapi.mdx +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/docs/src/content/docs/integrations/fastmcp.mdx +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/docs/src/content/docs/integrations/graphql.mdx +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/docs/src/content.config.ts +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/docs/src/styles/styles.css +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/docs/tsconfig.json +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/examples/basic/BasicExample.ipynb +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/examples/basic/model.jl +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/examples/basic/model.md +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/examples/basic/model.rs +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/examples/basic/model.xsd +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/examples/basic/uml_diagram.md +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/examples/graph/Neo4JExample.ipynb +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/examples/graph/model.md +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/examples/graph/startn4j.sh +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/examples/sql/basic/SQLDatabaseExample.ipynb +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/examples/sql/basic/model.md +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/examples/sql/basic/projects.json +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/__init__.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/adder_method.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/cli.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/config.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/create.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/datamodel.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/git_utils.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/graph/__init__.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/graph/basenode.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/graph/connector.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/graph/create.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/graph/relation.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/graphql/__init__.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/graphql/create.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/library.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/llm/__init__.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/llm/handler.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/mcp/__init__.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/mcp/auth.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/mcp/config.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/mcp/sql/__init__.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/mcp/sql/annotation.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/mcp/sql/constants.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/mcp/sql/create.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/mcp/sql/embedding.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/mcp/sql/middleware.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/mcp/sql/naming.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/mcp/sql/ownership.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/mcp/sql/relationships_types.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/mcp/sql/runtime.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/mcp/sql/tools/__init__.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/mcp/sql/tools/_assets.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/mcp/sql/tools/aggregate.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/mcp/sql/tools/annotate.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/mcp/sql/tools/assets/data_entry_form.html +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/mcp/sql/tools/assets/downloader.html +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/mcp/sql/tools/assets/plot_viewer.html +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/mcp/sql/tools/assets/tabular_upload.html +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/mcp/sql/tools/download.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/mcp/sql/tools/form.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/mcp/sql/tools/form_store.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/mcp/sql/tools/plot.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/mcp/sql/tools/relationships.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/mcp/sql/tools/schema.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/mcp/sql/tools/select.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/mcp/sql/tools/tabular.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/mcp/sql/tools/upsert.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/mcp/sql/tools/vector_search.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/mcp/types.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/meta.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/path.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/reference.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/relations.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/rest/__init__.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/rest/config.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/rest/create.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/rest/search.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/sql/__init__.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/sql/aggregation.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/sql/base.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/sql/childref.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/sql/config.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/sql/connector.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/sql/create.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/sql/filter.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/sql/groupby.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/sql/insert.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/sql/linked_type.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/sql/migrations.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/sql/upsert.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/sql/utils.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/sql/vector.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/templates.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/units/__init__.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/units/annotation.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/units/converter.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/units/mappings.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/units/unit_definition.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/mdmodels/utils.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/run-tests.sh +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/tests/__init__.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/tests/fixtures/expected_json.json +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/tests/fixtures/expected_units.json +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/tests/fixtures/expected_units_complex.json +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/tests/fixtures/expected_wrapped_xml.xml +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/tests/fixtures/expected_xml.xml +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/tests/fixtures/model.md +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/tests/fixtures/model_database.md +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/tests/fixtures/model_graph.md +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/tests/fixtures/model_json_schema.json +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/tests/fixtures/model_multiple_types.md +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/tests/fixtures/model_recursion.md +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/tests/fixtures/model_units.md +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/tests/fixtures/model_wrapped_xml.md +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/tests/integration/__init__.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/tests/integration/conftest.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/tests/integration/test_conversion.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/tests/integration/test_db.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/tests/integration/test_from_json_schema.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/tests/integration/test_graph.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/tests/integration/test_llm.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/tests/integration/test_parse.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/tests/unit/__init__.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/tests/unit/test_create.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/tests/unit/test_datamodel.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/tests/unit/test_embedding_config.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/tests/unit/test_git_utils.py +0 -0
- {mdmodels-0.4.0 → mdmodels-0.4.1}/tests/unit/test_unit_definition.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: mdmodels
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.1
|
|
4
4
|
Summary: Python package for the MDModels Rust crate
|
|
5
5
|
Author-email: Jan Range <range.jan@web.de>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -11,7 +11,7 @@ Requires-Dist: dotenv>=0.9.9
|
|
|
11
11
|
Requires-Dist: dotted-dict<2,>=1.1.3
|
|
12
12
|
Requires-Dist: fastexcel>=0.19.0
|
|
13
13
|
Requires-Dist: httpx<0.29,>=0.28
|
|
14
|
-
Requires-Dist: mdmodels-core<0.4,>=0.3.
|
|
14
|
+
Requires-Dist: mdmodels-core<0.4,>=0.3.1
|
|
15
15
|
Requires-Dist: nest-asyncio<2,>=1.6.0
|
|
16
16
|
Requires-Dist: pandas>=2.2.3
|
|
17
17
|
Requires-Dist: polars>=1.39.3
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Dict, Optional
|
|
4
|
+
|
|
5
|
+
from fastmcp import FastMCP
|
|
6
|
+
|
|
7
|
+
from mdmodels.config import AuthMethod
|
|
8
|
+
from mdmodels.mcp.config import MCPConfig
|
|
9
|
+
from mdmodels.sql.connector import DatabaseConnector
|
|
10
|
+
|
|
11
|
+
from .sql import create_sql_mcp_tools
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def create_mcp_tools(
|
|
15
|
+
*,
|
|
16
|
+
app: FastMCP,
|
|
17
|
+
db: DatabaseConnector,
|
|
18
|
+
config: Optional[Dict[str, MCPConfig]] = None,
|
|
19
|
+
all_create: bool = False,
|
|
20
|
+
auth: Optional[AuthMethod] = None,
|
|
21
|
+
) -> None:
|
|
22
|
+
"""Register the MCP tools for a model on a FastMCP application.
|
|
23
|
+
|
|
24
|
+
Main entry point for exposing a database built from an MD-Models model to
|
|
25
|
+
LLM agents. Only SQL databases (`DatabaseConnector`) are supported. The tools
|
|
26
|
+
are implemented in `mdmodels/mcp/sql/tools/` and registered by
|
|
27
|
+
`mdmodels.mcp.sql.create.create_sql_mcp_tools`.
|
|
28
|
+
|
|
29
|
+
Registered tools:
|
|
30
|
+
|
|
31
|
+
**Schema**
|
|
32
|
+
- `Get_Table_Schema`: return the Markdown data model with all fields, types,
|
|
33
|
+
relationships and nesting.
|
|
34
|
+
- `Get_Table_Relationships`: return the foreign-key mappings of a table.
|
|
35
|
+
|
|
36
|
+
**Writing**
|
|
37
|
+
- `Upsert_<Object>`: one tool per object, for every object if `all_create`
|
|
38
|
+
is True and otherwise for the tables with `allow_create` in `config`.
|
|
39
|
+
Writes a nested record across the corresponding tables in one
|
|
40
|
+
transaction, or updates an existing record when its `row_pk` is given.
|
|
41
|
+
Nested fields may reference existing rows by key. Attributes are checked
|
|
42
|
+
for their declared types.
|
|
43
|
+
- `Annotate_Entries`, `Get_Annotations`: free-text annotations on rows of
|
|
44
|
+
any table.
|
|
45
|
+
|
|
46
|
+
**Reading**
|
|
47
|
+
- `Select_Table`: select rows from one table with optional filters and a
|
|
48
|
+
row limit.
|
|
49
|
+
- `Aggregate_Table`: count, sum, avg, min, max, stddev or variance over a
|
|
50
|
+
table, with optional filters.
|
|
51
|
+
- `Download_Entry`: fetch one entry by primary key as a JSON tree that can
|
|
52
|
+
be copied or downloaded.
|
|
53
|
+
- `Vector_Search`: semantic search over tables with embeddings. Registered
|
|
54
|
+
only when a table has an embedding column.
|
|
55
|
+
|
|
56
|
+
**Interactive apps**
|
|
57
|
+
- `Plot_Table`: query a table with optional filters, optionally grouped by
|
|
58
|
+
a column of a related table, and render the rows as an interactive chart.
|
|
59
|
+
- `Data_Entry`: render a typed form whose fields, labels, types and bounds
|
|
60
|
+
are specified by the agent. The form is not derived from the schema; the
|
|
61
|
+
agent maps the submitted values to columns when it calls an
|
|
62
|
+
`Upsert_<Object>` tool.
|
|
63
|
+
- `Submit_Data_Entry`: callback of the form. Checks the submitted values
|
|
64
|
+
against the form specification and returns them to the agent.
|
|
65
|
+
|
|
66
|
+
For the four-object `Experiment` model with `all_create=True` and no
|
|
67
|
+
embeddings, this registers 14 tools.
|
|
68
|
+
|
|
69
|
+
Args:
|
|
70
|
+
app: FastMCP application to register the tools on.
|
|
71
|
+
db: Database connector built from the model.
|
|
72
|
+
config: Per-table settings keyed by table name (`MCPConfig`):
|
|
73
|
+
`allow_create` registers the upsert tool for that table,
|
|
74
|
+
`description` replaces the upsert tool's description, and `shared`
|
|
75
|
+
exempts the table from ownership scoping.
|
|
76
|
+
all_create: Register an `Upsert_<Object>` tool for every object,
|
|
77
|
+
regardless of `allow_create`.
|
|
78
|
+
auth: Authentication method. With `"oidc"`, ownership tables are
|
|
79
|
+
created and tables not marked `shared` are scoped to the
|
|
80
|
+
authenticated user.
|
|
81
|
+
|
|
82
|
+
Raises:
|
|
83
|
+
ValueError: If `db` is not a `DatabaseConnector`.
|
|
84
|
+
|
|
85
|
+
Example:
|
|
86
|
+
```python
|
|
87
|
+
from fastmcp import FastMCP
|
|
88
|
+
from mdmodels import DataModel
|
|
89
|
+
from mdmodels.mcp import create_mcp_tools
|
|
90
|
+
from mdmodels.sql import DatabaseConnector
|
|
91
|
+
|
|
92
|
+
library = DataModel.from_markdown("model.md")
|
|
93
|
+
db = DatabaseConnector(library=library, database="example.db")
|
|
94
|
+
db.create_tables()
|
|
95
|
+
|
|
96
|
+
app = FastMCP("my-database-tools")
|
|
97
|
+
create_mcp_tools(app=app, db=db, all_create=True)
|
|
98
|
+
```
|
|
99
|
+
"""
|
|
100
|
+
|
|
101
|
+
config = config or {}
|
|
102
|
+
|
|
103
|
+
if isinstance(db, DatabaseConnector):
|
|
104
|
+
create_sql_mcp_tools(
|
|
105
|
+
app=app,
|
|
106
|
+
db=db,
|
|
107
|
+
config=config,
|
|
108
|
+
all_create=all_create,
|
|
109
|
+
auth=auth,
|
|
110
|
+
)
|
|
111
|
+
else:
|
|
112
|
+
raise ValueError(
|
|
113
|
+
f"{type(db)} is not supported yet. Please use 'DatabaseConnector' instead."
|
|
114
|
+
)
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "mdmodels"
|
|
3
|
-
version = "0.4.
|
|
3
|
+
version = "0.4.1"
|
|
4
4
|
description = "Python package for the MDModels Rust crate"
|
|
5
5
|
authors = [{ name = "Jan Range", email = "range.jan@web.de" }]
|
|
6
6
|
requires-python = ">=3.11"
|
|
7
7
|
readme = "README.md"
|
|
8
8
|
license = "MIT"
|
|
9
9
|
dependencies = [
|
|
10
|
-
"mdmodels-core>=0.3.
|
|
10
|
+
"mdmodels-core>=0.3.1,<0.4",
|
|
11
11
|
"pydantic-xml>=2.12.1,<3",
|
|
12
12
|
"bigtree>=0.21.1,<0.22",
|
|
13
13
|
"validators>=0.34.0,<0.35",
|
|
@@ -559,7 +559,7 @@ name = "cuda-bindings"
|
|
|
559
559
|
version = "13.2.0"
|
|
560
560
|
source = { registry = "https://pypi.org/simple" }
|
|
561
561
|
dependencies = [
|
|
562
|
-
{ name = "cuda-pathfinder" },
|
|
562
|
+
{ name = "cuda-pathfinder", marker = "sys_platform != 'emscripten' and sys_platform != 'win32'" },
|
|
563
563
|
]
|
|
564
564
|
wheels = [
|
|
565
565
|
{ url = "https://files.pythonhosted.org/packages/e0/a9/3a8241c6e19483ac1f1dcf5c10238205dcb8a6e9d0d4d4709240dff28ff4/cuda_bindings-13.2.0-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl", hash = "sha256:721104c603f059780d287969be3d194a18d0cc3b713ed9049065a1107706759d", size = 5730273, upload-time = "2026-03-11T00:12:37.18Z" },
|
|
@@ -592,37 +592,37 @@ wheels = [
|
|
|
592
592
|
|
|
593
593
|
[package.optional-dependencies]
|
|
594
594
|
cublas = [
|
|
595
|
-
{ name = "nvidia-cublas" },
|
|
595
|
+
{ name = "nvidia-cublas", marker = "sys_platform == 'linux'" },
|
|
596
596
|
]
|
|
597
597
|
cudart = [
|
|
598
|
-
{ name = "nvidia-cuda-runtime" },
|
|
598
|
+
{ name = "nvidia-cuda-runtime", marker = "sys_platform == 'linux'" },
|
|
599
599
|
]
|
|
600
600
|
cufft = [
|
|
601
|
-
{ name = "nvidia-cufft" },
|
|
601
|
+
{ name = "nvidia-cufft", marker = "sys_platform == 'linux'" },
|
|
602
602
|
]
|
|
603
603
|
cufile = [
|
|
604
|
-
{ name = "nvidia-cufile" },
|
|
604
|
+
{ name = "nvidia-cufile", marker = "sys_platform == 'linux'" },
|
|
605
605
|
]
|
|
606
606
|
cupti = [
|
|
607
|
-
{ name = "nvidia-cuda-cupti" },
|
|
607
|
+
{ name = "nvidia-cuda-cupti", marker = "sys_platform == 'linux'" },
|
|
608
608
|
]
|
|
609
609
|
curand = [
|
|
610
|
-
{ name = "nvidia-curand" },
|
|
610
|
+
{ name = "nvidia-curand", marker = "sys_platform == 'linux'" },
|
|
611
611
|
]
|
|
612
612
|
cusolver = [
|
|
613
|
-
{ name = "nvidia-cusolver" },
|
|
613
|
+
{ name = "nvidia-cusolver", marker = "sys_platform == 'linux'" },
|
|
614
614
|
]
|
|
615
615
|
cusparse = [
|
|
616
|
-
{ name = "nvidia-cusparse" },
|
|
616
|
+
{ name = "nvidia-cusparse", marker = "sys_platform == 'linux'" },
|
|
617
617
|
]
|
|
618
618
|
nvjitlink = [
|
|
619
|
-
{ name = "nvidia-nvjitlink" },
|
|
619
|
+
{ name = "nvidia-nvjitlink", marker = "sys_platform == 'linux'" },
|
|
620
620
|
]
|
|
621
621
|
nvrtc = [
|
|
622
|
-
{ name = "nvidia-cuda-nvrtc" },
|
|
622
|
+
{ name = "nvidia-cuda-nvrtc", marker = "sys_platform == 'linux'" },
|
|
623
623
|
]
|
|
624
624
|
nvtx = [
|
|
625
|
-
{ name = "nvidia-nvtx" },
|
|
625
|
+
{ name = "nvidia-nvtx", marker = "sys_platform == 'linux'" },
|
|
626
626
|
]
|
|
627
627
|
|
|
628
628
|
[[package]]
|
|
@@ -1379,7 +1379,7 @@ wheels = [
|
|
|
1379
1379
|
|
|
1380
1380
|
[[package]]
|
|
1381
1381
|
name = "mdmodels"
|
|
1382
|
-
version = "0.4.
|
|
1382
|
+
version = "0.4.1"
|
|
1383
1383
|
source = { editable = "." }
|
|
1384
1384
|
dependencies = [
|
|
1385
1385
|
{ name = "astropy" },
|
|
@@ -1461,7 +1461,7 @@ requires-dist = [
|
|
|
1461
1461
|
{ name = "fastexcel", specifier = ">=0.19.0" },
|
|
1462
1462
|
{ name = "fastmcp", extras = ["apps"], marker = "extra == 'mcp'", specifier = ">=3.2.0" },
|
|
1463
1463
|
{ name = "httpx", specifier = ">=0.28,<0.29" },
|
|
1464
|
-
{ name = "mdmodels-core", specifier = ">=0.3.
|
|
1464
|
+
{ name = "mdmodels-core", specifier = ">=0.3.1,<0.4" },
|
|
1465
1465
|
{ name = "neomodel", marker = "extra == 'graph'", specifier = ">=5.4.0,<6" },
|
|
1466
1466
|
{ name = "nest-asyncio", specifier = ">=1.6.0,<2" },
|
|
1467
1467
|
{ name = "openai", marker = "extra == 'chat'", specifier = ">=1.57.0,<2" },
|
|
@@ -1503,44 +1503,44 @@ dev = [
|
|
|
1503
1503
|
|
|
1504
1504
|
[[package]]
|
|
1505
1505
|
name = "mdmodels-core"
|
|
1506
|
-
version = "0.3.
|
|
1507
|
-
source = { registry = "https://pypi.org/simple" }
|
|
1508
|
-
sdist = { url = "https://files.pythonhosted.org/packages/
|
|
1509
|
-
wheels = [
|
|
1510
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1511
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1512
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1513
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1514
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1515
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1516
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1517
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1518
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1519
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1520
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1521
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1522
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1523
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1524
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1525
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1526
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1527
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1528
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1529
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1530
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1531
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1532
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1533
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1534
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1535
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1536
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1537
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1538
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1539
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1540
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1541
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1542
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1543
|
-
{ url = "https://files.pythonhosted.org/packages/
|
|
1506
|
+
version = "0.3.1"
|
|
1507
|
+
source = { registry = "https://pypi.org/simple" }
|
|
1508
|
+
sdist = { url = "https://files.pythonhosted.org/packages/29/84/5cc885af187e4bf3fe6a31d27a266ac9f52b39c7492f1012616e44a916cc/mdmodels_core-0.3.1.tar.gz", hash = "sha256:75d3f9572ef12869a288092ad66ebb3d5a6d677329bc2947eeb265ea8c54ce24", size = 278187, upload-time = "2026-11-22T18:38:01.292Z" }
|
|
1509
|
+
wheels = [
|
|
1510
|
+
{ url = "https://files.pythonhosted.org/packages/7a/2f/4f3a68e94c258a7457229b6b5fbd8e8bdaada1b1b5327cc27bae9986ffaf/mdmodels_core-0.3.1-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:dd8e46e20c67eb824cb6b52140d6281146b1405f80d2cee8bc41e39458fa01ed", size = 6193734, upload-time = "2026-11-22T18:37:51.502Z" },
|
|
1511
|
+
{ url = "https://files.pythonhosted.org/packages/af/47/c4110860aef5ba964a7420b777c2be844d0e949976abeee2a6e72e5ca3df/mdmodels_core-0.3.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:d829901cd0b5f154c160d7be1d6a501406038caa2b6fd131a4dae87e159afb10", size = 6074621, upload-time = "2026-11-22T18:37:39.646Z" },
|
|
1512
|
+
{ url = "https://files.pythonhosted.org/packages/fc/3b/edd69593e93a970886cbe696a28f9a1766beabf15314684a7b5f3be69133/mdmodels_core-0.3.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:3b335f7c4902f693f4beb5cf3cad9cd98a27a5229feefc934817c9ab8c35b967", size = 6749077, upload-time = "2026-11-22T18:37:21.982Z" },
|
|
1513
|
+
{ url = "https://files.pythonhosted.org/packages/08/d5/2c60396700e883f1e2d31cce32e92d64d87d4927c2f3069f94be1ba9caa2/mdmodels_core-0.3.1-cp311-cp311-manylinux_2_28_aarch64.whl", hash = "sha256:ffe0c960457d8d9072459e8a2fb3344446fdbba284e3df4b259e443e7c62a3af", size = 6984764, upload-time = "2026-11-22T18:36:59.04Z" },
|
|
1514
|
+
{ url = "https://files.pythonhosted.org/packages/4a/30/b0527efe00bc1475948811d68427b520abecfee654dffc8387dae6a7d3d7/mdmodels_core-0.3.1-cp311-cp311-win_amd64.whl", hash = "sha256:3ea4cf2ac87d832b0f68240751fc191ab896dac8d7627f22435e85fe58482d1f", size = 5776460, upload-time = "2026-11-22T18:38:04.079Z" },
|
|
1515
|
+
{ url = "https://files.pythonhosted.org/packages/dd/dc/7c0f19c1239fbfb733d3ab42d8dffaddc60afc74e81011db77720ec13e83/mdmodels_core-0.3.1-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:0d4ea39a7b1200b99b499b4c749b36e8555a4492bb27ac42069848339cd1af18", size = 6180376, upload-time = "2026-11-22T18:37:53.078Z" },
|
|
1516
|
+
{ url = "https://files.pythonhosted.org/packages/b3/09/8ec2d972bf326b7c712d8a95ecabc7e321df0d0a9ee773018ccf2530aa6b/mdmodels_core-0.3.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:3b92754557b6c3275649ece8acf1cab3d02941db8520484ff5e29ec55f990aed", size = 6079114, upload-time = "2026-11-22T18:37:41.206Z" },
|
|
1517
|
+
{ url = "https://files.pythonhosted.org/packages/2f/6c/26818cb52dcfb53addaf99da5d348c5098c2540729a1e9536e4faacdf119/mdmodels_core-0.3.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:063eb7ffbced3eaf73f4311a93d2d7061feb3f3ad751908f13ea01e186f3563b", size = 6743198, upload-time = "2026-11-22T18:37:23.747Z" },
|
|
1518
|
+
{ url = "https://files.pythonhosted.org/packages/07/27/2f9ec41549242185e6032c466a76b6bac3e909564f39d562ad3000c307d3/mdmodels_core-0.3.1-cp312-cp312-manylinux_2_28_aarch64.whl", hash = "sha256:454e0f784ad4ecd012f1fd1f75eb871fc378e4fd60eb1587026bf147e43dd74a", size = 6993510, upload-time = "2026-11-22T18:37:00.84Z" },
|
|
1519
|
+
{ url = "https://files.pythonhosted.org/packages/f6/06/5b8bbe4ac011517c488eb949de55f738ce0c62eaa2a2a87050bfb370e0e5/mdmodels_core-0.3.1-cp312-cp312-win_amd64.whl", hash = "sha256:b4f736546820471e16140fa437fb9dce457b498c889b27ac3211f2ef78fe8a86", size = 5783391, upload-time = "2026-11-22T18:38:05.69Z" },
|
|
1520
|
+
{ url = "https://files.pythonhosted.org/packages/81/3c/a8f6334fa3c4dd79fd38b52b1fdb37453c23747f36084cd8328b0dc404c1/mdmodels_core-0.3.1-cp313-cp313-macosx_10_12_x86_64.whl", hash = "sha256:9224cf3af6ffd89f19d31ff4a26c18713ee6c74b2c764234f5a5fe8784092e0b", size = 6179376, upload-time = "2026-11-22T18:37:54.803Z" },
|
|
1521
|
+
{ url = "https://files.pythonhosted.org/packages/3c/22/538f69222458896e586b56a4c56247b1aefdb1d166300ae0b9e2769d7f04/mdmodels_core-0.3.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:6d81b2ae7abbc058b1ccc91922338a87a243c958c57350e2e9c42fbd501ef0ef", size = 6078699, upload-time = "2026-11-22T18:37:42.78Z" },
|
|
1522
|
+
{ url = "https://files.pythonhosted.org/packages/16/b9/65fc961c034e96bddaf698002e62639ebab491b0e2aa6d91d3b56c416066/mdmodels_core-0.3.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:9e7fa9137c6f791eccebbc514b94e9208d9c7582b52b52a9c1e5861d5bbf3272", size = 6743122, upload-time = "2026-11-22T18:37:25.44Z" },
|
|
1523
|
+
{ url = "https://files.pythonhosted.org/packages/60/86/2d1eae4fc6c6412f3979e728d04c276d2d8352ee2145f66d5ac70a939141/mdmodels_core-0.3.1-cp313-cp313-manylinux_2_28_aarch64.whl", hash = "sha256:d475ab78323f100bbc7ce97d82e073ab7e4288e04a2ade03c03f0ebfe507b709", size = 6992550, upload-time = "2026-11-22T18:37:02.904Z" },
|
|
1524
|
+
{ url = "https://files.pythonhosted.org/packages/b4/b5/55bc55a8ff697f3cc6496e62ada7844a6699eab302c95168b42c6ac83980/mdmodels_core-0.3.1-cp313-cp313-win_amd64.whl", hash = "sha256:e8bef691a2579c1aad25f23bb633f39578c2ea7abbf37339b9c27de03d21b22d", size = 5782932, upload-time = "2026-11-22T18:38:07.555Z" },
|
|
1525
|
+
{ url = "https://files.pythonhosted.org/packages/ba/16/a2ea0da156ddc087b701feeff6c0f932ca0439fb2e00942041e6cf84f5fa/mdmodels_core-0.3.1-cp314-cp314-macosx_10_12_x86_64.whl", hash = "sha256:6394a453f8fca3826aca193ac3c9cecb20adee0694894b83324e0f554c2248a0", size = 6178187, upload-time = "2026-11-22T18:37:56.448Z" },
|
|
1526
|
+
{ url = "https://files.pythonhosted.org/packages/61/82/5f6dcd89c3bd5de47071434a8568903af47938b28f8b33aa8746cbee09e3/mdmodels_core-0.3.1-cp314-cp314-macosx_11_0_arm64.whl", hash = "sha256:b596b0878fc555b73539f066706d9418062799e884c4e07e290ec0e34edb3906", size = 6077207, upload-time = "2026-11-22T18:37:44.431Z" },
|
|
1527
|
+
{ url = "https://files.pythonhosted.org/packages/12/d0/dc70098190e7e4c047aaad13a190bb2bec7f285f7ef5ee154e866008ffdd/mdmodels_core-0.3.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:d03806d1a04aa94d44b16a74d79f337647c627fafaf68e448c8897b3087dd1f6", size = 6742261, upload-time = "2026-11-22T18:37:27.42Z" },
|
|
1528
|
+
{ url = "https://files.pythonhosted.org/packages/62/08/cd0f31b5abe3a1dead83da3a8db23b174a731bad130ff2ff0088db68197b/mdmodels_core-0.3.1-cp314-cp314-manylinux_2_28_aarch64.whl", hash = "sha256:1ebf1d2bd3dc41480bca709d901fd1691369c2413c9bb96dccd134d1c29b354d", size = 6985108, upload-time = "2026-11-22T18:37:04.762Z" },
|
|
1529
|
+
{ url = "https://files.pythonhosted.org/packages/a2/10/4a7bdfaa3899ccc9bc30eb3341554f7c80072949bf852687930b301b5c1c/mdmodels_core-0.3.1-cp314-cp314-win_amd64.whl", hash = "sha256:4cd6b5d84a131bece03ea3d59013ed125ff5e9842385a3b6b8b7f6b6a3ea6c02", size = 5775177, upload-time = "2026-11-22T18:38:09.313Z" },
|
|
1530
|
+
{ url = "https://files.pythonhosted.org/packages/e0/3c/c0450ae194c1fd8ccde33d8fbe7af0bd950b86fd69743cd2039f12db8d7b/mdmodels_core-0.3.1-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:539c7f7d67fb2ef8fe9df8858f587240992c60edc52e81f02dd660b00b539e38", size = 6742931, upload-time = "2026-11-22T18:37:29.199Z" },
|
|
1531
|
+
{ url = "https://files.pythonhosted.org/packages/80/6d/852d247c59c45833e180fdede6f4aefeeddb74cd7aecd25ded18e1017a87/mdmodels_core-0.3.1-cp314-cp314t-manylinux_2_28_aarch64.whl", hash = "sha256:e04080567abf0d278eadbcf21c1d931b6ccb7dfaba98d957fd62a3d787a548f9", size = 6990500, upload-time = "2026-11-22T18:37:06.518Z" },
|
|
1532
|
+
{ url = "https://files.pythonhosted.org/packages/a5/50/725043c74835a8b0fe3d973d8d52681e44acf23ec9311c3803be2bdb5250/mdmodels_core-0.3.1-cp315-cp315-macosx_10_12_x86_64.whl", hash = "sha256:3c1a494b58a5608848cbfbd6742fbf161d71edf25e95aef703435aba7139310c", size = 6177586, upload-time = "2026-11-22T18:37:58.147Z" },
|
|
1533
|
+
{ url = "https://files.pythonhosted.org/packages/d4/a6/fc20b00aa6ac5b2d8ecc31e71f871675657fb8c191542dab7a5377579476/mdmodels_core-0.3.1-cp315-cp315-macosx_11_0_arm64.whl", hash = "sha256:faf4a8b94a17b5b93175b93642fc7656cc73c218f9d6b78b526bc8287763700a", size = 6077266, upload-time = "2026-11-22T18:37:46.243Z" },
|
|
1534
|
+
{ url = "https://files.pythonhosted.org/packages/8d/4d/a375f9fa9b9ca93fd1d69e6355b929d8723427cac8a8041d864eb0868030/mdmodels_core-0.3.1-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:9d05def4d3ea27c2b57dd67ef29966316bcb0770431a65322c77baae857e1146", size = 6742420, upload-time = "2026-11-22T18:37:31Z" },
|
|
1535
|
+
{ url = "https://files.pythonhosted.org/packages/43/d7/3c4cb7bdad8fb63669d55613843d90322d03dc8d8a7211af51a831f4f781/mdmodels_core-0.3.1-cp315-cp315-manylinux_2_28_aarch64.whl", hash = "sha256:15f69bda8a7bba530d21a441c1d68af1bcddf043224b4ee1bee3cdb4af11871b", size = 6985092, upload-time = "2026-11-22T18:37:08.332Z" },
|
|
1536
|
+
{ url = "https://files.pythonhosted.org/packages/27/c9/2ba15436bdbe69eb8f340f25b1dc70111da2e569fef4332e34a31ef9fe92/mdmodels_core-0.3.1-cp315-cp315-win_amd64.whl", hash = "sha256:0de22f7ecfde105903c2d7d27c616f3bd292e08d93bf213f9dede90f63f265f5", size = 5775307, upload-time = "2026-11-22T18:38:11.046Z" },
|
|
1537
|
+
{ url = "https://files.pythonhosted.org/packages/47/25/ad2cb5a5aa7c87b4f2cae2ca08014b5644dd1187b633a1dd12b5ad553717/mdmodels_core-0.3.1-cp315-cp315t-macosx_10_12_x86_64.whl", hash = "sha256:19a9749936e5f1fa7690de44df1c39f3ce4381e518055f2065858d53ade16db6", size = 6185986, upload-time = "2026-11-22T18:37:59.759Z" },
|
|
1538
|
+
{ url = "https://files.pythonhosted.org/packages/8c/73/cf13123d318076b85b027827188f75193fdb89f0d3fb191529d594930149/mdmodels_core-0.3.1-cp315-cp315t-macosx_11_0_arm64.whl", hash = "sha256:90104b06a8482c2761b31b97e8dc375db188f264c43c98c8ce07d7e60a7af55b", size = 6082321, upload-time = "2026-11-22T18:37:48.104Z" },
|
|
1539
|
+
{ url = "https://files.pythonhosted.org/packages/41/42/2eb6a739d089d26361cab4934101e21f161e3b7789820522f5e086931684/mdmodels_core-0.3.1-cp315-cp315t-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:d026799134172f2140dfb93e2e4788d91dbe9421ff8e85db7a0ccdbbb3e7fd85", size = 6743398, upload-time = "2026-11-22T18:37:32.836Z" },
|
|
1540
|
+
{ url = "https://files.pythonhosted.org/packages/2d/a7/22e93d618ce7b12dbe1191293707167e8e1042f8d1c6a445776794ad7945/mdmodels_core-0.3.1-cp315-cp315t-manylinux_2_28_aarch64.whl", hash = "sha256:105130aaa9a08708aff3f249de98660dc97618f82c015687cd4640ecd620cc33", size = 6989843, upload-time = "2026-11-22T18:37:10.037Z" },
|
|
1541
|
+
{ url = "https://files.pythonhosted.org/packages/5f/8c/30a1c4f8b235b275cdf77b027c6b23f4efeafeaee22214bf08a14cad73e2/mdmodels_core-0.3.1-pp311-pypy311_pp73-manylinux2014_x86_64.manylinux_2_17_x86_64.whl", hash = "sha256:4886c4e2b309b8b0078eaba3ba4473b7e0e9bd127d7a4097c530908771a5e158", size = 6747137, upload-time = "2026-11-22T18:37:36.228Z" },
|
|
1542
|
+
{ url = "https://files.pythonhosted.org/packages/34/f9/cdb2de25f56c4915fdbc47eabf0896f788c8cbc2b70add2182e3598d4301/mdmodels_core-0.3.1-pp311-pypy311_pp73-manylinux_2_28_aarch64.whl", hash = "sha256:c3a210ee13edc22b0ffb4d11a6227930c672583f12042b90dc76df6efe350623", size = 6983891, upload-time = "2026-11-22T18:37:15.568Z" },
|
|
1543
|
+
{ url = "https://files.pythonhosted.org/packages/1d/82/b44185cf6d5a2017742b0680c433570d4a03349d1fb3e66602d6fb5aed79/mdmodels_core-0.3.1-pp312-pypy312_pp80-manylinux_2_28_aarch64.whl", hash = "sha256:b5c2e99d178c0d413c2cac1416aeeab0c1fa82fbea403a9dd3e4b9eff77c79b3", size = 6991738, upload-time = "2026-11-22T18:37:17.739Z" },
|
|
1544
1544
|
]
|
|
1545
1545
|
|
|
1546
1546
|
[[package]]
|
|
@@ -1830,7 +1830,7 @@ name = "nvidia-cudnn-cu13"
|
|
|
1830
1830
|
version = "9.19.0.56"
|
|
1831
1831
|
source = { registry = "https://pypi.org/simple" }
|
|
1832
1832
|
dependencies = [
|
|
1833
|
-
{ name = "nvidia-cublas" },
|
|
1833
|
+
{ name = "nvidia-cublas", marker = "sys_platform != 'emscripten' and sys_platform != 'win32'" },
|
|
1834
1834
|
]
|
|
1835
1835
|
wheels = [
|
|
1836
1836
|
{ url = "https://files.pythonhosted.org/packages/f1/84/26025437c1e6b61a707442184fa0c03d083b661adf3a3eecfd6d21677740/nvidia_cudnn_cu13-9.19.0.56-py3-none-manylinux_2_27_aarch64.whl", hash = "sha256:6ed29ffaee1176c612daf442e4dd6cfeb6a0caa43ddcbeb59da94953030b1be4", size = 433781201, upload-time = "2026-02-03T20:40:53.805Z" },
|
|
@@ -1842,7 +1842,7 @@ name = "nvidia-cufft"
|
|
|
1842
1842
|
version = "12.0.0.61"
|
|
1843
1843
|
source = { registry = "https://pypi.org/simple" }
|
|
1844
1844
|
dependencies = [
|
|
1845
|
-
{ name = "nvidia-nvjitlink" },
|
|
1845
|
+
{ name = "nvidia-nvjitlink", marker = "sys_platform != 'emscripten' and sys_platform != 'win32'" },
|
|
1846
1846
|
]
|
|
1847
1847
|
wheels = [
|
|
1848
1848
|
{ url = "https://files.pythonhosted.org/packages/8b/ae/f417a75c0259e85c1d2f83ca4e960289a5f814ed0cea74d18c353d3e989d/nvidia_cufft-12.0.0.61-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:2708c852ef8cd89d1d2068bdbece0aa188813a0c934db3779b9b1faa8442e5f5", size = 214053554, upload-time = "2025-09-04T08:31:38.196Z" },
|
|
@@ -1872,9 +1872,9 @@ name = "nvidia-cusolver"
|
|
|
1872
1872
|
version = "12.0.4.66"
|
|
1873
1873
|
source = { registry = "https://pypi.org/simple" }
|
|
1874
1874
|
dependencies = [
|
|
1875
|
-
{ name = "nvidia-cublas" },
|
|
1876
|
-
{ name = "nvidia-cusparse" },
|
|
1877
|
-
{ name = "nvidia-nvjitlink" },
|
|
1875
|
+
{ name = "nvidia-cublas", marker = "sys_platform != 'emscripten' and sys_platform != 'win32'" },
|
|
1876
|
+
{ name = "nvidia-cusparse", marker = "sys_platform != 'emscripten' and sys_platform != 'win32'" },
|
|
1877
|
+
{ name = "nvidia-nvjitlink", marker = "sys_platform != 'emscripten' and sys_platform != 'win32'" },
|
|
1878
1878
|
]
|
|
1879
1879
|
wheels = [
|
|
1880
1880
|
{ url = "https://files.pythonhosted.org/packages/c8/c3/b30c9e935fc01e3da443ec0116ed1b2a009bb867f5324d3f2d7e533e776b/nvidia_cusolver-12.0.4.66-py3-none-manylinux_2_27_aarch64.whl", hash = "sha256:02c2457eaa9e39de20f880f4bd8820e6a1cfb9f9a34f820eb12a155aa5bc92d2", size = 223467760, upload-time = "2025-09-04T08:33:04.222Z" },
|
|
@@ -1886,7 +1886,7 @@ name = "nvidia-cusparse"
|
|
|
1886
1886
|
version = "12.6.3.3"
|
|
1887
1887
|
source = { registry = "https://pypi.org/simple" }
|
|
1888
1888
|
dependencies = [
|
|
1889
|
-
{ name = "nvidia-nvjitlink" },
|
|
1889
|
+
{ name = "nvidia-nvjitlink", marker = "sys_platform != 'emscripten' and sys_platform != 'win32'" },
|
|
1890
1890
|
]
|
|
1891
1891
|
wheels = [
|
|
1892
1892
|
{ url = "https://files.pythonhosted.org/packages/f8/94/5c26f33738ae35276672f12615a64bd008ed5be6d1ebcb23579285d960a9/nvidia_cusparse-12.6.3.3-py3-none-manylinux2014_aarch64.manylinux_2_17_aarch64.whl", hash = "sha256:80bcc4662f23f1054ee334a15c72b8940402975e0eab63178fc7e670aa59472c", size = 162155568, upload-time = "2025-09-04T08:33:42.864Z" },
|
|
@@ -3262,8 +3262,8 @@ name = "secretstorage"
|
|
|
3262
3262
|
version = "3.5.0"
|
|
3263
3263
|
source = { registry = "https://pypi.org/simple" }
|
|
3264
3264
|
dependencies = [
|
|
3265
|
-
{ name = "cryptography" },
|
|
3266
|
-
{ name = "jeepney" },
|
|
3265
|
+
{ name = "cryptography", marker = "sys_platform != 'emscripten' and sys_platform != 'win32'" },
|
|
3266
|
+
{ name = "jeepney", marker = "sys_platform != 'emscripten' and sys_platform != 'win32'" },
|
|
3267
3267
|
]
|
|
3268
3268
|
sdist = { url = "https://files.pythonhosted.org/packages/1c/03/e834bcd866f2f8a49a85eaff47340affa3bfa391ee9912a952a1faa68c7b/secretstorage-3.5.0.tar.gz", hash = "sha256:f04b8e4689cbce351744d5537bf6b1329c6fc68f91fa666f60a380edddcd11be", size = 19884, upload-time = "2025-11-23T19:02:53.191Z" }
|
|
3269
3269
|
wheels = [
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from typing import Dict, Optional
|
|
4
|
-
|
|
5
|
-
from fastmcp import FastMCP
|
|
6
|
-
|
|
7
|
-
from mdmodels.config import AuthMethod
|
|
8
|
-
from mdmodels.mcp.config import MCPConfig
|
|
9
|
-
from mdmodels.sql.connector import DatabaseConnector
|
|
10
|
-
|
|
11
|
-
from .sql import create_sql_mcp_tools
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
def create_mcp_tools(
|
|
15
|
-
*,
|
|
16
|
-
app: FastMCP,
|
|
17
|
-
db: DatabaseConnector,
|
|
18
|
-
config: Optional[Dict[str, MCPConfig]] = None,
|
|
19
|
-
all_create: bool = False,
|
|
20
|
-
auth: Optional[AuthMethod] = None,
|
|
21
|
-
) -> None:
|
|
22
|
-
"""Create and register MCP tools for database operations.
|
|
23
|
-
|
|
24
|
-
This function serves as the main entry point for adding database interaction
|
|
25
|
-
tools to a FastMCP application. It automatically detects the connector type
|
|
26
|
-
and registers the appropriate set of tools.
|
|
27
|
-
|
|
28
|
-
For SQL databases (DatabaseConnector), the following tools are registered:
|
|
29
|
-
|
|
30
|
-
**Schema & Relationship Tools:**
|
|
31
|
-
- `get_schema`: Retrieve JSON schema for any data model, including field types,
|
|
32
|
-
validation rules, and structure requirements
|
|
33
|
-
- `get_relationships`: Get database relationships and foreign key connections
|
|
34
|
-
between tables, essential for understanding data dependencies
|
|
35
|
-
|
|
36
|
-
**Data Creation Tools:**
|
|
37
|
-
- `create_<model_name>`: One tool per model for creating new records with
|
|
38
|
-
nested data insertion and foreign key relationship handling. Always presents
|
|
39
|
-
expected schema and asks for confirmation before creation.
|
|
40
|
-
|
|
41
|
-
**Query & Retrieval Tools:**
|
|
42
|
-
- `select_from_table`: Query and retrieve records with optional filtering and
|
|
43
|
-
result limiting. Supports complex WHERE clause filters with mandatory
|
|
44
|
-
schema inspection before filtering.
|
|
45
|
-
- `aggregate_from_table`: Perform aggregation operations (count, sum, avg, min,
|
|
46
|
-
max, stddev, variance) on database tables with optional filtering support.
|
|
47
|
-
|
|
48
|
-
**Vector Search Tools:**
|
|
49
|
-
- `vector_search`: Perform semantic vector search on tables with embeddings,
|
|
50
|
-
supporting both direct table search and cross-table search via related
|
|
51
|
-
embeddings. Returns results with cosine distance scores.
|
|
52
|
-
|
|
53
|
-
All tools include comprehensive validation, error handling, and automatic
|
|
54
|
-
database session management via middleware. Filter-based tools require
|
|
55
|
-
mandatory schema inspection to ensure correct column names and data types.
|
|
56
|
-
|
|
57
|
-
Args:
|
|
58
|
-
app: FastMCP application instance to register tools on
|
|
59
|
-
db: Database connector (SQL or Graph) - determines which tools are created
|
|
60
|
-
model_descriptions: Optional custom descriptions for create tools, keyed
|
|
61
|
-
by model name. If not provided, generic descriptions are used.
|
|
62
|
-
|
|
63
|
-
Raises:
|
|
64
|
-
NotImplementedError: If a GraphConnector is provided (not yet supported)
|
|
65
|
-
|
|
66
|
-
Example:
|
|
67
|
-
```python
|
|
68
|
-
from fastmcp import FastMCP
|
|
69
|
-
from mdmodels.sql import DatabaseConnector
|
|
70
|
-
from mdmodels.mcp import create_mcp_tools
|
|
71
|
-
|
|
72
|
-
app = FastMCP("my-database-tools")
|
|
73
|
-
db = DatabaseConnector(database_url="sqlite:///example.db")
|
|
74
|
-
|
|
75
|
-
# Register all database tools
|
|
76
|
-
create_mcp_tools(app=app, db=db)
|
|
77
|
-
|
|
78
|
-
# Or with custom descriptions
|
|
79
|
-
descriptions = {
|
|
80
|
-
"User": "Create a new user account with profile information",
|
|
81
|
-
"Project": "Create a new research project with metadata"
|
|
82
|
-
}
|
|
83
|
-
create_mcp_tools(app=app, db=db, model_descriptions=descriptions)
|
|
84
|
-
```
|
|
85
|
-
"""
|
|
86
|
-
|
|
87
|
-
config = config or {}
|
|
88
|
-
|
|
89
|
-
if isinstance(db, DatabaseConnector):
|
|
90
|
-
create_sql_mcp_tools(
|
|
91
|
-
app=app,
|
|
92
|
-
db=db,
|
|
93
|
-
config=config,
|
|
94
|
-
all_create=all_create,
|
|
95
|
-
auth=auth,
|
|
96
|
-
)
|
|
97
|
-
else:
|
|
98
|
-
raise ValueError(
|
|
99
|
-
f"{type(db)} is not supported yet. Please use 'DatabaseConnector' instead."
|
|
100
|
-
)
|
|
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
|
|
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
|
|
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
|
|
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
|