-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Milestone
Description
🔌 MCP Integration with nilDB for Tool-Calling I/O
This module introduces support for storing and retrieving data in nilDB
through MCP Server integration, enabling dynamic interaction via tool calling. This allows language models and external systems to act on behalf of users using structured, authenticated requests.
🧩 What is MCP?
MCP (Model Communication Protocol) is a middleware layer that defines secure and schema-aware interfaces for tools to interact with backend services. By integrating MCP with nilDB
, it becomes possible to invoke read/write actions directly from tools.
🚀 Features
- 🔐 User-authorized data access to
nilDB
via delegation and token-based control - 📤 Store arbitrary structured data into
nilDB
records schemas - 📥 Retrieve stored outputs using secure tool-call invocations
- 🧠 Language model-friendly interface, enabling AI agents to persist state across sessions
⚙️ How It Works
1. Tool Schema Registration
- The
nilDB
tool schemas are registered with the MCP Server. To check Tim's implementation for this. - Each tool definition includes parameters like
store_id
,fields
, anddelegation_token
.
2. Delegation
- A user generates a NUC granting access to specific collections or store IDs.
- This NUC is passed alongside tool calls to authorize operations.
3. Tool Call Execution
- A tool (e.g., LLM agent or external orchestrator) invokes
storeData
orfetchData
through MCP. - The MCP Server verifies the NUC and interfaces with
nilDB
. - Upon success, results (e.g. store ID or stored data) are returned to the calling agent.
🧭 Tool Interface Examples
Store Tool Call
{
"tool": "storeData",
"parameters": {
"collection_id": "user-notes",
"data": {
"title": "Meeting Summary",
"content": "Key action items..."
},
"delegation_token": "<NUC>"
}
}
{
"tool": "fetchData",
"parameters": {
"store_id": "abc123",
"delegation_token": "<NUC>"
}
}
🔁 Sequence Diagram
sequenceDiagram
participant User
participant Client App
participant Agent/LLM
participant MCP Server
participant nilDB
%% Step 1: User sends input securely
User->>Client App: "Store this data under my NUC"
%% Step 2: App calls LLM for tool suggestion
Client App->>Agent/LLM: Message + context
%% Step 3: LLM suggests tool call
Agent/LLM-->>Client App: tool_call (storeData)
%% Step 4: App executes tool call securely
Client App->>MCP Server: storeData(NUC, payload)
MCP Server->>nilDB: validate and store
nilDB-->>MCP Server: success ID
MCP Server-->>Client App: return ID
%% Step 5: App gives result to LLM
Client App->>Agent/LLM: tool_result (ID)
%% Step 6: LLM gives final response
Agent/LLM-->>Client App: Final response
Client App-->>User: "Data stored successfully"
Metadata
Metadata
Assignees
Labels
No labels