@grackle-ai/mcp 0.69.1 → 0.70.1

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.
Files changed (2) hide show
  1. package/README.md +264 -0
  2. package/package.json +2 -2
package/README.md ADDED
@@ -0,0 +1,264 @@
1
+ # @grackle-ai/mcp
2
+
3
+ **MCP (Model Context Protocol) server for [Grackle](https://github.com/nick-pape/grackle)** — exposes Grackle's full capabilities as MCP tools so any AI agent can manage environments, spawn sessions, orchestrate tasks, and share knowledge.
4
+
5
+ This package translates MCP tool calls into [ConnectRPC](https://connectrpc.com/) requests to the Grackle server. It implements the [MCP Streamable HTTP transport](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#streamable-http) and supports multiple concurrent client sessions.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install @grackle-ai/mcp
11
+ ```
12
+
13
+ Or run the standalone server directly:
14
+
15
+ ```bash
16
+ npx @grackle-ai/mcp
17
+ ```
18
+
19
+ ## Quick Start
20
+
21
+ The MCP server connects to an already-running Grackle server. Start the Grackle server first, then launch the MCP server:
22
+
23
+ ```bash
24
+ # 1. Start the Grackle server (installs the CLI if needed)
25
+ npx @grackle-ai/cli serve
26
+
27
+ # 2. Start the MCP server (reads the API key automatically)
28
+ npx @grackle-ai/mcp
29
+ ```
30
+
31
+ The MCP server listens on `http://127.0.0.1:7435/mcp` by default.
32
+
33
+ ## Configuration
34
+
35
+ All configuration is via environment variables:
36
+
37
+ | Variable | Default | Description |
38
+ |----------|---------|-------------|
39
+ | `GRACKLE_MCP_PORT` | `7435` | Port the MCP server listens on |
40
+ | `GRACKLE_HOST` | `127.0.0.1` | Bind address (must be a loopback address) |
41
+ | `GRACKLE_URL` | `http://127.0.0.1:7434` | URL of the Grackle gRPC server to connect to |
42
+ | `GRACKLE_API_KEY` | *(auto-loaded)* | API key for authenticating with the gRPC server. If not set, reads from `~/.grackle/api-key` |
43
+ | `LOG_LEVEL` | `info` | Logging level (`debug`, `info`, `warn`, `error`) |
44
+
45
+ ## Programmatic Usage
46
+
47
+ The package also exports `createMcpServer` for embedding the MCP server in your own application:
48
+
49
+ ```ts
50
+ import { createMcpServer } from "@grackle-ai/mcp";
51
+
52
+ const server = createMcpServer({
53
+ bindHost: "127.0.0.1",
54
+ mcpPort: 7435,
55
+ grpcPort: 7434,
56
+ apiKey: "your-api-key",
57
+ });
58
+
59
+ server.listen(7435, "127.0.0.1", () => {
60
+ console.log("MCP server ready");
61
+ });
62
+ ```
63
+
64
+ ## Authentication
65
+
66
+ The MCP server supports three authentication modes:
67
+
68
+ - **API key** — Full access. Pass as `Authorization: Bearer <api-key>`.
69
+ - **OAuth** — Full access. Token issued by the Grackle OAuth authorization server.
70
+ - **Scoped token** — Limited tool access. Issued to agents working on a specific task. Only a subset of tools is available (see [Scoped Access](#scoped-access) below).
71
+
72
+ ## Client Configuration
73
+
74
+ ### Claude Desktop / Claude Code
75
+
76
+ Add to your MCP configuration (`claude_desktop_config.json` or `.mcp.json`):
77
+
78
+ ```json
79
+ {
80
+ "mcpServers": {
81
+ "grackle": {
82
+ "url": "http://127.0.0.1:7435/mcp",
83
+ "headers": {
84
+ "Authorization": "Bearer <your-api-key>"
85
+ }
86
+ }
87
+ }
88
+ }
89
+ ```
90
+
91
+ ### Any MCP-compatible client
92
+
93
+ Point your client at `http://127.0.0.1:7435/mcp` using the Streamable HTTP transport with a Bearer token in the `Authorization` header.
94
+
95
+ ---
96
+
97
+ ## Tool Reference
98
+
99
+ The MCP server exposes 50 tools organized into 13 groups. Each tool validates its inputs against a strict schema and returns structured JSON results.
100
+
101
+ ### Environment Tools
102
+
103
+ Manage compute environments where agents run (Docker, SSH, Codespace, local).
104
+
105
+ | Tool | Description | Parameters |
106
+ |------|-------------|------------|
107
+ | `env_list` | List all registered environments with status, adapter type, and runtime. | *(none)* |
108
+ | `env_add` | Register a new environment. | `displayName` (string), `adapterType` (string), `adapterConfig?` (object) |
109
+ | `env_provision` | Provision an environment — start resources, install the agent, and connect. | `environmentId` (string) |
110
+ | `env_stop` | Stop a running environment without destroying its resources. | `environmentId` (string) |
111
+ | `env_destroy` | Destroy an environment's backing resources (e.g., delete the container). | `environmentId` (string) |
112
+ | `env_remove` | Remove an environment registration. Must be stopped first. | `environmentId` (string) |
113
+ | `env_wake` | Wake a stopped environment by re-provisioning it. | `environmentId` (string) |
114
+
115
+ ### Session Tools
116
+
117
+ Manage AI agent sessions — spawn, monitor, interact, and terminate.
118
+
119
+ | Tool | Description | Parameters |
120
+ |------|-------------|------------|
121
+ | `session_spawn` | Spawn a new agent session with a prompt and optional model config. | `environmentId` (string), `prompt` (string), `maxTurns?` (int), `personaId?` (string), `worktreeBasePath?` (string) |
122
+ | `session_resume` | Resume a terminated session (completed, failed, or interrupted). | `sessionId` (string) |
123
+ | `session_status` | List sessions with optional filtering by environment and status. | `environmentId?` (string), `all?` (boolean, default false) |
124
+ | `session_kill` | Terminate a running session immediately. | `sessionId` (string) |
125
+ | `session_attach` | Stream events from a running session for a limited duration. | `sessionId` (string), `timeoutSeconds?` (int, default 30, max 300), `maxEvents?` (int) |
126
+ | `session_send_input` | Send a text message to a session waiting for user input. | `sessionId` (string), `text` (string) |
127
+
128
+ ### Workspace Tools
129
+
130
+ Manage workspaces that group tasks, agents, and repositories.
131
+
132
+ | Tool | Description | Parameters |
133
+ |------|-------------|------------|
134
+ | `workspace_list` | List all workspaces with names, descriptions, repos, and status. | `environmentId?` (string) |
135
+ | `workspace_create` | Create a new workspace. | `name` (string), `environmentId` (string), `description?` (string), `repoUrl?` (string), `worktreeBasePath?` (string), `useWorktrees?` (boolean), `defaultPersonaId?` (string) |
136
+ | `workspace_get` | Get full details of a workspace by ID. | `workspaceId` (string) |
137
+ | `workspace_update` | Update a workspace's name, description, repo, or settings. | `workspaceId` (string), `name?`, `description?`, `repoUrl?`, `environmentId?`, `worktreeBasePath?`, `useWorktrees?`, `defaultPersonaId?` |
138
+ | `workspace_archive` | Archive a workspace, marking it as inactive. | `workspaceId` (string) |
139
+
140
+ ### Task Tools
141
+
142
+ Create, manage, and run tasks within workspaces. Supports hierarchical task trees and dependency gating.
143
+
144
+ | Tool | Description | Parameters |
145
+ |------|-------------|------------|
146
+ | `task_list` | List tasks with optional search and status filters. | `workspaceId?` (string), `search?` (string), `status?` (string: `not_started`, `working`, `paused`, `complete`, `failed`) |
147
+ | `task_create` | Create a new task with dependencies and parent hierarchy. | `workspaceId?` (string), `title` (string), `description?` (string), `dependsOn?` (string[]), `parentTaskId?` (string), `canDecompose?` (boolean), `defaultPersonaId?` (string) |
148
+ | `task_show` | Get full details of a task. | `taskId` (string) |
149
+ | `task_update` | Update a task's title, description, status, or dependencies. | `taskId` (string), `title?`, `description?`, `status?` (enum), `dependsOn?` (string[]), `sessionId?` (string) |
150
+ | `task_start` | Start a task by spawning an agent session. Supports IPC pipe modes. | `taskId` (string), `personaId?` (string), `environmentId?` (string), `notes?` (string), `pipe?` (`sync` \| `async` \| `detach`) |
151
+ | `task_delete` | Permanently delete a task. | `taskId` (string) |
152
+ | `task_complete` | Mark a task as complete (sticky status). | `taskId` (string) |
153
+ | `task_resume` | Resume the latest session for a task. | `taskId` (string) |
154
+ | `task_import_github` | Import GitHub issues as tasks. | `workspaceId` (string), `repo` (string, `owner/repo`), `label?` (string), `state?` (`open` \| `closed`), `environmentId?` (string), `includeComments?` (boolean) |
155
+
156
+ ### Finding Tools
157
+
158
+ Post and query categorized discoveries shared across agents.
159
+
160
+ | Tool | Description | Parameters |
161
+ |------|-------------|------------|
162
+ | `finding_list` | Query findings for a workspace with optional filters. | `workspaceId` (string), `category?` (string), `tag?` (string), `limit?` (int) |
163
+ | `finding_post` | Post a new finding with title, category, content, and tags. | `workspaceId` (string), `title` (string), `category?` (string), `content?` (string), `tags?` (string[]) |
164
+
165
+ ### Persona Tools
166
+
167
+ Manage agent personas — reusable templates defining system prompt, runtime, and model.
168
+
169
+ | Tool | Description | Parameters |
170
+ |------|-------------|------------|
171
+ | `persona_list` | List all available personas. | *(none)* |
172
+ | `persona_create` | Create a new persona template (`agent` or `script` type). | `name` (string), `systemPrompt?` (string), `description?` (string), `runtime?` (string), `model?` (string), `maxTurns?` (int), `type?` (`agent` \| `script`), `script?` (string) |
173
+ | `persona_show` | Get full details of a persona. | `personaId` (string) |
174
+ | `persona_edit` | Update an existing persona. | `personaId` (string), `name?`, `systemPrompt?`, `description?`, `runtime?`, `model?`, `maxTurns?`, `type?`, `script?` |
175
+ | `persona_delete` | Delete a persona permanently. | `personaId` (string) |
176
+
177
+ ### Knowledge Graph Tools
178
+
179
+ Search and build a semantic knowledge graph across sessions, findings, and task context.
180
+
181
+ | Tool | Description | Parameters |
182
+ |------|-------------|------------|
183
+ | `knowledge_search` | Semantic search over the knowledge graph using natural language. | `query` (string), `limit?` (int, max 50), `workspaceId?` (string), `expand?` (boolean), `expandDepth?` (int, max 5) |
184
+ | `knowledge_get_node` | Retrieve a specific node by ID with optional neighbor expansion. | `id` (string), `expand?` (boolean), `expandDepth?` (int, max 5) |
185
+ | `knowledge_create_node` | Create a new knowledge entry (decision, insight, concept, snippet). | `title` (string), `content` (string), `category?` (string), `tags?` (string[]), `workspaceId?` (string), `edges?` (array of `{toId, type}`) |
186
+
187
+ ### IPC Tools
188
+
189
+ Inter-process communication between parent and child agent sessions.
190
+
191
+ | Tool | Description | Parameters |
192
+ |------|-------------|------------|
193
+ | `ipc_spawn` | Spawn a child agent session with an IPC pipe. | `prompt` (string), `pipe` (`sync` \| `async` \| `detach`), `environmentId` (string), `personaId?` (string), `maxTurns?` (int) |
194
+ | `ipc_write` | Write a message to a child session via a file descriptor. | `fd` (int), `message` (string) |
195
+ | `ipc_close` | Close a file descriptor, optionally hibernating the child. | `fd` (int) |
196
+ | `ipc_list_fds` | List your open file descriptors (IPC connections). | *(none)* |
197
+
198
+ ### Log Tools
199
+
200
+ Retrieve session logs — raw events, formatted transcripts, or live tails.
201
+
202
+ | Tool | Description | Parameters |
203
+ |------|-------------|------------|
204
+ | `logs_get` | Retrieve session logs in raw, transcript, or live-tail mode. | `sessionId` (string), `transcript?` (boolean), `tail?` (boolean), `timeoutSeconds?` (int, default 10, max 60), `maxEvents?` (int) |
205
+
206
+ ### Token Tools
207
+
208
+ Manage secrets that are auto-forwarded to environments.
209
+
210
+ | Tool | Description | Parameters |
211
+ |------|-------------|------------|
212
+ | `token_list` | List configured tokens (values are never returned). | *(none)* |
213
+ | `token_set` | Set a token for auto-forwarding to environments. | `name` (string), `value` (string), `type?` (`env_var` \| `file`), `envVar?` (string), `filePath?` (string) |
214
+ | `token_delete` | Delete a configured token. | `name` (string) |
215
+
216
+ ### Credential Provider Tools
217
+
218
+ Configure which credential providers (Claude, GitHub, Copilot, Codex) are auto-forwarded.
219
+
220
+ | Tool | Description | Parameters |
221
+ |------|-------------|------------|
222
+ | `credential_provider_list` | List current provider configuration. | *(none)* |
223
+ | `credential_provider_set` | Set a provider mode. | `provider` (`claude` \| `github` \| `copilot` \| `codex`), `value` (`off` \| `on` \| `subscription` \| `api_key`) |
224
+
225
+ ### Config Tools
226
+
227
+ Read and write global configuration settings.
228
+
229
+ | Tool | Description | Parameters |
230
+ |------|-------------|------------|
231
+ | `config_get_default_persona` | Get the default persona for new sessions. | *(none)* |
232
+ | `config_set_default_persona` | Set the default persona for new sessions. | `personaId` (string) |
233
+
234
+ ### Usage Tools
235
+
236
+ Query aggregated token usage and cost data.
237
+
238
+ | Tool | Description | Parameters |
239
+ |------|-------------|------------|
240
+ | `usage_get` | Get token usage and cost for a session, task, task tree, workspace, or environment. | `scope` (`session` \| `task` \| `task_tree` \| `workspace` \| `environment`), `id` (string) |
241
+
242
+ ---
243
+
244
+ ## Scoped Access
245
+
246
+ When an agent authenticates with a **scoped token** (issued automatically when a task session is started), only a subset of tools is available:
247
+
248
+ - `finding_post`, `finding_list`
249
+ - `task_create`, `task_list`, `task_show`, `task_start`, `task_complete`
250
+ - `session_send_input`
251
+ - `persona_list`, `persona_show`
252
+ - `ipc_spawn`, `ipc_write`, `ipc_close`, `ipc_list_fds`
253
+ - `knowledge_search`, `knowledge_get_node`
254
+
255
+ Scoped tokens also enforce workspace isolation — agents can only see tasks and findings within their own workspace. Subtasks created by a scoped agent are automatically parented to the agent's own task.
256
+
257
+ ## Requirements
258
+
259
+ - Node.js >= 22
260
+ - A running [Grackle](https://github.com/nick-pape/grackle) server (`@grackle-ai/cli`)
261
+
262
+ ## License
263
+
264
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grackle-ai/mcp",
3
- "version": "0.69.1",
3
+ "version": "0.70.1",
4
4
  "description": "MCP (Model Context Protocol) server for Grackle — translates MCP tool calls to ConnectRPC",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -33,7 +33,7 @@
33
33
  "@modelcontextprotocol/sdk": "^1.27.0",
34
34
  "pino": "^10.3.1",
35
35
  "zod": "^4.0.0",
36
- "@grackle-ai/common": "0.69.1"
36
+ "@grackle-ai/common": "0.70.1"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@rushstack/heft": "1.2.7",