@letta-ai/letta-code 0.32.10 → 0.32.12

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 (68) hide show
  1. package/dist/channels-slack.js +135 -54
  2. package/dist/channels-slack.js.map +3 -3
  3. package/dist/mcp-client.js +2 -2
  4. package/dist/mcp-client.js.map +1 -1
  5. package/dist/types/agent/client-skills.d.ts.map +1 -1
  6. package/dist/types/agent/memory-git-windows-credentials.d.ts +5 -0
  7. package/dist/types/agent/memory-git-windows-credentials.d.ts.map +1 -0
  8. package/dist/types/agent/memory-git.d.ts +2 -8
  9. package/dist/types/agent/memory-git.d.ts.map +1 -1
  10. package/dist/types/agent/message.d.ts.map +1 -1
  11. package/dist/types/agent/modify.d.ts.map +1 -1
  12. package/dist/types/agent/shared-memory-skills.d.ts.map +1 -1
  13. package/dist/types/agent/subagents/manager.d.ts.map +1 -1
  14. package/dist/types/agent/subagents/names.d.ts +1 -1
  15. package/dist/types/agent/subagents/names.d.ts.map +1 -1
  16. package/dist/types/agent/subagents/remote-turn-wait.d.ts +6 -0
  17. package/dist/types/agent/subagents/remote-turn-wait.d.ts.map +1 -0
  18. package/dist/types/agent/subagents/subagent-launcher.d.ts +1 -0
  19. package/dist/types/agent/subagents/subagent-launcher.d.ts.map +1 -1
  20. package/dist/types/agent/subagents/subagent-stream.d.ts +21 -0
  21. package/dist/types/agent/subagents/subagent-stream.d.ts.map +1 -1
  22. package/dist/types/backend/api/agents.d.ts +46 -0
  23. package/dist/types/backend/api/agents.d.ts.map +1 -0
  24. package/dist/types/backend/api/conversation-enqueue.d.ts +2 -0
  25. package/dist/types/backend/api/conversation-enqueue.d.ts.map +1 -1
  26. package/dist/types/backend/api/environments.d.ts +95 -0
  27. package/dist/types/backend/api/environments.d.ts.map +1 -0
  28. package/dist/types/backend/api/metadata.d.ts +12 -0
  29. package/dist/types/backend/api/metadata.d.ts.map +1 -1
  30. package/dist/types/backend/dev/pi-stream-adapter.d.ts.map +1 -1
  31. package/dist/types/channels/slack/status-controller.d.ts +2 -0
  32. package/dist/types/channels/slack/status-controller.d.ts.map +1 -1
  33. package/dist/types/cli/helpers/error-formatter.d.ts.map +1 -1
  34. package/dist/types/cli/helpers/stream-processor.d.ts +2 -0
  35. package/dist/types/cli/helpers/stream-processor.d.ts.map +1 -1
  36. package/dist/types/headless-enqueue-wait.d.ts +31 -0
  37. package/dist/types/headless-enqueue-wait.d.ts.map +1 -0
  38. package/dist/types/headless-environment-response.d.ts +119 -0
  39. package/dist/types/headless-environment-response.d.ts.map +1 -0
  40. package/dist/types/headless-listener-launch.d.ts +49 -0
  41. package/dist/types/headless-listener-launch.d.ts.map +1 -0
  42. package/dist/types/headless-super-run-wait.d.ts +17 -0
  43. package/dist/types/headless-super-run-wait.d.ts.map +1 -0
  44. package/dist/types/tools/client-tool-serialization.d.ts +5 -0
  45. package/dist/types/tools/client-tool-serialization.d.ts.map +1 -1
  46. package/dist/types/tools/impl/send-agent-message.d.ts.map +1 -1
  47. package/dist/types/tools/impl/shell-env.d.ts.map +1 -1
  48. package/dist/types/tools/manager.d.ts.map +1 -1
  49. package/dist/types/types/protocol.d.ts +3 -1
  50. package/dist/types/types/protocol.d.ts.map +1 -1
  51. package/dist/types/utils/checkout-readiness.d.ts +10 -0
  52. package/dist/types/utils/checkout-readiness.d.ts.map +1 -0
  53. package/dist/types/utils/cloud-api-shutdown.d.ts +17 -0
  54. package/dist/types/utils/cloud-api-shutdown.d.ts.map +1 -0
  55. package/dist/types/utils/file-lock.d.ts +16 -0
  56. package/dist/types/utils/file-lock.d.ts.map +1 -0
  57. package/dist/types/utils/repository-checkout.d.ts +3 -0
  58. package/dist/types/utils/repository-checkout.d.ts.map +1 -0
  59. package/dist/types/websocket/listener/constants.d.ts +1 -0
  60. package/dist/types/websocket/listener/constants.d.ts.map +1 -1
  61. package/letta.js +2 -2
  62. package/package.json +1 -1
  63. package/scripts/source-file-size-baseline.json +3 -3
  64. package/skills/self-configuration/SKILL.md +11 -1
  65. package/skills/converting-mcps-to-skills/SKILL.md +0 -202
  66. package/skills/converting-mcps-to-skills/references/skill-templates.md +0 -141
  67. package/skills/converting-mcps-to-skills/scripts/mcp-http.ts +0 -980
  68. package/skills/converting-mcps-to-skills/scripts/mcp-stdio.ts +0 -494
