Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/spec/PROTOCOL_MAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ This document serves as the **Grand Map** of the ObjectStack specification. It l
| :--- | :--- | :--- |
| [`agent.zod.ts`](src/ai/agent.zod.ts) | ⭐ | **AI Agent**. Attributes of an AI assistant (role, personality, model). |
| [`agent-action.zod.ts`](src/ai/agent-action.zod.ts) | ⭐ | **Tools & Actions**. Capabilities exposed to the AI (Function Calling). |
| [`mcp.zod.ts`](src/ai/mcp.zod.ts) | ⭐ | **Model Context Protocol (MCP)**. Standard protocol for connecting AI to tools, resources, and data sources. |
| [`rag-pipeline.zod.ts`](src/ai/rag-pipeline.zod.ts) | ⭐ | **RAG**. Retrieval Augmented Generation configurations. |
| [`model-registry.zod.ts`](src/ai/model-registry.zod.ts) | | **LLM Registry**. Configuration for model providers (OpenAI, Anthropic). |
| [`conversation.zod.ts`](src/ai/conversation.zod.ts) | | **Chat Session**. History and context management for AI chats. |
Expand Down
132 changes: 131 additions & 1 deletion packages/spec/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The **Source of Truth** for the ObjectStack Protocol. Contains strictly typed Zo
- **Data**: Objects, Fields, Validation Rules.
- **UI**: Views, Layouts, Dashboards.
- **Automation**: Flows, Workflows, Triggers.
- **AI**: Agents, RAG Pipelines, Models.
- **AI**: Agents, RAG Pipelines, Models, MCP Servers.

## Usage

Expand Down Expand Up @@ -58,3 +58,133 @@ if (result.success) {
console.log('Valid object:', result.data);
}
```

## MCP (Model Context Protocol) Integration

Define MCP servers to connect AI agents to your ObjectStack data and tools:

Comment on lines +62 to +65
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR description mentions adding a Chinese MCP guide (docs/MCP_GUIDE_CN.md), but only docs/MCP_GUIDE.md exists in this PR. Either add the CN doc as described or update the PR description to match what’s actually included.

Copilot uses AI. Check for mistakes.
```typescript
import { MCPServerConfigSchema } from '@objectstack/spec/ai';

// Define an MCP server exposing ObjectStack data
export const objectStackMCP = MCPServerConfigSchema.parse({
name: 'objectstack_mcp',
label: 'ObjectStack MCP Server',
description: 'Connects AI agents to ObjectStack data and workflows',

serverInfo: {
name: 'ObjectStack MCP',
version: '1.0.0',
capabilities: {
resources: true,
resourceTemplates: true,
tools: true,
prompts: true,
},
},

transport: {
type: 'http',
url: 'https://api.objectstack.ai/mcp',
auth: {
type: 'bearer',
secretRef: 'system:mcp_api_key',
},
},

// Expose data as resources
resourceTemplates: [
{
uriPattern: 'objectstack://objects/{objectName}',
name: 'Object Data',
description: 'Access object records',
parameters: [
{
name: 'objectName',
type: 'string',
required: true,
description: 'Name of the object to access',
},
],
handler: 'resources.getObjectData',
},
],

// Expose workflows as tools
tools: [
{
name: 'create_record',
description: 'Create a new record in any object',
parameters: [
{
name: 'object',
type: 'string',
description: 'Object name (e.g., "account", "contact")',
required: true,
},
{
name: 'data',
type: 'object',
description: 'Record data as key-value pairs',
required: true,
},
],
handler: 'flows.create_record',
sideEffects: 'write',
requiresConfirmation: true,
},
{
name: 'search_records',
description: 'Search for records using natural language or filters',
parameters: [
{
name: 'object',
type: 'string',
description: 'Object to search in',
required: true,
},
{
name: 'query',
type: 'string',
description: 'Search query',
required: true,
},
],
handler: 'data.search',
sideEffects: 'read',
},
],

// Provide prompt templates
prompts: [
{
name: 'analyze_customer_data',
description: 'Analyze customer data and generate insights',
messages: [
{
role: 'system',
content: 'You are a data analyst specializing in customer insights.',
},
{
role: 'user',
content: 'Analyze the following customer data and provide insights: {{customer_data}}',
},
],
arguments: [
{
name: 'customer_data',
type: 'string',
required: true,
description: 'Customer data in JSON format',
},
],
},
],

autoStart: true,
healthCheck: {
enabled: true,
interval: 60000,
},
});
```
Loading
Loading