You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/Integration-MCP.md
+50-17Lines changed: 50 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -9,8 +9,8 @@
9
9
10
10
In some cases, you may have a database, but neither the APIs nor the logic. GenAI-Logic API Logic Server can **mcp-ify existing databases** by:
11
11
12
-
3. Creating JSON:APIs for existing databases with a single CLI command
13
-
4. Enabling you to [declare business logic](Logic.md), which can be used via the APIs in MCP executipn flows.
12
+
1. Creating JSON:APIs for existing databases with a single CLI command
13
+
2. Enabling you to [declare business logic](Logic.md), which can be used via the APIs in MCP executipn flows.
14
14
15
15
16
16
@@ -96,10 +96,15 @@ Discovery uses a config file `integration/mcp/mcp_server_discovery.json` to disc
96
96
97
97
#### 2 - Tool Context from LLM
98
98
99
-
We call the LLM, providing the NL Query and the schema returned above. It returns a Tool Context completion (response), with the steps to call in the MCP Server Executor, which here is the logic-enabled API Logic Server JSON:API.
99
+
We call the LLM, providing the NL Query and the discovered schema returned above. Note the schema includes:
* You would typically edit this file to expose only desired data, and reduce the size of the prompt
103
+
2. instructions on how to format `expected_response` (e.g., `query_params`)
104
+
3. how to use the **Request Pattern** to send email, subject to logic (see Logic, below):
102
105
106
+
 The LLM returns a Tool Context completion (response), with the steps to call the MCP Server Executor, which here is the logic-enabled API Logic Server JSON:API.
The calls include GET, and a POST for each returned row.
@@ -111,36 +116,64 @@ The calls include GET, and a POST for each returned row.
111
116
112
117
MCP is capable of executing email directly, but we have business policies providing for email opt-outs. We must respect this logic.
113
118
114
-
As shown below, a common logic pattern is a `Request Object`: you insert it, it's business logic runs. Here, the logic checks the opt-out, and sends the mail:
119
+
As shown below, a common logic pattern is a `Request Object`: you insert a row, triggering its business logic. Here, the logic (an *after_flush* event) checks the opt-out, and sends the mail (stubbed):
This is an initial experiment, with a number of ToDo's: real filtering, update, etc. That said, it might be an excellent way to explore MCP.
127
+
This is an initial experiment, with significant ToDo's (security, etc). That said, it might be an excellent way to explore MCP.
123
128
124
129
We welcome participation in this exploration. Please contact us via [discord](https://discord.gg/HcGxbBsgRF).
125
130
126
-
This exploration is changing rapidly. For updates, replace `integration/mcp` from [integration/msp](https://github.com/ApiLogicServer/ApiLogicServer-src/tree/main/api_logic_server_cli/prototypes/nw_no_cust/integration/mcp){:target="_blank" rel="noopener"}.
4. and this [N8N link](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-langchain.mcptrigger/?utm_source=n8n_app&utm_medium=node_settings_modal-credential_link&utm_campaign=%40n8n%2Fn8n-nodes-langchain.mcpTriggerlangchain.mcpTriggerlangchain.mcpTrigger)
144
+
145
+
5. and this [python sdk](https://github.com/modelcontextprotocol/python-sdk)
146
+
147
+
6. and [this video](https://www.youtube.com/shorts/xdMVgZfZ1yg)
148
+
149
+
150
+
151
+
## Appendix: Key Clarifications
152
+
153
+
MCP is a new technology. In my learning curve, I found much of the information a little bit vague and in some cases, misleading. The sections below identify key clarifications to incorrect assumptions I had made, so I have listed them below in hopes they can help you.
Several articles described the Client Executor as a "host such as Claude". That lead me to believe that common chat apps could call MCPs.
160
+
161
+
Later, I discovered that most chat apps cannot call http, and so cannot directly call MCPs. The Client Executor is analogous to a chat, but is written specifically for MCP use.
162
+
163
+
164
+
165
+
### Client Executor (not LLM) calls the MCP
166
+
167
+
I saw several diagrams with arrows from the LLM to the MCP. That lead me to believe that the LLM *calls* the MCP.
168
+
169
+
Later, I realized that the LLM is just preparing the Tool Context. The Client Executor uses this to invoke the MCP. I now think of the arrow as "knows how to include it in the Tool Context".
- and this [N8N link](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-langchain.mcptrigger/?utm_source=n8n_app&utm_medium=node_settings_modal-credential_link&utm_campaign=%40n8n%2Fn8n-nodes-langchain.mcpTriggerlangchain.mcpTriggerlangchain.mcpTrigger)
175
+
Finally, I presumed that the Client Executor would pass the Tool Context to the LLM. This was simply a bad guess.
143
176
144
-
- and this [python sdk](https://github.com/modelcontextprotocol/python-sdk)
177
+
The key idea is that one specific Server Executor would not be aware it is part of an orchestration. In the case of database APIs, the Server Executor is the set of logic-enabled endpoints identified in the discovery schema.
145
178
146
-
- and [this video](https://www.youtube.com/shorts/xdMVgZfZ1yg)
179
+
Note the logic here is critical. The Client Executor can not / should not "reach in" and be aware of logic specific to each involved database.
0 commit comments