secondbrainos-mcp-server 1.7.0 → 1.8.0
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 +27 -8
- package/bin/cli.js +0 -1
- package/build/index.js +8 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -56,6 +56,7 @@ The server exposes four types of MCP prompts, available as slash commands (e.g.
|
|
|
56
56
|
|
|
57
57
|
#### Start (`start_secondbrainos`)
|
|
58
58
|
- Returns a context document with SBOS terminology, agent architecture, and an index of all available agents and skills with their slash commands
|
|
59
|
+
- This is the **zero-cost discovery mechanism** — Claude can read this prompt to learn what agents and skills are available without calling `getAIAgentsSchema` or `runPromptChain` as MCP tools (which would be billed). All discovery data comes from the in-memory cache populated at session init
|
|
59
60
|
- Useful for orienting Claude at the start of a session
|
|
60
61
|
|
|
61
62
|
#### Skills (Workflows)
|
|
@@ -142,20 +143,38 @@ Credentials are stored securely at `~/.secondbrainos/credentials.json` (created
|
|
|
142
143
|
|
|
143
144
|
## How It Works
|
|
144
145
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
146
|
+
### Startup & Session Init
|
|
147
|
+
|
|
148
|
+
1. **Schema Fetching** (0 credits): On startup, the server POSTs your `user_id` to `schema.secondbrainos.com` and receives your personalized OpenAPI spec
|
|
149
|
+
2. **Schema Conversion**: The `@samchon/openapi` library converts the spec to LLM function calling format. Each API endpoint becomes an MCP tool. Three service paths are discovered from the spec for internal use:
|
|
150
|
+
- `runPromptChain` — fetches workflows/skills
|
|
151
|
+
- `getAIAgentsSchema` — fetches agents
|
|
152
|
+
- `generateFileUploadGoogleCloudStorageURL` — used only when a tool argument contains a local file path
|
|
153
|
+
3. **MCP server connects** via stdio — no API calls yet, no credits spent
|
|
154
|
+
|
|
155
|
+
### Cache Population (on first connection)
|
|
156
|
+
|
|
157
|
+
4. **ListPrompts trigger**: Claude Code automatically calls `ListPrompts` on connect. This is when the first credits are spent:
|
|
158
|
+
- `runPromptChain` is called with `{}` → returns all user workflows with prompt metadata (name, order, description)
|
|
159
|
+
- `getAIAgentsSchema` is called with `{include_sensitive_config: false}` → returns all user agents with behaviour, knowledge collection ID, actions, and workflows
|
|
160
|
+
5. **In-memory cache**: Both responses are normalized (consistent field names, defaults applied) and sorted (prompts ordered by `order` field), then stored in memory as `cachedWorkflows`, `cachedAgents`, and name-to-ID lookup maps
|
|
161
|
+
6. **Slash commands exposed**: The cached data is surfaced as MCP prompts — `/secondbrainos:skill_*`, `/secondbrainos:agent_*`, `/secondbrainos:start_secondbrainos`, and `/secondbrainos:knowledge_bases`
|
|
162
|
+
|
|
163
|
+
### During the Session
|
|
164
|
+
|
|
165
|
+
7. **Slash commands** (0 credits): When a user runs a slash command (e.g. `/secondbrainos:agent_my_agent`), the server returns the full agent/skill definition from cache — no API calls
|
|
166
|
+
8. **`start_secondbrainos`** (0 credits): Builds a context document from cached agents and workflows — an index of all available slash commands with descriptions, enabling Claude to discover and invoke agents/skills autonomously
|
|
167
|
+
9. **Tool calls** (billed per call): When Claude calls an MCP tool (e.g. `runPromptChain` with a specific entity/entity_id to fetch prompt instructions, or `searchMyKnowledge`), the server executes the API call via `api.secondbrainos.com` with authentication
|
|
168
|
+
10. **File upload**: If a tool argument contains a local file path (e.g. `addToMyKnowledge` with `file_path`), the server validates the extension, uploads the file to GCS via `generateFileUploadGoogleCloudStorageURL`, and replaces the path with the GCS URI before forwarding the API call
|
|
152
169
|
|
|
153
170
|
### Credit Cost
|
|
154
171
|
|
|
155
172
|
| Event | Credits |
|
|
156
173
|
|-------|---------|
|
|
157
|
-
|
|
|
174
|
+
| Schema fetch | 0 |
|
|
175
|
+
| Session init (ListPrompts) | n workflows + n agents |
|
|
158
176
|
| Slash commands | 0 (cached) |
|
|
177
|
+
| `start_secondbrainos` | 0 (cached) |
|
|
159
178
|
| Tool calls | Billed per call via service router |
|
|
160
179
|
|
|
161
180
|
See [`docs/architecture.md`](docs/architecture.md) for detailed diagrams.
|
package/bin/cli.js
CHANGED
package/build/index.js
CHANGED
|
@@ -444,7 +444,7 @@ class SecondBrainOSServer {
|
|
|
444
444
|
}
|
|
445
445
|
const url = `${this.baseUrl}${this.getAIAgentsSchemaPath}`;
|
|
446
446
|
const response = await axios.post(url, {
|
|
447
|
-
include_sensitive_config:
|
|
447
|
+
include_sensitive_config: false
|
|
448
448
|
}, {
|
|
449
449
|
headers: {
|
|
450
450
|
'Authorization': `Bearer ${this.userId}:${this.userSecret}`,
|
|
@@ -614,13 +614,18 @@ An agent definition combines:
|
|
|
614
614
|
3. **Workflows (Skills)** — the prompt chains the agent follows
|
|
615
615
|
|
|
616
616
|
## Loading Agent & Skill Details
|
|
617
|
-
- To get full agent definitions (behaviour, knowledge, actions, workflows): use the \`getAIAgentsSchema\` tool
|
|
618
|
-
- To get full skill/workflow details and run prompt chains: use the \`runPromptChain\` tool
|
|
617
|
+
- To get full agent definitions (behaviour, knowledge, actions, workflows): use the \`getAIAgentsSchema\` tool with \`tab_id\` to fetch a specific agent — never call without \`tab_id\`
|
|
618
|
+
- To get full skill/workflow details and run prompt chains: use the \`runPromptChain\` tool with \`entity\` and \`entity_id\` to fetch a specific workflow or prompt — never call without both parameters
|
|
619
619
|
|
|
620
620
|
## Accessing Agents & Skills
|
|
621
621
|
- **Users** invoke agents or skills via slash commands (e.g. \`/secondbrainos:agent_...\` or \`/secondbrainos:skill_...\`)
|
|
622
622
|
- **Users** cannot invoke MCP tools directly via slash commands — they must ask you to load and call the relevant tool
|
|
623
623
|
|
|
624
|
+
## Copyright
|
|
625
|
+
- Never reproduce copyrighted content verbatim — summarise, paraphrase, or cite instead
|
|
626
|
+
- When referencing copyrighted material from knowledge bases or external sources, always attribute the source
|
|
627
|
+
- If a user requests full reproduction of copyrighted text, decline and offer a summary
|
|
628
|
+
|
|
624
629
|
## Available Agents
|
|
625
630
|
${agentIndex || '_None configured_'}
|
|
626
631
|
|