@jaypie/mcp 0.2.12 → 0.3.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.
@@ -0,0 +1,249 @@
1
+ ---
2
+ description: MCP server package with documentation, AWS, Datadog, and LLM tools
3
+ include: "packages/mcp/**"
4
+ ---
5
+
6
+ # @jaypie/mcp Package
7
+
8
+ The `@jaypie/mcp` package provides a Model Context Protocol (MCP) server for AI agents working with Jaypie projects. It includes tools for accessing documentation, AWS CLI operations, Datadog observability, and LLM debugging.
9
+
10
+ ## Package Structure
11
+
12
+ ```
13
+ packages/mcp/
14
+ ├── src/
15
+ │ ├── index.ts # CLI entrypoint, exports createMcpServer and mcpExpressHandler
16
+ │ ├── createMcpServer.ts # Core MCP server factory with tool definitions
17
+ │ ├── mcpExpressHandler.ts # Express middleware for HTTP transport
18
+ │ ├── aws.ts # AWS CLI integration (spawn-based)
19
+ │ ├── datadog.ts # Datadog API integration (https-based)
20
+ │ └── llm.ts # LLM debug utilities
21
+ ├── prompts/ # Markdown guides served via list_prompts/read_prompt tools
22
+ └── dist/ # Built output
23
+ ```
24
+
25
+ ## Usage
26
+
27
+ ### CLI (stdio transport)
28
+
29
+ ```bash
30
+ npx jaypie-mcp # Run MCP server via stdio
31
+ npx jaypie-mcp --verbose # Run with debug logging
32
+ ```
33
+
34
+ ### Express Integration (HTTP transport)
35
+
36
+ ```typescript
37
+ import express from "express";
38
+ import { mcpExpressHandler } from "@jaypie/mcp";
39
+
40
+ const app = express();
41
+ app.use(express.json());
42
+ app.use("/mcp", await mcpExpressHandler({ version: "1.0.0" }));
43
+ ```
44
+
45
+ ### Direct Server Creation
46
+
47
+ ```typescript
48
+ import { createMcpServer } from "@jaypie/mcp";
49
+
50
+ const server = createMcpServer({ version: "1.0.0", verbose: true });
51
+ ```
52
+
53
+ ## MCP Tools (27 total)
54
+
55
+ ### Documentation Tools (3)
56
+
57
+ | Tool | Description |
58
+ |------|-------------|
59
+ | `list_prompts` | Lists all `.md` files in `prompts/` with descriptions and required file patterns |
60
+ | `read_prompt` | Returns content of a specific prompt file |
61
+ | `version` | Returns package version string |
62
+
63
+ ### AWS CLI Tools (16)
64
+
65
+ Requires AWS CLI installed and configured. All tools accept optional `profile` and `region` parameters.
66
+
67
+ | Tool | Description |
68
+ |------|-------------|
69
+ | `aws_list_profiles` | List available AWS profiles from ~/.aws/config and credentials |
70
+ | `aws_stepfunctions_list_executions` | List Step Function executions for a state machine |
71
+ | `aws_stepfunctions_stop_execution` | Stop a running Step Function execution |
72
+ | `aws_lambda_list_functions` | List Lambda functions with optional prefix filtering |
73
+ | `aws_lambda_get_function` | Get configuration and details for a specific Lambda function |
74
+ | `aws_logs_filter_log_events` | Search CloudWatch Logs with pattern and time range filtering |
75
+ | `aws_s3_list_objects` | List objects in an S3 bucket with optional prefix filtering |
76
+ | `aws_cloudformation_describe_stack` | Get details and status of a CloudFormation stack |
77
+ | `aws_dynamodb_describe_table` | Get metadata about a DynamoDB table |
78
+ | `aws_dynamodb_scan` | Scan a DynamoDB table (use sparingly on large tables) |
79
+ | `aws_dynamodb_query` | Query a DynamoDB table by partition key |
80
+ | `aws_dynamodb_get_item` | Get a single item from a DynamoDB table by primary key |
81
+ | `aws_sqs_list_queues` | List SQS queues with optional prefix filtering |
82
+ | `aws_sqs_get_queue_attributes` | Get queue attributes including message counts |
83
+ | `aws_sqs_receive_message` | Peek at messages in an SQS queue (does not delete) |
84
+ | `aws_sqs_purge_queue` | Delete all messages from an SQS queue (irreversible) |
85
+
86
+ ### Datadog Tools (6)
87
+
88
+ Requires `DATADOG_API_KEY` and `DATADOG_APP_KEY` environment variables.
89
+
90
+ | Tool | Description |
91
+ |------|-------------|
92
+ | `datadog_logs` | Search individual log entries |
93
+ | `datadog_log_analytics` | Aggregate logs with groupBy operations |
94
+ | `datadog_monitors` | List and filter monitors by status/tags |
95
+ | `datadog_synthetics` | List synthetic tests or get results for a specific test |
96
+ | `datadog_metrics` | Query timeseries metrics |
97
+ | `datadog_rum` | Search Real User Monitoring events |
98
+
99
+ ### LLM Tools (2)
100
+
101
+ | Tool | Description |
102
+ |------|-------------|
103
+ | `llm_debug_call` | Debug LLM API calls and inspect raw responses |
104
+ | `llm_list_providers` | List available LLM providers with their models |
105
+
106
+ ## Environment Variables
107
+
108
+ ### AWS CLI Integration
109
+
110
+ | Variable | Description |
111
+ |----------|-------------|
112
+ | `AWS_PROFILE` | Default profile if not specified per-call |
113
+ | `AWS_REGION` or `AWS_DEFAULT_REGION` | Default region if not specified |
114
+
115
+ AWS tools use the host's existing credential chain:
116
+ - `~/.aws/credentials` and `~/.aws/config` files
117
+ - Environment variables (`AWS_ACCESS_KEY_ID`, etc.)
118
+ - SSO sessions established via `aws sso login`
119
+
120
+ ### Datadog Integration
121
+
122
+ | Variable | Description |
123
+ |----------|-------------|
124
+ | `DATADOG_API_KEY` or `DD_API_KEY` | Datadog API key |
125
+ | `DATADOG_APP_KEY` or `DD_APP_KEY` | Datadog Application key |
126
+ | `DD_ENV` | Default environment filter |
127
+ | `DD_SERVICE` | Default service filter |
128
+ | `DD_SOURCE` | Default log source (defaults to "lambda") |
129
+ | `DD_QUERY` | Default query terms appended to searches |
130
+
131
+ ## Adding New Tools
132
+
133
+ Tools are registered in `createMcpServer.ts` using the MCP SDK pattern:
134
+
135
+ ```typescript
136
+ server.tool(
137
+ "tool_name",
138
+ "Description shown to AI agents",
139
+ {
140
+ // Zod schema for parameters
141
+ param1: z.string().describe("Parameter description"),
142
+ param2: z.number().optional().describe("Optional parameter"),
143
+ },
144
+ async ({ param1, param2 }) => {
145
+ // Implementation
146
+ return {
147
+ content: [{ type: "text" as const, text: "Result text" }],
148
+ };
149
+ },
150
+ );
151
+ ```
152
+
153
+ ### AWS Tool Pattern
154
+
155
+ AWS tools use `child_process.spawn` to call the AWS CLI:
156
+
157
+ ```typescript
158
+ // In aws.ts
159
+ export async function myAwsOperation(
160
+ options: MyOperationOptions,
161
+ logger: Logger = nullLogger,
162
+ ): Promise<AwsCommandResult<MyResultType>> {
163
+ const args = ["--required-arg", options.requiredArg];
164
+ if (options.optionalArg) {
165
+ args.push("--optional-arg", options.optionalArg);
166
+ }
167
+
168
+ return executeAwsCommand(
169
+ "service-name", // e.g., "stepfunctions", "lambda", "s3api"
170
+ "command-name", // e.g., "list-executions", "get-function"
171
+ args,
172
+ { profile: options.profile, region: options.region },
173
+ logger,
174
+ );
175
+ }
176
+ ```
177
+
178
+ ### Datadog Tool Pattern
179
+
180
+ Datadog tools use Node.js `https` module directly:
181
+
182
+ ```typescript
183
+ // In datadog.ts
184
+ export async function myDatadogOperation(
185
+ credentials: DatadogCredentials,
186
+ options: MyOptions,
187
+ logger: Logger = nullLogger,
188
+ ): Promise<MyResult> {
189
+ const requestOptions = {
190
+ hostname: "api.datadoghq.com",
191
+ port: 443,
192
+ path: "/api/v2/endpoint",
193
+ method: "POST",
194
+ headers: {
195
+ "DD-API-KEY": credentials.apiKey,
196
+ "DD-APPLICATION-KEY": credentials.appKey,
197
+ "Content-Type": "application/json",
198
+ },
199
+ };
200
+
201
+ return new Promise((resolve) => {
202
+ const req = https.request(requestOptions, (res) => {
203
+ // Handle response
204
+ });
205
+ req.write(JSON.stringify(body));
206
+ req.end();
207
+ });
208
+ }
209
+ ```
210
+
211
+ ## Adding New Prompts
212
+
213
+ Prompts are markdown files in `prompts/` with optional YAML frontmatter:
214
+
215
+ ```yaml
216
+ ---
217
+ description: Brief description shown in list_prompts
218
+ include: "packages/express/**" # File patterns this guide applies to
219
+ ---
220
+
221
+ # Prompt Title
222
+
223
+ Markdown content here...
224
+ ```
225
+
226
+ Prompts are automatically available via `list_prompts` and `read_prompt` tools.
227
+
228
+ ## Exports
229
+
230
+ ```typescript
231
+ import { createMcpServer, mcpExpressHandler } from "@jaypie/mcp";
232
+ import type { CreateMcpServerOptions, McpExpressHandlerOptions } from "@jaypie/mcp";
233
+ ```
234
+
235
+ ## Commands
236
+
237
+ ```bash
238
+ npm run build -w packages/mcp # Build with rollup
239
+ npm run test -w packages/mcp # Run tests (vitest run)
240
+ npm run typecheck -w packages/mcp # Type check (tsc --noEmit)
241
+ npm run format packages/mcp # Format with eslint --fix
242
+ ```
243
+
244
+ ## Security Considerations
245
+
246
+ 1. **Allowlisted operations only** - No arbitrary command execution
247
+ 2. **Read-heavy design** - Most tools are read-only; mutating operations have explicit warnings
248
+ 3. **No credential exposure** - Credentials never passed through MCP; uses host's credential chain
249
+ 4. **Profile isolation** - Each call can specify a different profile for multi-account work