gibson-cli 0.8.3__tar.gz → 0.8.4__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.
- {gibson_cli-0.8.3/gibson_cli.egg-info → gibson_cli-0.8.4}/PKG-INFO +1 -1
- gibson_cli-0.8.4/gibson/services/mcp/server.py +182 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4/gibson_cli.egg-info}/PKG-INFO +1 -1
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/pyproject.toml +1 -1
- gibson_cli-0.8.3/gibson/services/mcp/server.py +0 -145
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/.gitignore +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/.pre-commit-config.yaml +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/README.md +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/bin/build.sh +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/bin/clean.sh +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/bin/release.sh +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/api/BaseApi.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/api/Cli.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/api/DataApi.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/api/ProjectApi.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/bin/gibson.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/command/BaseCommand.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/command/Build.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/command/Conf.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/command/Count.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/command/Dev.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/command/Forget.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/command/Help.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/command/Merge.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/command/Modify.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/command/Question.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/command/Remove.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/command/Show.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/command/Tree.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/command/Version.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/command/auth/Auth.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/command/auth/Login.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/command/auth/Logout.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/command/code/Api.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/command/code/Base.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/command/code/Code.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/command/code/Entity.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/command/code/Model.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/command/code/Models.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/command/code/Schema.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/command/code/Schemas.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/command/code/Test.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/command/code/Tests.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/command/importer/Import.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/command/importer/OpenApi.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/command/list/Entities.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/command/list/List.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/command/list/Projects.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/command/mcp/McpServer.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/command/new/Module.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/command/new/New.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/command/new/Project.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/command/rename/Entity.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/command/rename/Rename.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/command/rewrite/Rewrite.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/command/tests/test_command_BaseCommand.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/command/tests/test_command_Conf.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/conf/Api.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/conf/Code.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/conf/Custom.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/conf/Datastore.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/conf/Dependencies.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/conf/Dev.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/conf/Frameworks.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/conf/Modeler.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/conf/Paths.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/conf/Platform.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/conf/Project.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/conf/Version.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/conf/dev/Api.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/conf/dev/Base.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/conf/dev/Model.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/conf/dev/Schema.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/conf/tests/test_conf_Dependencies.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/conf/tests/test_conf_Platform.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/core/Colors.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/core/CommandRouter.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/core/Completions.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/core/Configuration.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/core/Conversation.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/core/Diff.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/core/Env.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/core/Memory.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/core/PythonPath.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/core/Spinner.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/core/TimeKeeper.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/core/utils.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/data/bash-completion.tmpl +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/data/mysql/default-ref-table.tmpl +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/data/mysql/default-table.tmpl +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/data/postgresql/default-ref-table.tmpl +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/data/postgresql/default-table.tmpl +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/db/TableExceptions.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/db/tests/test_db_TableExceptions.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/dev/Dev.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/display/Header.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/display/WorkspaceFooter.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/display/WorkspaceHeader.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/display/tests/test_display_Header.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/display/tests/test_display_WorkspaceFooter.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/display/tests/test_display_WorkspaceHeader.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/lang/Python.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/lang/tests/test_lang_Python.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/services/auth/Server.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/services/code/context/schema/DataDictionary.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/services/code/context/schema/EntityKeys.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/services/code/context/schema/Manager.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/services/code/context/schema/tests/test_code_context_schema_DataDictionary.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/services/code/context/schema/tests/test_code_context_schema_EntityKeys.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/services/code/context/schema/tests/test_code_context_schema_Manager.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/services/code/customization/Authenticator.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/services/code/customization/BaseCustomization.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/services/code/customization/CustomizationManager.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/services/code/customization/Index.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/services/code/customization/tests/test_code_customization_Authenticator.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/services/code/customization/tests/test_code_customization_BaseCustomization.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/structure/Entity.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/structure/mysql/Entity.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/structure/mysql/constraints/ReferenceConstraint.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/structure/mysql/keys/ForeignKey.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/structure/mysql/keys/Index.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/structure/mysql/keys/IndexAttribute.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/structure/mysql/keys/tests/test_structure_mysql_keys_ForeignKey.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/structure/mysql/keys/tests/test_structure_mysql_keys_Index.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/structure/mysql/keys/tests/test_structure_mysql_keys_IndexAttribute.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/structure/mysql/testing.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/structure/mysql/tests/test_structure_mysql_Entity.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/structure/postgresql/Entity.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/structure/postgresql/References.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/structure/postgresql/table/ForeignKey.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/structure/postgresql/table/tests/test_structure_postgresql_table_ForeignKey.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/structure/postgresql/testing.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/structure/postgresql/tests/test_structure_postgresql_Entity.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/structure/tests/test_structure_Entity.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/tests/test_Env.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/tests/test_Memory.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/tests/test_utils.py +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson_cli.egg-info/SOURCES.txt +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson_cli.egg-info/dependency_links.txt +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson_cli.egg-info/entry_points.txt +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson_cli.egg-info/requires.txt +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson_cli.egg-info/top_level.txt +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/requirements.txt +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/setup.cfg +0 -0
- {gibson_cli-0.8.3 → gibson_cli-0.8.4}/venv/bin/activate_this.py +0 -0
@@ -0,0 +1,182 @@
|
|
1
|
+
from typing import Dict, List
|
2
|
+
|
3
|
+
from mcp.server.fastmcp import FastMCP
|
4
|
+
from requests.exceptions import HTTPError
|
5
|
+
|
6
|
+
from gibson.api.DataApi import DataApi
|
7
|
+
from gibson.api.ProjectApi import ProjectApi
|
8
|
+
from gibson.core.Configuration import Configuration
|
9
|
+
|
10
|
+
mcp = FastMCP("GibsonAI")
|
11
|
+
|
12
|
+
# Note: Resources are not yet supported by Cursor, everything must be implemented as a tool
|
13
|
+
# See https://docs.cursor.com/context/model-context-protocol#limitations
|
14
|
+
|
15
|
+
|
16
|
+
def error_handler(e: HTTPError) -> Dict:
|
17
|
+
"""Handle HTTP errors from the API"""
|
18
|
+
status_code = e.response.status_code
|
19
|
+
message = e.response.json()
|
20
|
+
if status_code == 401:
|
21
|
+
message = "Authentication required. Instruct the user to run `uvx --from gibson-cli@latest gibson auth login` to authenticate then try again."
|
22
|
+
return {"status_code": status_code, "error": message}
|
23
|
+
|
24
|
+
|
25
|
+
@mcp.tool()
|
26
|
+
def get_projects() -> List[Dict]:
|
27
|
+
"""
|
28
|
+
Get all of the user's existing GibsonAI projects.
|
29
|
+
<IMPORTANT>
|
30
|
+
If the user mentions a project by name and you don't have the project UUID, call this tool.
|
31
|
+
If there's a .gibsonai file in the project or workspace root directory, assume that the user wants to use that project and don't call this tool unless there's a good reason to do so.
|
32
|
+
</IMPORTANT>
|
33
|
+
"""
|
34
|
+
project_api = ProjectApi(Configuration(interactive=False))
|
35
|
+
try:
|
36
|
+
return project_api.list()
|
37
|
+
except HTTPError as e:
|
38
|
+
return error_handler(e)
|
39
|
+
|
40
|
+
|
41
|
+
@mcp.tool()
|
42
|
+
def create_project() -> Dict:
|
43
|
+
"""
|
44
|
+
Create a new GibsonAI project.
|
45
|
+
<IMPORTANT>
|
46
|
+
Before assuming that the user wants to create a new project, look for a .gibsonai file in the project or workspace root directory.
|
47
|
+
If the .gibsonai file exists and contains a project UUID, call get_project_details to get the project details and ask the user if they want to use the existing project.
|
48
|
+
If the .gibsonai file doesn't exist, but the user mentions a project name, call get_projects to check if a project with a similar name already exists and ask the user if they want to use the existing project.
|
49
|
+
If the user explicitly states they want to create a new project, call this tool without confirming.
|
50
|
+
If you call this tool, ask the user if they want to update the .gibsonai file (or create it if it doesn't exist) with the new project UUID.
|
51
|
+
</IMPORTANT>
|
52
|
+
"""
|
53
|
+
project_api = ProjectApi(Configuration(interactive=False))
|
54
|
+
try:
|
55
|
+
return project_api.create()
|
56
|
+
except HTTPError as e:
|
57
|
+
return error_handler(e)
|
58
|
+
|
59
|
+
|
60
|
+
@mcp.tool()
|
61
|
+
def get_project_details(uuid: str) -> Dict:
|
62
|
+
"""
|
63
|
+
Get a GibsonAI project's details.
|
64
|
+
<IMPORTANT>
|
65
|
+
If there's a .gibsonai file in the project or workspace root directory, assume that the user wants to use that project unless they explicitly state otherwise.
|
66
|
+
</IMPORTANT>
|
67
|
+
"""
|
68
|
+
project_api = ProjectApi(Configuration(interactive=False))
|
69
|
+
try:
|
70
|
+
return project_api.lookup(uuid=uuid)
|
71
|
+
except HTTPError as e:
|
72
|
+
return error_handler(e)
|
73
|
+
|
74
|
+
|
75
|
+
@mcp.tool()
|
76
|
+
def get_project_hosted_api_details(uuid: str) -> str:
|
77
|
+
"""
|
78
|
+
Get a GibsonAI project's hosted API details.
|
79
|
+
<IMPORTANT>
|
80
|
+
This includes necessary context for an LLM to understand and generate code related to fetching or modifying the project's data via the hosted REST API.
|
81
|
+
</IMPORTANT>
|
82
|
+
"""
|
83
|
+
project_api = ProjectApi(Configuration(interactive=False))
|
84
|
+
try:
|
85
|
+
return project_api.mcp(uuid=uuid)
|
86
|
+
except HTTPError as e:
|
87
|
+
return error_handler(e)
|
88
|
+
|
89
|
+
|
90
|
+
@mcp.tool()
|
91
|
+
def update_project(uuid: str, project_name: str) -> Dict:
|
92
|
+
"""
|
93
|
+
Update a GibsonAI project's details.
|
94
|
+
This currently only updates the project's name.
|
95
|
+
Returns the updated project details.
|
96
|
+
"""
|
97
|
+
project_api = ProjectApi(Configuration(interactive=False))
|
98
|
+
try:
|
99
|
+
return project_api.update(uuid=uuid, name=project_name)
|
100
|
+
except HTTPError as e:
|
101
|
+
return error_handler(e)
|
102
|
+
|
103
|
+
|
104
|
+
@mcp.tool()
|
105
|
+
def submit_data_modeling_request(uuid: str, data_modeling_request: str) -> Dict:
|
106
|
+
"""
|
107
|
+
Submit a data modeling request for a GibsonAI project.
|
108
|
+
<IMPORTANT>
|
109
|
+
This tool fully handles all data modeling.
|
110
|
+
If the user describes a specific data modeling task, call this tool with the user's request as-is.
|
111
|
+
If the user's request is not clear, ask for clarification before calling this tool.
|
112
|
+
</IMPORTANT>
|
113
|
+
Returns the response from GibsonAI's LLM.
|
114
|
+
"""
|
115
|
+
project_api = ProjectApi(Configuration(interactive=False))
|
116
|
+
try:
|
117
|
+
return project_api.submit_message(uuid=uuid, message=data_modeling_request)
|
118
|
+
except HTTPError as e:
|
119
|
+
return error_handler(e)
|
120
|
+
|
121
|
+
|
122
|
+
@mcp.tool()
|
123
|
+
def deploy_project(uuid: str) -> None:
|
124
|
+
"""
|
125
|
+
Deploy a GibsonAI project's hosted databases.
|
126
|
+
<IMPORTANT>
|
127
|
+
This updates both the development and production database schemas simultaneously by automatically handling necessary schema migrations.
|
128
|
+
</IMPORTANT>
|
129
|
+
"""
|
130
|
+
project_api = ProjectApi(Configuration(interactive=False))
|
131
|
+
try:
|
132
|
+
return project_api.deploy(uuid=uuid)
|
133
|
+
except HTTPError as e:
|
134
|
+
return error_handler(e)
|
135
|
+
|
136
|
+
|
137
|
+
@mcp.tool()
|
138
|
+
def get_project_schema(uuid: str) -> str:
|
139
|
+
"""
|
140
|
+
Get the current schema for a GibsonAI project.
|
141
|
+
<IMPORTANT>
|
142
|
+
This includes any changes made to the schema since the last deployment.
|
143
|
+
</IMPORTANT>
|
144
|
+
"""
|
145
|
+
project_api = ProjectApi(Configuration(interactive=False))
|
146
|
+
try:
|
147
|
+
return project_api.schema(uuid=uuid)
|
148
|
+
except HTTPError as e:
|
149
|
+
return error_handler(e)
|
150
|
+
|
151
|
+
|
152
|
+
@mcp.tool()
|
153
|
+
def get_deployed_schema(uuid: str) -> str:
|
154
|
+
"""
|
155
|
+
Get the deployed schema for a GibsonAI project.
|
156
|
+
<IMPORTANT>
|
157
|
+
This is the database schema that is currently live on the project's hosted databases.
|
158
|
+
</IMPORTANT>
|
159
|
+
"""
|
160
|
+
project_api = ProjectApi(Configuration(interactive=False))
|
161
|
+
try:
|
162
|
+
return project_api.database_schema(uuid=uuid)
|
163
|
+
except HTTPError as e:
|
164
|
+
return error_handler(e)
|
165
|
+
|
166
|
+
|
167
|
+
@mcp.tool()
|
168
|
+
def query_database(api_key: str, query: str) -> List[Dict] | str | Dict:
|
169
|
+
"""
|
170
|
+
Query a GibsonAI project's hosted database using SQL. The environment-specific API key must be provided.
|
171
|
+
<IMPORTANT>
|
172
|
+
If you're not sure which environment to use, ask the user for clarification.
|
173
|
+
Always use the correct syntax for the database dialect (found in the project details).
|
174
|
+
Always wrap identifiers in the dialect appropriate quotes (backticks for MySQL, double quotes for PostgreSQL).
|
175
|
+
</IMPORTANT>
|
176
|
+
"""
|
177
|
+
data_api = DataApi(Configuration(interactive=False), api_key=api_key)
|
178
|
+
try:
|
179
|
+
response = data_api.query(query=query)
|
180
|
+
return response or "Query executed successfully"
|
181
|
+
except HTTPError as e:
|
182
|
+
return error_handler(e)
|
@@ -1,145 +0,0 @@
|
|
1
|
-
from typing import Dict, List
|
2
|
-
|
3
|
-
from mcp.server.fastmcp import FastMCP
|
4
|
-
from requests.exceptions import HTTPError
|
5
|
-
|
6
|
-
from gibson.api.DataApi import DataApi
|
7
|
-
from gibson.api.ProjectApi import ProjectApi
|
8
|
-
from gibson.core.Configuration import Configuration
|
9
|
-
|
10
|
-
mcp = FastMCP("GibsonAI")
|
11
|
-
|
12
|
-
# Note: Resources are not yet supported by Cursor, everything must be implemented as a tool
|
13
|
-
# See https://docs.cursor.com/context/model-context-protocol#limitations
|
14
|
-
|
15
|
-
|
16
|
-
def error_handler(e: HTTPError) -> Dict:
|
17
|
-
"""Handle HTTP errors from the API"""
|
18
|
-
status_code = e.response.status_code
|
19
|
-
message = e.response.json()
|
20
|
-
if status_code == 401:
|
21
|
-
message = "Authentication required. Run `uvx --from gibson-cli@latest gibson auth login` to authenticate then try again."
|
22
|
-
return {"status_code": status_code, "error": message}
|
23
|
-
|
24
|
-
|
25
|
-
@mcp.tool()
|
26
|
-
def get_projects() -> List[Dict]:
|
27
|
-
"""Get all GibsonAI projects"""
|
28
|
-
project_api = ProjectApi(Configuration(interactive=False))
|
29
|
-
try:
|
30
|
-
return project_api.list()
|
31
|
-
except HTTPError as e:
|
32
|
-
return error_handler(e)
|
33
|
-
|
34
|
-
|
35
|
-
@mcp.tool()
|
36
|
-
def create_project() -> Dict:
|
37
|
-
"""Create a new GibsonAI project"""
|
38
|
-
project_api = ProjectApi(Configuration(interactive=False))
|
39
|
-
try:
|
40
|
-
return project_api.create()
|
41
|
-
except HTTPError as e:
|
42
|
-
return error_handler(e)
|
43
|
-
|
44
|
-
|
45
|
-
@mcp.tool()
|
46
|
-
def get_project_details(uuid: str) -> Dict:
|
47
|
-
"""Get a GibsonAI project's details"""
|
48
|
-
project_api = ProjectApi(Configuration(interactive=False))
|
49
|
-
try:
|
50
|
-
return project_api.lookup(uuid=uuid)
|
51
|
-
except HTTPError as e:
|
52
|
-
return error_handler(e)
|
53
|
-
|
54
|
-
|
55
|
-
@mcp.tool()
|
56
|
-
def get_project_hosted_api_details(uuid: str) -> str:
|
57
|
-
"""
|
58
|
-
Get a GibsonAI project's hosted API details
|
59
|
-
This includes necessary context for an LLM to understand and generate API calls related to fetching or modifying the project's data
|
60
|
-
"""
|
61
|
-
project_api = ProjectApi(Configuration(interactive=False))
|
62
|
-
try:
|
63
|
-
return project_api.mcp(uuid=uuid)
|
64
|
-
except HTTPError as e:
|
65
|
-
return error_handler(e)
|
66
|
-
|
67
|
-
|
68
|
-
@mcp.tool()
|
69
|
-
def update_project(uuid: str, project_name: str) -> Dict:
|
70
|
-
"""
|
71
|
-
Update a GibsonAI project's details
|
72
|
-
This currently only updates the project's name
|
73
|
-
Returns the updated project details
|
74
|
-
"""
|
75
|
-
project_api = ProjectApi(Configuration(interactive=False))
|
76
|
-
try:
|
77
|
-
return project_api.update(uuid=uuid, name=project_name)
|
78
|
-
except HTTPError as e:
|
79
|
-
return error_handler(e)
|
80
|
-
|
81
|
-
|
82
|
-
@mcp.tool()
|
83
|
-
def submit_data_modeling_request(uuid: str, data_modeling_request: str) -> Dict:
|
84
|
-
"""
|
85
|
-
Submit a data modeling request for a GibsonAI project
|
86
|
-
This tool fully handles all data modeling, you should provide the user's request as-is
|
87
|
-
Returns the response from the LLM
|
88
|
-
"""
|
89
|
-
project_api = ProjectApi(Configuration(interactive=False))
|
90
|
-
try:
|
91
|
-
return project_api.submit_message(uuid=uuid, message=data_modeling_request)
|
92
|
-
except HTTPError as e:
|
93
|
-
return error_handler(e)
|
94
|
-
|
95
|
-
|
96
|
-
@mcp.tool()
|
97
|
-
def deploy_project(uuid: str) -> None:
|
98
|
-
"""
|
99
|
-
Deploy a GibsonAI project's hosted databases
|
100
|
-
This deploys both the development and production databases simultaneously and automatically handles the migrations
|
101
|
-
"""
|
102
|
-
project_api = ProjectApi(Configuration(interactive=False))
|
103
|
-
try:
|
104
|
-
return project_api.deploy(uuid=uuid)
|
105
|
-
except HTTPError as e:
|
106
|
-
return error_handler(e)
|
107
|
-
|
108
|
-
|
109
|
-
@mcp.tool()
|
110
|
-
def get_project_schema(uuid: str) -> str:
|
111
|
-
"""
|
112
|
-
Get the schema for a GibsonAI project
|
113
|
-
This includes any changes made to the schema since the last deployment
|
114
|
-
"""
|
115
|
-
project_api = ProjectApi(Configuration(interactive=False))
|
116
|
-
try:
|
117
|
-
return project_api.schema(uuid=uuid)
|
118
|
-
except HTTPError as e:
|
119
|
-
return error_handler(e)
|
120
|
-
|
121
|
-
|
122
|
-
@mcp.tool()
|
123
|
-
def get_deployed_schema(uuid: str) -> str:
|
124
|
-
"""
|
125
|
-
Get the deployed schema for a GibsonAI project
|
126
|
-
This is the schema that is currently live on the project's hosted databases
|
127
|
-
"""
|
128
|
-
project_api = ProjectApi(Configuration(interactive=False))
|
129
|
-
try:
|
130
|
-
return project_api.database_schema(uuid=uuid)
|
131
|
-
except HTTPError as e:
|
132
|
-
return error_handler(e)
|
133
|
-
|
134
|
-
|
135
|
-
@mcp.tool()
|
136
|
-
def query_database(api_key: str, query: str) -> List[Dict] | None | Dict:
|
137
|
-
"""
|
138
|
-
Query a GibsonAI project's hosted database using SQL
|
139
|
-
Note: the environment-specific API key must be provided
|
140
|
-
"""
|
141
|
-
data_api = DataApi(Configuration(interactive=False), api_key=api_key)
|
142
|
-
try:
|
143
|
-
return data_api.query(query=query)
|
144
|
-
except HTTPError as e:
|
145
|
-
return error_handler(e)
|
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
|
{gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/services/code/customization/BaseCustomization.py
RENAMED
File without changes
|
{gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/services/code/customization/CustomizationManager.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/structure/mysql/constraints/ReferenceConstraint.py
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
|
{gibson_cli-0.8.3 → gibson_cli-0.8.4}/gibson/structure/mysql/tests/test_structure_mysql_Entity.py
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
|