@@ -1,202 +0,0 @@
1
- ---
2
- name: converting-mcps-to-skills
3
- description: Connect to MCP (Model Context Protocol) servers and create skills for repeated use. Load when a user wants to use an MCP server, connect to external tools via MCP, or when they mention MCP, model context protocol, or specific MCP servers.
4
- ---
5
-
6
- # Converting MCP Servers to Skills
7
-
8
- Letta Code is not itself an MCP client, but as a general computer-use agent, you can easily connect to any MCP server using the scripts in this skill.
9
-
10
- ## What is MCP?
11
-
12
- MCP (Model Context Protocol) is a standard for exposing tools to AI agents. MCP servers provide tools via JSON-RPC, either over:
13
- - **HTTP** - Server running at a URL (e.g., `http://localhost:3001/mcp`)
14
- - **stdio** - Server runs as a subprocess, communicating via stdin/stdout
15
-
16
- ## Quick Start: Connecting to an MCP Server
17
-
18
- ### Step 1: Determine the transport type
19
-
20
- Ask the user:
21
- - Is it an HTTP server (has a URL)?
22
- - Is it a stdio server (runs via command like `npx`, `node`, `python`)?
23
-
24
- ### Step 2: Test the connection
25
-
26
- **For HTTP servers:**
27
- ```bash
28
- npx tsx <SKILL_DIR>/scripts/mcp-http.ts <url> list-tools
29
-
30
- # With auth header
31
- npx tsx <SKILL_DIR>/scripts/mcp-http.ts <url> --header "Authorization: Bearer KEY" list-tools
32
- ```
33
- Where `<SKILL_DIR>` is the Skill Directory shown when the skill was loaded (visible in the injection header).
34
-
35
- **For stdio servers:**
36
- ```bash
37
- npx tsx <SKILL_DIR>/scripts/mcp-stdio.ts "<command>" list-tools
38
-
39
- # Examples
40
- npx tsx <SKILL_DIR>/scripts/mcp-stdio.ts "npx -y @modelcontextprotocol/server-filesystem ." list-tools
41
- npx tsx <SKILL_DIR>/scripts/mcp-stdio.ts "python server.py" list-tools
42
- ```
43
-
44
- ### Step 3: Explore available tools
45
-
46
- ```bash
47
- # List all tools
48
- ... list-tools
49
-
50
- # Get schema for a specific tool
51
- ... info <tool-name>
52
-
53
- # Test calling a tool
54
- ... call <tool-name> '{"arg": "value"}'
55
- ```
56
-
57
- ## Creating a Dedicated Skill
58
-
59
- When an MCP server will be used repeatedly, create a dedicated skill for it. This makes future use easier and documents the server's capabilities.
60
-
61
- ### Decision: Simple vs Rich Skill
62
-
63
- **Simple skill** (just SKILL.md):
64
- - Good for straightforward servers
65
- - Documents how to use the parent skill's scripts with this specific server
66
- - No additional scripts needed
67
-
68
- **Rich skill** (SKILL.md + scripts/):
69
- - Good for frequently-used servers
70
- - Includes convenience wrapper scripts with defaults baked in
71
- - Provides a simpler interface than the generic scripts
72
-
73
- See `references/skill-templates.md` for templates.
74
-
75
- ## Built-in Scripts Reference
76
-
77
- ### mcp-http.ts - HTTP Transport
78
-
79
- Connects to MCP servers over HTTP. No dependencies required.
80
-
81
- ```bash
82
- npx tsx mcp-http.ts <url> [options] <command> [args]
83
-
84
- Commands:
85
- list-tools List available tools
86
- list-resources List available resources
87
- info <tool> Show tool schema
88
- call <tool> '<json>' Call a tool
89
- login Run OAuth flow and cache tokens for this server
90
- logout Clear cached OAuth tokens for this server
91
-
92
- Options:
93
- --header "K: V" Add HTTP header (repeatable). Disables auto-OAuth.
94
- --auth <mode> "auto" (default), "oauth", or "none"
95
- --timeout <ms> Request timeout (default: 30000)
96
- ```
97
-
98
- **Examples:**
99
- ```bash
100
- # Basic usage
101
- npx tsx mcp-http.ts http://localhost:3001/mcp list-tools
102
-
103
- # With static bearer authentication
104
- npx tsx mcp-http.ts http://localhost:3001/mcp --header "Authorization: Bearer KEY" list-tools
105
-
106
- # OAuth-protected server (opens a browser to sign in, then caches tokens)
107
- npx tsx mcp-http.ts https://example.com/mcp login
108
- npx tsx mcp-http.ts https://example.com/mcp list-tools
109
-
110
- # Call a tool
111
- npx tsx mcp-http.ts http://localhost:3001/mcp call vault '{"action":"search","query":"notes"}'
112
- ```
113
-
114
- **OAuth support:**
115
- When a server returns `401 WWW-Authenticate: Bearer ...` and no static
116
- `Authorization` header was supplied, `mcp-http.ts` will automatically:
117
-
118
- 1. Discover the authorization server via `resource_metadata`, the
119
- `realm=` param, or the server's own origin (`.well-known/oauth-authorization-server`
120
- then `.well-known/openid-configuration`).
121
- 2. Dynamically register a public client with PKCE (`token_endpoint_auth_method: none`).
122
- 3. Open the system browser to the authorization endpoint, catch the redirect
123
- on a `127.0.0.1` loopback port, and exchange the code for tokens.
124
- 4. Cache the token set (and the registered client) at
125
- `~/.letta/mcp-oauth/<host>_<path>.json` with `0600` perms.
126
- 5. Auto-refresh expired access tokens using the stored refresh token before
127
- each request; if refresh fails, it re-runs the browser flow once.
128
-
129
- Use `login` to run the flow explicitly (e.g. as a first step in a skill's
130
- setup) and `logout` to clear cached tokens. Passing an explicit
131
- `--header "Authorization: ..."` disables auto-OAuth so you stay in control.
132
- Pass `--auth none` to force static-only behavior.
133
-
134
- ### mcp-stdio.ts - stdio Transport
135
-
136
- Connects to MCP servers that run as subprocesses. No dependencies required.
137
-
138
- ```bash
139
- npx tsx mcp-stdio.ts "<command>" [options] <action> [args]
140
-
141
- Actions:
142
- list-tools List available tools
143
- list-resources List available resources
144
- info <tool> Show tool schema
145
- call <tool> '<json>' Call a tool
146
-
147
- Options:
148
- --env "KEY=VALUE" Set environment variable (repeatable)
149
- --cwd <path> Set working directory
150
- --timeout <ms> Request timeout (default: 30000)
151
- ```
152
-
153
- **Examples:**
154
- ```bash
155
- # Filesystem server
156
- npx tsx mcp-stdio.ts "npx -y @modelcontextprotocol/server-filesystem ." list-tools
157
-
158
- # With environment variable
159
- npx tsx mcp-stdio.ts "node server.js" --env "API_KEY=xxx" list-tools
160
-
161
- # Call a tool
162
- npx tsx mcp-stdio.ts "python server.py" call read_file '{"path":"./README.md"}'
163
- ```
164
-
165
- ## Common MCP Servers
166
-
167
- Here are some well-known MCP servers:
168
-
169
- | Server | Transport | Command/URL |
170
- |--------|-----------|-------------|
171
- | Filesystem | stdio | `npx -y @modelcontextprotocol/server-filesystem <path>` |
172
- | GitHub | stdio | `npx -y @modelcontextprotocol/server-github` |
173
- | Brave Search | stdio | `npx -y @modelcontextprotocol/server-brave-search` |
174
- | obsidian-mcp-plugin | HTTP | `http://localhost:3001/mcp` |
175
-
176
- ## Troubleshooting
177
-
178
- **"Cannot connect" error:**
179
- - For HTTP: Check the URL is correct and server is running
180
- - For stdio: Check the command works when run directly in terminal
181
-
182
- **"Authentication required" error:**
183
- - Add `--header "Authorization: Bearer YOUR_KEY"` for HTTP servers using static bearers
184
- - Or `--env "API_KEY=xxx"` for stdio servers that need env vars
185
- - For OAuth-protected HTTP servers, just run any command (or `login`) — the helper
186
- will do PKCE + dynamic client registration and cache tokens under
187
- `~/.letta/mcp-oauth/`. Delete that file (or run `logout`) to force a re-login.
188
-
189
- **OAuth issues:**
190
- - "Could not discover OAuth server metadata": the server didn't include
191
- `resource_metadata` and its origin doesn't serve `.well-known/oauth-authorization-server`
192
- or `.well-known/openid-configuration`. Fall back to a static bearer, or point the
193
- helper at the auth server manually via a custom skill.
194
- - "Dynamic client registration failed": the auth server disables open DCR.
195
- You'll need to pre-register a client and pass its `client_id` (and any required
196
- credentials) via headers, or wrap this skill with a server-specific one.
197
- - "state mismatch" / callback timeout: another process may be holding the browser
198
- callback; re-run and complete the sign-in in the newly opened tab.
199
-
200
- **Tool call fails:**
201
- - Use `info <tool>` to see the expected input schema
202
- - Ensure JSON arguments match the schema
@@ -1,141 +0,0 @@
1
- # Skill Templates for MCP Servers
2
-
3
- When to create a dedicated skill:
4
- - **One-off use**: No skill needed - just use `converting-mcps-to-skills` scripts directly
5
- - **Repeated use**: Create a self-contained skill with customized scripts
6
-
7
- Skills should be self-contained per the [Agent Skills spec](https://agentskills.io/specification).
8
-
9
- ## Naming Rules (from Agent Skills spec)
10
-
11
- The `name` field must:
12
- - Be lowercase letters, numbers, and hyphens only (`a-z`, `0-9`, `-`)
13
- - Be 1-64 characters
14
- - Not start or end with a hyphen
15
- - Not contain consecutive hyphens (`--`)
16
- - Match the parent directory name exactly
17
-
18
- Examples: `using-github-mcp`, `mcp-filesystem`, `slack-mcp`
19
-
20
- ## Skill Template
21
-
22
- Use this template when creating a self-contained skill for an MCP server.
23
-
24
- ### Directory Structure
25
-
26
- ```
27
- using-<server-name>/
28
- ├── SKILL.md
29
- └── scripts/
30
- └── <server>.ts # Customized client (copied from converting-mcps-to-skills)
31
- ```
32
-
33
- ### SKILL.md Template
34
-
35
- ```markdown
36
- ---
37
- name: using-<server-name>
38
- description: <What the server does>. Use when <trigger conditions>.
39
- # Optional fields:
40
- # license: MIT
41
- # compatibility: Requires network access to <service>
42
- ---
43
-
44
- # Using <Server Name>
45
-
46
- <Brief description>
47
-
48
- ## Prerequisites
49
-
50
- - <Requirements>
51
-
52
- ## Quick Start
53
-
54
- ```bash
55
- # Set API key (if needed)
56
- export <SERVER>_API_KEY="your-key"
57
-
58
- # List tools
59
- npx tsx <skill-path>/scripts/<server>.ts list-tools
60
-
61
- # Call a tool
62
- npx tsx <skill-path>/scripts/<server>.ts call <tool> '{"arg":"value"}'
63
- ```
64
-
65
- ## Available Tools
66
-
67
- <Document tools with examples>
68
-
69
- ## Environment Variables
70
-
71
- - `<SERVER>_API_KEY` - API key for authentication
72
- - `<SERVER>_URL` - Override server URL (default: <default-url>)
73
- ```
74
-
75
- ### Script Template (scripts/<server>.ts)
76
-
77
- Copy the HTTP client from `converting-mcps-to-skills/scripts/mcp-http.ts` (or `mcp-stdio.ts` for stdio servers) and customize:
78
-
79
- 1. Set `DEFAULT_URL` to this server's URL
80
- 2. Rename the API key env var (e.g., `GITHUB_MCP_KEY` instead of generic)
81
- 3. Optionally simplify the CLI for common operations
82
-
83
- The copied code is self-contained - no external dependencies for HTTP transport.
84
-
85
- ```typescript
86
- #!/usr/bin/env npx tsx
87
- /**
88
- * <Server Name> CLI - Self-contained MCP client
89
- */
90
-
91
- // Customize these for your server
92
- const DEFAULT_URL = "<server-url>";
93
- const API_KEY = process.env.<SERVER>_API_KEY;
94
-
95
- // Copy the rest of mcp-http.ts here and adjust as needed
96
- // ...
97
- ```
98
-
99
- ## Example: Self-Contained Filesystem Skill
100
-
101
- A complete example of a self-contained skill for the MCP filesystem server:
102
-
103
- ```
104
- using-mcp-filesystem/
105
- ├── SKILL.md
106
- └── scripts/
107
- └── filesystem.ts # Copied and customized from mcp-stdio.ts
108
- ```
109
-
110
- **SKILL.md:**
111
- ```markdown
112
- ---
113
- name: using-mcp-filesystem
114
- description: Access local filesystem via MCP. Use when user wants to read, write, or search files via MCP protocol.
115
- ---
116
-
117
- # Using MCP Filesystem Server
118
-
119
- Access local files via the official MCP filesystem server.
120
-
121
- ## Quick Start
122
-
123
- ```bash
124
- npx tsx <skill-path>/scripts/filesystem.ts list-tools
125
- npx tsx <skill-path>/scripts/filesystem.ts call read_file '{"path":"./README.md"}'
126
- ```
127
-
128
- ## Available Tools
129
-
130
- - `read_file` - Read file contents
131
- - `write_file` - Write content to file
132
- - `list_directory` - List directory contents
133
- - `search_files` - Search for files by pattern
134
- - `get_file_info` - Get file metadata
135
- ```
136
-
137
- **scripts/filesystem.ts:**
138
- Copy `converting-mcps-to-skills/scripts/mcp-stdio.ts` and set the default command to:
139
- ```typescript
140
- const DEFAULT_COMMAND = "npx -y @modelcontextprotocol/server-filesystem .";
141
- ```