Skip to content

Commit 8e91169

Browse files
committed
mcp orchestration
1 parent 801e26b commit 8e91169

File tree

2 files changed

+42
-12
lines changed

2 files changed

+42
-12
lines changed

docs/Integration-MCP.md

Lines changed: 42 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,26 +69,56 @@ You will need a ChatGPT APIKey.
6969

7070
![Intro diagram](https://github.com/ApiLogicServer/Docs/blob/main/docs/images/integration/mcp/MCP_Arch.png?raw=true)
7171

72-
1. Bus User enters a natural language query in the internal UI.
72+
1. MCP Client Executor Startup
7373

74-
* This might be similar to installed/Web ChatGPT (etc), but those *cannot* be used to access MCPs since they cannot issue http calls. This is an internally developed app (or, perhaps an IDE tool)
75-
* We are using a test version: `integration/mcp/mcp_client_executor.py`
74+
* Calls *wellknown* endpoint to load schema
75+
* This schema is similar to `docs/db.dbml` (already created by als)
7676

77-
2. MCP Client Executor sends the query + schema (as prompt or tool definition) to the external LLM, here, ChatGPT (requires API Key).
77+
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.
7878

79-
* Tool definitions are OpenAI specific, so we are sending the schema in each prompt.
80-
* This schema is derived from `docs/db.dbml` (already created by als)
81-
* Note this strongly suggests this is a **subset** of your database.
79+
* An MCP Client Executor might be similar in concept to installed/Web ChatGPT (etc), but those *cannot* be used to access MCPs since they cannot issue http calls. This is an internally developed app (or, perhaps an IDE tool)
80+
81+
* We are using a test version: `integration/mcp/mcp_client_executor.py`
82+
* Tool definitions are OpenAI specific, so we are sending the schema (in each prompt)
8283

83-
3. LLM returns an MCP Tool Context JSON block.
84+
* Note this strongly suggests this is a **subset** of your database.
85+
* This schema is derived from `docs/db.dbml` (already created by als)
86+
87+
88+
4. MCP Client Executor iterates through the Tool Context, calling the JSON:API Endpoint that enforces business logic.
89+
90+
Here is a typical `https://localhost:5656/.well-known/mcp.json` response (not yet implemented):
91+
92+
```json
93+
{
94+
"tool_type": "json-api",
95+
"base_url": "https://crm.company.com",
96+
"resources": [
97+
{
98+
"name": "Customer",
99+
"path": "/Customer",
100+
"methods": ["GET", "PATCH"],
101+
"fields": ["id", "name", "balance", "credit_limit"],
102+
"filterable": ["name", "credit_limit"],
103+
"example": "List customers with credit over 5000"
104+
}
105+
]
106+
}
107+
```
84108

85-
4. MCP Client Executor sends the Tool Context to the MCP Server Executor, an endpoint in your als project
109+
### Example
86110

87-
* See `api/api_discovery/mcp_server_executor.py`
111+
Here is a NL prompt using *basic_demo:*
88112

89-
5. MCP Server Executor calls the JSON:API Endpoint that enforces business logic.
113+
```
114+
List the orders created more than 30 days ago, and send a discount offer email to the customer for each one.
90115
91-
6. JSON:API queries the Corp DB and returns the results.
116+
Respond with a JSON array of tool context blocks using:
117+
- tool: 'json-api'
118+
- JSON:API-compliant filtering (e.g., filter[CreatedOn][lt])
119+
- Use {{ order.customer_id }} as a placeholder in the second step.
120+
- Include method, url, query_params or body, headers, expected_output.
121+
```
92122

93123
%nbsp;
94124

50.3 KB
Loading

0 commit comments

Comments
 (0)