Extensions: skills, plugins, MCP, sub-agents; configurable keys
- Skills (SKILL.md discovery, skill tool, /skills /skill) - plugin.json exec tools with permission prompts, timeouts and workspace trust (/plugins) - MCP stdio client: JSON-RPC initialize/tools/list/tools/call, mcp__server__tool, /mcp and sidebar status - task tool with general/explore/plan and .agent/agents/*.md roles, parallel read-only runs, cancel propagation, /agents - Keymap with Ctrl+X leader, keybinds.json overrides and /keys panel - Collapsed thinking, throttled streaming Markdown, leaner tool output, parallel read-only tools - Spawn: close-on-exec pipes and a process-wide fork lock - Tests for keymap, skills, plugins, MCP, sub-agents, shell compaction; docs/plugins.md
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
#ifndef CST_MCP_H
|
||||
#define CST_MCP_H
|
||||
|
||||
/*
|
||||
* MCP (Model Context Protocol) client over stdio: newline-delimited
|
||||
* JSON-RPC 2.0. Each server is spawned with its command/args/env, gets
|
||||
* initialize + notifications/initialized + tools/list, and every tool is
|
||||
* registered as mcp__<server>__<tool> (approved like network tools).
|
||||
*
|
||||
* Config, merged in this order (first name wins):
|
||||
* <ws>/.agent/mcp.json (trusted workspaces only), <config>/mcp.json,
|
||||
* plugin "mcpServers". Format: {"mcpServers": {"name": {"command": "npx",
|
||||
* "args": ["-y", "pkg"], "env": {"K": "V"}, "cwd": "...",
|
||||
* "disabled": false}}}
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define CST_MCP_MAX 16
|
||||
|
||||
typedef enum {
|
||||
CST_MCP_OFF = 0,
|
||||
CST_MCP_STARTING,
|
||||
CST_MCP_READY,
|
||||
CST_MCP_FAILED,
|
||||
CST_MCP_EXITED
|
||||
} cst_mcp_state_t;
|
||||
|
||||
typedef struct {
|
||||
char name[64];
|
||||
char source[48]; /* "workspace" | "user" | "plugin:<name>" */
|
||||
char command[256];
|
||||
int state; /* cst_mcp_state_t */
|
||||
int ntools;
|
||||
char error[200];
|
||||
} cst_mcp_info_t;
|
||||
|
||||
/* One server from a JSON object text ({"command":..., "args":[...], ...}).
|
||||
* cwd: default working directory (NULL = workspace). Returns 0, or -1 when
|
||||
* the name exists / the config is invalid. */
|
||||
int cst_mcp_add_config_json(const char *name, const char *server_json,
|
||||
const char *cwd, const char *source);
|
||||
/* Read the mcp.json files for workspace (the workspace one only when
|
||||
* trusted). Returns servers added; *untrusted counts skipped ones. */
|
||||
int cst_mcp_load_configs(const char *workspace, int ws_trusted,
|
||||
int *untrusted);
|
||||
/* Start every configured server in the background; tools appear as each
|
||||
* one finishes its handshake. */
|
||||
void cst_mcp_start_all(const char *workspace);
|
||||
/* Wait up to ms for servers still starting (headless runs). */
|
||||
void cst_mcp_wait_ready(int ms);
|
||||
/* Stop servers, unregister their tools and forget the configs. */
|
||||
void cst_mcp_stop_all(void);
|
||||
int cst_mcp_info(cst_mcp_info_t *out, int max);
|
||||
/* Ready / configured counts (for the sidebar). */
|
||||
void cst_mcp_counts(int *ready, int *total);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user