adbpg-mcp-server 1.0.7__py3-none-any.whl → 1.0.8__py3-none-any.whl
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.
- {adbpg_mcp_server-1.0.7.dist-info → adbpg_mcp_server-1.0.8.dist-info}/METADATA +2 -2
- adbpg_mcp_server-1.0.8.dist-info/RECORD +6 -0
- adbpg_mcp_server.py +41 -9
- adbpg_mcp_server-1.0.7.dist-info/RECORD +0 -6
- {adbpg_mcp_server-1.0.7.dist-info → adbpg_mcp_server-1.0.8.dist-info}/WHEEL +0 -0
- {adbpg_mcp_server-1.0.7.dist-info → adbpg_mcp_server-1.0.8.dist-info}/entry_points.txt +0 -0
- {adbpg_mcp_server-1.0.7.dist-info → adbpg_mcp_server-1.0.8.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,6 @@
|
|
1
|
+
adbpg_mcp_server.py,sha256=w0ORWo_uAcsidDt_AXB3bxVTE424RswsH695wqOeNoM,45143
|
2
|
+
adbpg_mcp_server-1.0.8.dist-info/METADATA,sha256=f5HqV6BIloD80zBZzWbD8eEEsoPUcsnw4cqtlXxKADo,275
|
3
|
+
adbpg_mcp_server-1.0.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
4
|
+
adbpg_mcp_server-1.0.8.dist-info/entry_points.txt,sha256=n2NpLR8WNfa3Edju2l7Ngnsp7EiCUqNdYkF0dg42dnQ,58
|
5
|
+
adbpg_mcp_server-1.0.8.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
6
|
+
adbpg_mcp_server-1.0.8.dist-info/RECORD,,
|
adbpg_mcp_server.py
CHANGED
@@ -70,7 +70,7 @@ except Exception as e:
|
|
70
70
|
logger.error(f"Error loading environment variables: {e}")
|
71
71
|
sys.exit(1)
|
72
72
|
|
73
|
-
SERVER_VERSION = "0.
|
73
|
+
SERVER_VERSION = "0.2.0"
|
74
74
|
|
75
75
|
|
76
76
|
# 获得 graphrag 初始化配置
|
@@ -91,6 +91,22 @@ def get_graphrag_config():
|
|
91
91
|
|
92
92
|
# 获得llmemory 初始化配置
|
93
93
|
def get_llmemory_config():
|
94
|
+
config = get_db_config()
|
95
|
+
port = 3000
|
96
|
+
sql = """
|
97
|
+
select port from gp_segment_configuration where content = -1 and role = 'p';
|
98
|
+
"""
|
99
|
+
try:
|
100
|
+
with psycopg.connect(**config) as conn:
|
101
|
+
conn.autocommit = True
|
102
|
+
with conn.cursor() as cursor:
|
103
|
+
cursor.execute(sql)
|
104
|
+
port = cursor.fetchone()[0]
|
105
|
+
except Error as e:
|
106
|
+
raise RuntimeError(f"Database error: {str(e)}")
|
107
|
+
llmemory_enable_graph = os.getenv("LLMEMORY_ENABLE_GRAPH", "False")
|
108
|
+
|
109
|
+
|
94
110
|
llm_memory_config = {
|
95
111
|
"llm": {
|
96
112
|
"provider": "openai",
|
@@ -116,10 +132,22 @@ def get_llmemory_config():
|
|
116
132
|
"password": os.getenv("ADBPG_PASSWORD"),
|
117
133
|
"dbname": os.getenv("ADBPG_DATABASE"),
|
118
134
|
"hnsw": "True",
|
119
|
-
"embedding_model_dims": os.getenv("LLMEMORY_EMBEDDING_DIMS", 1024)
|
135
|
+
"embedding_model_dims": os.getenv("LLMEMORY_EMBEDDING_DIMS", 1024),
|
136
|
+
"port": port
|
120
137
|
}
|
121
138
|
}
|
122
139
|
}
|
140
|
+
if llmemory_enable_graph == "True" or llmemory_enable_graph == "true":
|
141
|
+
llm_memory_config["graph_store"] = {
|
142
|
+
"provider": "adbpg",
|
143
|
+
"config": {
|
144
|
+
"url": "http://localhost",
|
145
|
+
"username": os.getenv("ADBPG_USER"),
|
146
|
+
"password": os.getenv("ADBPG_PASSWORD"),
|
147
|
+
"database": os.getenv("ADBPG_DATABASE"),
|
148
|
+
"port": port
|
149
|
+
}
|
150
|
+
}
|
123
151
|
return llm_memory_config
|
124
152
|
|
125
153
|
def get_db_config():
|
@@ -870,14 +898,18 @@ async def call_tool(name: str, arguments: dict) -> list[TextContent]:
|
|
870
898
|
if not query_mode:
|
871
899
|
# default mode
|
872
900
|
query_mode = "mix"
|
873
|
-
|
874
|
-
start_search_node_id = None
|
875
|
-
|
876
|
-
# 命令拼接
|
901
|
+
|
877
902
|
wrapped_sql = f"""
|
878
|
-
|
879
|
-
|
880
|
-
params = [query_str, query_mode
|
903
|
+
SELECT adbpg_graphrag.query(%s::text, %s::text)
|
904
|
+
"""
|
905
|
+
params = [query_str, query_mode]
|
906
|
+
|
907
|
+
if start_search_node_id:
|
908
|
+
wrapped_sql = f"""
|
909
|
+
SELECT adbpg_graphrag.query(%s::text, %s::text, %s::text)
|
910
|
+
"""
|
911
|
+
params = [query_str, query_mode, start_search_node_id]
|
912
|
+
|
881
913
|
return get_graphrag_tool_result(wrapped_sql, params)
|
882
914
|
|
883
915
|
elif name == "adbpg_graphrag_reset_tree_query":
|
@@ -1,6 +0,0 @@
|
|
1
|
-
adbpg_mcp_server.py,sha256=g4iiTd2iq9GNzvrZFzeN19Gl06mGOFVahdExeUd5PUQ,44038
|
2
|
-
adbpg_mcp_server-1.0.7.dist-info/METADATA,sha256=YwLjxYvfr9fov4Ts-mDkG-0JjtttJPZhgrlYlE-XZh0,275
|
3
|
-
adbpg_mcp_server-1.0.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
4
|
-
adbpg_mcp_server-1.0.7.dist-info/entry_points.txt,sha256=n2NpLR8WNfa3Edju2l7Ngnsp7EiCUqNdYkF0dg42dnQ,58
|
5
|
-
adbpg_mcp_server-1.0.7.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
6
|
-
adbpg_mcp_server-1.0.7.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|