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
* This schema is similar to `docs/db.dbml` (already created by als)
23
+
* Calls `.well-known` endpoint to load schema
24
+
* This is created by API Logic Server, and stored in `docs/mcp_schema.json`. You can edit this as required to control what is discovered, and to minimize the information sent to the LLM.
25
25
26
26
2. MCP Client Executor sends Bus User ***NL query + schema*** (as prompt or tool definition) to the external LLM, here, ChatGPT (requires API Key). LLM returns an ***MCP Tool Context*** JSON block.
27
27
@@ -30,32 +30,11 @@
30
30
* We are using a test version: `integration/mcp/mcp_client_executor.py`
31
31
* Tool definitions are OpenAI specific, so we are sending the schema (in each prompt)
32
32
33
-
* Note this strongly suggests this is a **subset** of your database.
34
-
* This schema is derived from `docs/db.dbml` (already created by als)
33
+
* Note this strongly suggests this is a **subset** of your database - edit `docs/mcp_schema.json` as required.
35
34
36
35
37
36
3. MCP Client Executor iterates through the Tool Context, calling the JSON:API Endpoint that enforces business logic.
38
37
39
-
Here is a typical `https://localhost:5656/.well-known/mcp.json` response (not yet implemented):
@@ -68,31 +47,26 @@ In this example, we want a new service to:
68
47
1. Find Orders placed over 30 days ago that are not shipped
69
48
2. Send an Email encouraging prompt payment
70
49
71
-
We want to do this without troubling IT by enabling business users, while maintaining integrity. MCP meets this need.
50
+
We want to do this without troubling IT. MCP enables business users, while maintaining integrity through the existing logic-enabled JSON:APIs.
72
51
73
52
74
53
75
54
### Setup
76
55
77
-
There are 2 projects we have used for testing:
78
-
79
-
1.**basic_demo:** preferred, since has update - from Dev Source, run run config: `Create blt/genai_demo_ as IS_GENAI_DEMO`
80
-
81
-
2.**NW:** In the Manager, open `samples/nw_sample_nocust`, and explore `integration/mcp`. This has been successfully used to invoke the server, including with authorization.
56
+
Create the **basic_demo** under the [Manager](Manager.md) as described in the Manager readme:
82
57
83
-
3. Create in manager
58
+
1. In your IDE: `als create --project-name=basic_demo --db-url=basic_demo`
59
+
2. Run `als add-cust` to load mcp (and logic)
60
+
3. Start the Server (f5)
61
+
4. Run `python integration/mcp/mcp_client_executor.py`
84
62
85
-
4. Run `als add-cust` to load mcp tests
86
63
87
-
5. Run `python integration/mcp/mcp_client_executor.py`
88
-
89
-
90
-
You will need a ChatGPT APIKey.
64
+
You will need an environment variable: `APILOGICSERVER_CHATGPT_APIKEY` ChatGPT APIKey.
91
65
92
66
93
67
### Prompt
94
68
95
-
Here is a NL prompt using *basic_demo:*
69
+
Here is a NL prompt using *basic_demo* coded into `mcp_client_executor`
96
70
97
71
```
98
72
List the orders created more than 30 days ago, and send a discount offer email to the customer for each one.
@@ -108,22 +82,38 @@ Respond with a JSON array of tool context blocks using:
108
82
109
83
### Sample Flow
110
84
111
-
#### MCP Client Executor
85
+
You can run `mcp_client_executor` under the debugger, and stop at each of the breakpoints noted in the screenshot below.
Discovery uses a config file `integration/mcp/mcp_server_discovery.json` to discover 1 or more servers, and invoke their `.well-known` endpoint to obtain the schema.
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.
MCP is capable of executing email directly, but we have business policies providing for email opt-outs. We must respect this logic.
113
+
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:
@@ -136,19 +126,13 @@ We welcome participation in this exploration. Please contact us via [discord](ht
136
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"}.
137
127
138
128
139
-
## Appendix 1: Exposing Corp DB to public MCP
140
129
141
-
TBD - investigate exposing a corp db to MCP so it can be discovered and used in a choreography.
0 commit comments