secondbrainos-mcp-server 1.2.2 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -10
- package/build/index.js +58 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# Second Brain OS MCP Server
|
|
2
2
|
|
|
3
|
-
This package provides a Model Context Protocol (MCP) server for integrating Second Brain OS with Claude Desktop.
|
|
3
|
+
This package provides a Model Context Protocol (MCP) server for integrating Second Brain OS with Claude Desktop and Claude Code.
|
|
4
4
|
|
|
5
5
|
## Prerequisites
|
|
6
6
|
|
|
7
7
|
- Node.js v16 or higher
|
|
8
|
-
- Claude Desktop application
|
|
8
|
+
- Claude Desktop application and/or Claude Code CLI
|
|
9
9
|
- A valid Second Brain OS account with the Claude MCP feature enabled
|
|
10
10
|
|
|
11
11
|
## Installation
|
|
@@ -28,6 +28,16 @@ This will:
|
|
|
28
28
|
3. Create the necessary configuration files for Claude Desktop
|
|
29
29
|
4. Configure the server to dynamically fetch your available API endpoints
|
|
30
30
|
|
|
31
|
+
### Claude Code
|
|
32
|
+
|
|
33
|
+
To add the server to Claude Code:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
claude mcp add secondbrainos-mcp-server -- npx secondbrainos-mcp-server
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Or add it to your project's `.mcp.json` file.
|
|
40
|
+
|
|
31
41
|
## Features
|
|
32
42
|
|
|
33
43
|
### Enhanced OpenAPI Support
|
|
@@ -41,13 +51,23 @@ The server uses `@samchon/openapi` library for robust OpenAPI handling, providin
|
|
|
41
51
|
- Automatic request formatting based on OpenAPI specifications
|
|
42
52
|
- Support for complex parameters and nested objects
|
|
43
53
|
|
|
44
|
-
### Prompts
|
|
45
|
-
The server exposes
|
|
54
|
+
### Prompts
|
|
55
|
+
The server exposes three types of MCP prompts, available in the client's attach menu:
|
|
56
|
+
|
|
57
|
+
#### Skills (Workflows)
|
|
46
58
|
- Automatically discovers your workflows via the `runPromptChain` service
|
|
47
|
-
- Each
|
|
48
|
-
- Selecting a prompt fetches the full prompt chain (ordered instructions) and injects them into the conversation
|
|
59
|
+
- Each skill appears with a `[Skill]` prefix and returns a structured document with `skill_id`, `name`, `description`, and an ordered list of prompts (metadata only, no instructions)
|
|
49
60
|
- Supports an optional `user_input` argument to provide additional context
|
|
50
61
|
|
|
62
|
+
#### Agents
|
|
63
|
+
- Discovers your AI agents via the `getAIAgentsSchema` service
|
|
64
|
+
- Each agent appears with an `[Agent]` prefix and returns a structured document containing `agent_id`, `name`, `description`, `behaviour_and_instructions`, `searchMyKnowledge_collection_id`, `actions` (with id, name, description, body_parameters), and `workflows` (with enriched prompt metadata)
|
|
65
|
+
- Supports an optional `user_input` argument
|
|
66
|
+
|
|
67
|
+
#### Knowledge Bases
|
|
68
|
+
- Aggregates all `searchMyKnowledge_collection_id` values from your agents
|
|
69
|
+
- Appears as a single `[Knowledge Bases]` prompt returning an array of collection IDs
|
|
70
|
+
|
|
51
71
|
### Better Error Handling
|
|
52
72
|
- Detailed error messages for debugging
|
|
53
73
|
- Proper handling of authentication failures, bad requests, and service errors
|
|
@@ -124,14 +144,14 @@ The server requires the following environment variables:
|
|
|
124
144
|
1. **Schema Fetching**: On startup, the server fetches your personalized OpenAPI schema from Second Brain OS
|
|
125
145
|
2. **Schema Conversion**: The `@samchon/openapi` library converts the schema to an optimized format for LLM function calling
|
|
126
146
|
3. **MCP Tools**: Each API endpoint becomes an MCP tool that Claude can use
|
|
127
|
-
4. **MCP Prompts**:
|
|
147
|
+
4. **MCP Prompts**: Your skills (workflows), AI agents, and knowledge bases are exposed as selectable prompts in the client UI
|
|
128
148
|
5. **Function Execution**: When Claude calls a tool, the server executes the corresponding API call with proper authentication
|
|
129
149
|
|
|
130
150
|
## Troubleshooting
|
|
131
151
|
|
|
132
|
-
###
|
|
133
|
-
1.
|
|
134
|
-
2.
|
|
152
|
+
### Client doesn't see the server
|
|
153
|
+
1. **Claude Desktop**: Ensure it's completely quit before running setup. Check the configuration file was created at the correct location.
|
|
154
|
+
2. **Claude Code**: Run `claude mcp add` or check your `.mcp.json` configuration.
|
|
135
155
|
3. Review the logs at the platform-specific location mentioned during setup
|
|
136
156
|
|
|
137
157
|
### Authentication errors
|
package/build/index.js
CHANGED
|
@@ -248,12 +248,70 @@ class SecondBrainOSServer {
|
|
|
248
248
|
console.error('Failed to fetch agents for prompts/list:', error);
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
|
+
// Add Knowledge Bases prompt (collects searchMyKnowledge_collection_ids from agents)
|
|
252
|
+
if (this.getAIAgentsSchemaPath) {
|
|
253
|
+
try {
|
|
254
|
+
const agents = await this.fetchAndEnrichAgents();
|
|
255
|
+
const collectionIds = agents
|
|
256
|
+
.map((a) => a.searchMyKnowledge_collection_id)
|
|
257
|
+
.filter((id) => id && id.length > 0);
|
|
258
|
+
if (collectionIds.length > 0) {
|
|
259
|
+
prompts.push({
|
|
260
|
+
name: "Knowledge Bases",
|
|
261
|
+
title: "[Knowledge Bases]",
|
|
262
|
+
description: "Knowledge base collection IDs available to agents",
|
|
263
|
+
arguments: [
|
|
264
|
+
{
|
|
265
|
+
name: "user_input",
|
|
266
|
+
description: "Optional context or input",
|
|
267
|
+
required: false
|
|
268
|
+
}
|
|
269
|
+
]
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
catch (error) {
|
|
274
|
+
console.error('Failed to build knowledge bases prompt:', error);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
251
277
|
return { prompts };
|
|
252
278
|
});
|
|
253
279
|
// Get a specific prompt (workflow prompt chain or agent document)
|
|
254
280
|
this.server.setRequestHandler(GetPromptRequestSchema, async (request) => {
|
|
255
281
|
const promptName = request.params.name;
|
|
256
282
|
const userInput = request.params.arguments?.user_input;
|
|
283
|
+
// Check if this is the Knowledge Bases prompt
|
|
284
|
+
if (promptName === "Knowledge Bases") {
|
|
285
|
+
const agents = await this.fetchAndEnrichAgents();
|
|
286
|
+
const collectionIds = agents
|
|
287
|
+
.map((a) => a.searchMyKnowledge_collection_id)
|
|
288
|
+
.filter((id) => id && id.length > 0);
|
|
289
|
+
const knowledgeBasesDocument = {
|
|
290
|
+
searchMyKnowledge_collection_ids: collectionIds
|
|
291
|
+
};
|
|
292
|
+
const messages = [
|
|
293
|
+
{
|
|
294
|
+
role: "user",
|
|
295
|
+
content: {
|
|
296
|
+
type: "text",
|
|
297
|
+
text: JSON.stringify(knowledgeBasesDocument, null, 2)
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
];
|
|
301
|
+
if (userInput) {
|
|
302
|
+
messages.push({
|
|
303
|
+
role: "user",
|
|
304
|
+
content: {
|
|
305
|
+
type: "text",
|
|
306
|
+
text: userInput
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
return {
|
|
311
|
+
description: `Knowledge Bases (${collectionIds.length} collection${collectionIds.length !== 1 ? 's' : ''})`,
|
|
312
|
+
messages
|
|
313
|
+
};
|
|
314
|
+
}
|
|
257
315
|
// Check if this is an agent prompt
|
|
258
316
|
const agentId = this.agentNameToId.get(promptName);
|
|
259
317
|
if (agentId) {
|