aidevops 2.52.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.
- package/.agent/AGENTS.md +614 -0
- package/.agent/accounts.md +65 -0
- package/.agent/aidevops/add-new-mcp-to-aidevops.md +456 -0
- package/.agent/aidevops/api-integrations.md +335 -0
- package/.agent/aidevops/architecture.md +510 -0
- package/.agent/aidevops/configs.md +274 -0
- package/.agent/aidevops/docs.md +244 -0
- package/.agent/aidevops/extension.md +311 -0
- package/.agent/aidevops/mcp-integrations.md +340 -0
- package/.agent/aidevops/mcp-troubleshooting.md +162 -0
- package/.agent/aidevops/memory-patterns.md +172 -0
- package/.agent/aidevops/providers.md +217 -0
- package/.agent/aidevops/recommendations.md +321 -0
- package/.agent/aidevops/requirements.md +301 -0
- package/.agent/aidevops/resources.md +214 -0
- package/.agent/aidevops/security-requirements.md +174 -0
- package/.agent/aidevops/security.md +350 -0
- package/.agent/aidevops/service-links.md +400 -0
- package/.agent/aidevops/services.md +357 -0
- package/.agent/aidevops/setup.md +153 -0
- package/.agent/aidevops/troubleshooting.md +389 -0
- package/.agent/aidevops.md +124 -0
- package/.agent/build-plus.md +244 -0
- package/.agent/content/guidelines.md +109 -0
- package/.agent/content.md +87 -0
- package/.agent/health.md +59 -0
- package/.agent/legal.md +59 -0
- package/.agent/loop-state/full-loop.local.md +16 -0
- package/.agent/loop-state/ralph-loop.local.md +10 -0
- package/.agent/marketing.md +440 -0
- package/.agent/memory/README.md +260 -0
- package/.agent/onboarding.md +796 -0
- package/.agent/plan-plus.md +245 -0
- package/.agent/research.md +100 -0
- package/.agent/sales.md +333 -0
- package/.agent/scripts/101domains-helper.sh +701 -0
- package/.agent/scripts/add-missing-returns.sh +140 -0
- package/.agent/scripts/agent-browser-helper.sh +311 -0
- package/.agent/scripts/agno-setup.sh +712 -0
- package/.agent/scripts/ahrefs-mcp-wrapper.js +168 -0
- package/.agent/scripts/aidevops-update-check.sh +71 -0
- package/.agent/scripts/ampcode-cli.sh +522 -0
- package/.agent/scripts/auto-version-bump.sh +156 -0
- package/.agent/scripts/autogen-helper.sh +512 -0
- package/.agent/scripts/beads-sync-helper.sh +596 -0
- package/.agent/scripts/closte-helper.sh +5 -0
- package/.agent/scripts/cloudron-helper.sh +321 -0
- package/.agent/scripts/codacy-cli-chunked.sh +581 -0
- package/.agent/scripts/codacy-cli.sh +442 -0
- package/.agent/scripts/code-audit-helper.sh +5 -0
- package/.agent/scripts/coderabbit-cli.sh +417 -0
- package/.agent/scripts/coderabbit-pro-analysis.sh +238 -0
- package/.agent/scripts/commands/code-simplifier.md +86 -0
- package/.agent/scripts/commands/full-loop.md +246 -0
- package/.agent/scripts/commands/postflight-loop.md +103 -0
- package/.agent/scripts/commands/recall.md +182 -0
- package/.agent/scripts/commands/remember.md +132 -0
- package/.agent/scripts/commands/save-todo.md +175 -0
- package/.agent/scripts/commands/session-review.md +154 -0
- package/.agent/scripts/comprehensive-quality-fix.sh +106 -0
- package/.agent/scripts/context-builder-helper.sh +522 -0
- package/.agent/scripts/coolify-cli-helper.sh +674 -0
- package/.agent/scripts/coolify-helper.sh +380 -0
- package/.agent/scripts/crawl4ai-examples.sh +401 -0
- package/.agent/scripts/crawl4ai-helper.sh +1078 -0
- package/.agent/scripts/crewai-helper.sh +681 -0
- package/.agent/scripts/dev-browser-helper.sh +513 -0
- package/.agent/scripts/dns-helper.sh +396 -0
- package/.agent/scripts/domain-research-helper.sh +917 -0
- package/.agent/scripts/dspy-helper.sh +285 -0
- package/.agent/scripts/dspyground-helper.sh +291 -0
- package/.agent/scripts/eeat-score-helper.sh +1242 -0
- package/.agent/scripts/efficient-return-fix.sh +92 -0
- package/.agent/scripts/extract-opencode-prompts.sh +128 -0
- package/.agent/scripts/find-missing-returns.sh +113 -0
- package/.agent/scripts/fix-auth-headers.sh +104 -0
- package/.agent/scripts/fix-common-strings.sh +254 -0
- package/.agent/scripts/fix-content-type.sh +100 -0
- package/.agent/scripts/fix-error-messages.sh +130 -0
- package/.agent/scripts/fix-misplaced-returns.sh +74 -0
- package/.agent/scripts/fix-remaining-literals.sh +152 -0
- package/.agent/scripts/fix-return-statements.sh +41 -0
- package/.agent/scripts/fix-s131-default-cases.sh +249 -0
- package/.agent/scripts/fix-sc2155-simple.sh +102 -0
- package/.agent/scripts/fix-shellcheck-critical.sh +187 -0
- package/.agent/scripts/fix-string-literals.sh +273 -0
- package/.agent/scripts/full-loop-helper.sh +773 -0
- package/.agent/scripts/generate-opencode-agents.sh +497 -0
- package/.agent/scripts/generate-opencode-commands.sh +1629 -0
- package/.agent/scripts/generate-skills.sh +366 -0
- package/.agent/scripts/git-platforms-helper.sh +640 -0
- package/.agent/scripts/gitea-cli-helper.sh +743 -0
- package/.agent/scripts/github-cli-helper.sh +702 -0
- package/.agent/scripts/gitlab-cli-helper.sh +682 -0
- package/.agent/scripts/gsc-add-user-helper.sh +325 -0
- package/.agent/scripts/gsc-sitemap-helper.sh +678 -0
- package/.agent/scripts/hetzner-helper.sh +485 -0
- package/.agent/scripts/hostinger-helper.sh +229 -0
- package/.agent/scripts/keyword-research-helper.sh +1815 -0
- package/.agent/scripts/langflow-helper.sh +544 -0
- package/.agent/scripts/linkedin-automation.py +241 -0
- package/.agent/scripts/linter-manager.sh +599 -0
- package/.agent/scripts/linters-local.sh +434 -0
- package/.agent/scripts/list-keys-helper.sh +488 -0
- package/.agent/scripts/local-browser-automation.py +339 -0
- package/.agent/scripts/localhost-helper.sh +744 -0
- package/.agent/scripts/loop-common.sh +806 -0
- package/.agent/scripts/mainwp-helper.sh +728 -0
- package/.agent/scripts/markdown-formatter.sh +338 -0
- package/.agent/scripts/markdown-lint-fix.sh +311 -0
- package/.agent/scripts/mass-fix-returns.sh +58 -0
- package/.agent/scripts/mcp-diagnose.sh +167 -0
- package/.agent/scripts/mcp-inspector-helper.sh +449 -0
- package/.agent/scripts/memory-helper.sh +650 -0
- package/.agent/scripts/monitor-code-review.sh +255 -0
- package/.agent/scripts/onboarding-helper.sh +706 -0
- package/.agent/scripts/opencode-github-setup-helper.sh +797 -0
- package/.agent/scripts/opencode-test-helper.sh +213 -0
- package/.agent/scripts/pagespeed-helper.sh +464 -0
- package/.agent/scripts/pandoc-helper.sh +362 -0
- package/.agent/scripts/postflight-check.sh +555 -0
- package/.agent/scripts/pre-commit-hook.sh +259 -0
- package/.agent/scripts/pre-edit-check.sh +169 -0
- package/.agent/scripts/qlty-cli.sh +356 -0
- package/.agent/scripts/quality-cli-manager.sh +525 -0
- package/.agent/scripts/quality-feedback-helper.sh +462 -0
- package/.agent/scripts/quality-fix.sh +263 -0
- package/.agent/scripts/quality-loop-helper.sh +1108 -0
- package/.agent/scripts/ralph-loop-helper.sh +836 -0
- package/.agent/scripts/ralph-upstream-check.sh +341 -0
- package/.agent/scripts/secretlint-helper.sh +847 -0
- package/.agent/scripts/servers-helper.sh +241 -0
- package/.agent/scripts/ses-helper.sh +619 -0
- package/.agent/scripts/session-review-helper.sh +404 -0
- package/.agent/scripts/setup-linters-wizard.sh +379 -0
- package/.agent/scripts/setup-local-api-keys.sh +330 -0
- package/.agent/scripts/setup-mcp-integrations.sh +472 -0
- package/.agent/scripts/shared-constants.sh +246 -0
- package/.agent/scripts/site-crawler-helper.sh +1487 -0
- package/.agent/scripts/snyk-helper.sh +940 -0
- package/.agent/scripts/sonarcloud-autofix.sh +193 -0
- package/.agent/scripts/sonarcloud-cli.sh +191 -0
- package/.agent/scripts/sonarscanner-cli.sh +455 -0
- package/.agent/scripts/spaceship-helper.sh +747 -0
- package/.agent/scripts/stagehand-helper.sh +321 -0
- package/.agent/scripts/stagehand-python-helper.sh +321 -0
- package/.agent/scripts/stagehand-python-setup.sh +441 -0
- package/.agent/scripts/stagehand-setup.sh +439 -0
- package/.agent/scripts/system-cleanup.sh +340 -0
- package/.agent/scripts/terminal-title-helper.sh +388 -0
- package/.agent/scripts/terminal-title-setup.sh +549 -0
- package/.agent/scripts/test-stagehand-both-integration.sh +317 -0
- package/.agent/scripts/test-stagehand-integration.sh +309 -0
- package/.agent/scripts/test-stagehand-python-integration.sh +341 -0
- package/.agent/scripts/todo-ready.sh +263 -0
- package/.agent/scripts/tool-version-check.sh +362 -0
- package/.agent/scripts/toon-helper.sh +469 -0
- package/.agent/scripts/twilio-helper.sh +917 -0
- package/.agent/scripts/updown-helper.sh +279 -0
- package/.agent/scripts/validate-mcp-integrations.sh +250 -0
- package/.agent/scripts/validate-version-consistency.sh +131 -0
- package/.agent/scripts/vaultwarden-helper.sh +597 -0
- package/.agent/scripts/vercel-cli-helper.sh +816 -0
- package/.agent/scripts/verify-mirrors.sh +169 -0
- package/.agent/scripts/version-manager.sh +831 -0
- package/.agent/scripts/webhosting-helper.sh +471 -0
- package/.agent/scripts/webhosting-verify.sh +238 -0
- package/.agent/scripts/wordpress-mcp-helper.sh +508 -0
- package/.agent/scripts/worktree-helper.sh +595 -0
- package/.agent/scripts/worktree-sessions.sh +577 -0
- package/.agent/seo/dataforseo.md +215 -0
- package/.agent/seo/domain-research.md +532 -0
- package/.agent/seo/eeat-score.md +659 -0
- package/.agent/seo/google-search-console.md +366 -0
- package/.agent/seo/gsc-sitemaps.md +282 -0
- package/.agent/seo/keyword-research.md +521 -0
- package/.agent/seo/serper.md +278 -0
- package/.agent/seo/site-crawler.md +387 -0
- package/.agent/seo.md +236 -0
- package/.agent/services/accounting/quickfile.md +159 -0
- package/.agent/services/communications/telfon.md +470 -0
- package/.agent/services/communications/twilio.md +569 -0
- package/.agent/services/crm/fluentcrm.md +449 -0
- package/.agent/services/email/ses.md +399 -0
- package/.agent/services/hosting/101domains.md +378 -0
- package/.agent/services/hosting/closte.md +177 -0
- package/.agent/services/hosting/cloudflare.md +251 -0
- package/.agent/services/hosting/cloudron.md +478 -0
- package/.agent/services/hosting/dns-providers.md +335 -0
- package/.agent/services/hosting/domain-purchasing.md +344 -0
- package/.agent/services/hosting/hetzner.md +327 -0
- package/.agent/services/hosting/hostinger.md +287 -0
- package/.agent/services/hosting/localhost.md +419 -0
- package/.agent/services/hosting/spaceship.md +353 -0
- package/.agent/services/hosting/webhosting.md +330 -0
- package/.agent/social-media.md +69 -0
- package/.agent/templates/plans-template.md +114 -0
- package/.agent/templates/prd-template.md +129 -0
- package/.agent/templates/tasks-template.md +108 -0
- package/.agent/templates/todo-template.md +89 -0
- package/.agent/tools/ai-assistants/agno.md +471 -0
- package/.agent/tools/ai-assistants/capsolver.md +326 -0
- package/.agent/tools/ai-assistants/configuration.md +221 -0
- package/.agent/tools/ai-assistants/overview.md +209 -0
- package/.agent/tools/ai-assistants/status.md +171 -0
- package/.agent/tools/ai-assistants/windsurf.md +193 -0
- package/.agent/tools/ai-orchestration/autogen.md +406 -0
- package/.agent/tools/ai-orchestration/crewai.md +445 -0
- package/.agent/tools/ai-orchestration/langflow.md +405 -0
- package/.agent/tools/ai-orchestration/openprose.md +487 -0
- package/.agent/tools/ai-orchestration/overview.md +362 -0
- package/.agent/tools/ai-orchestration/packaging.md +647 -0
- package/.agent/tools/browser/agent-browser.md +464 -0
- package/.agent/tools/browser/browser-automation.md +400 -0
- package/.agent/tools/browser/chrome-devtools.md +282 -0
- package/.agent/tools/browser/crawl4ai-integration.md +422 -0
- package/.agent/tools/browser/crawl4ai-resources.md +277 -0
- package/.agent/tools/browser/crawl4ai-usage.md +416 -0
- package/.agent/tools/browser/crawl4ai.md +585 -0
- package/.agent/tools/browser/dev-browser.md +341 -0
- package/.agent/tools/browser/pagespeed.md +260 -0
- package/.agent/tools/browser/playwright.md +266 -0
- package/.agent/tools/browser/playwriter.md +310 -0
- package/.agent/tools/browser/stagehand-examples.md +456 -0
- package/.agent/tools/browser/stagehand-python.md +483 -0
- package/.agent/tools/browser/stagehand.md +421 -0
- package/.agent/tools/build-agent/agent-review.md +224 -0
- package/.agent/tools/build-agent/build-agent.md +784 -0
- package/.agent/tools/build-mcp/aidevops-plugin.md +476 -0
- package/.agent/tools/build-mcp/api-wrapper.md +445 -0
- package/.agent/tools/build-mcp/build-mcp.md +240 -0
- package/.agent/tools/build-mcp/deployment.md +401 -0
- package/.agent/tools/build-mcp/server-patterns.md +632 -0
- package/.agent/tools/build-mcp/transports.md +366 -0
- package/.agent/tools/code-review/auditing.md +383 -0
- package/.agent/tools/code-review/automation.md +219 -0
- package/.agent/tools/code-review/best-practices.md +203 -0
- package/.agent/tools/code-review/codacy.md +151 -0
- package/.agent/tools/code-review/code-simplifier.md +174 -0
- package/.agent/tools/code-review/code-standards.md +309 -0
- package/.agent/tools/code-review/coderabbit.md +101 -0
- package/.agent/tools/code-review/management.md +155 -0
- package/.agent/tools/code-review/qlty.md +248 -0
- package/.agent/tools/code-review/secretlint.md +565 -0
- package/.agent/tools/code-review/setup.md +250 -0
- package/.agent/tools/code-review/snyk.md +563 -0
- package/.agent/tools/code-review/tools.md +230 -0
- package/.agent/tools/content/summarize.md +353 -0
- package/.agent/tools/context/augment-context-engine.md +468 -0
- package/.agent/tools/context/context-builder-agent.md +76 -0
- package/.agent/tools/context/context-builder.md +375 -0
- package/.agent/tools/context/context7.md +371 -0
- package/.agent/tools/context/dspy.md +302 -0
- package/.agent/tools/context/dspyground.md +374 -0
- package/.agent/tools/context/llm-tldr.md +219 -0
- package/.agent/tools/context/osgrep.md +488 -0
- package/.agent/tools/context/prompt-optimization.md +338 -0
- package/.agent/tools/context/toon.md +292 -0
- package/.agent/tools/conversion/pandoc.md +304 -0
- package/.agent/tools/credentials/api-key-management.md +154 -0
- package/.agent/tools/credentials/api-key-setup.md +224 -0
- package/.agent/tools/credentials/environment-variables.md +180 -0
- package/.agent/tools/credentials/vaultwarden.md +382 -0
- package/.agent/tools/data-extraction/outscraper.md +974 -0
- package/.agent/tools/deployment/coolify-cli.md +388 -0
- package/.agent/tools/deployment/coolify-setup.md +353 -0
- package/.agent/tools/deployment/coolify.md +345 -0
- package/.agent/tools/deployment/vercel.md +390 -0
- package/.agent/tools/git/authentication.md +132 -0
- package/.agent/tools/git/gitea-cli.md +193 -0
- package/.agent/tools/git/github-actions.md +207 -0
- package/.agent/tools/git/github-cli.md +223 -0
- package/.agent/tools/git/gitlab-cli.md +190 -0
- package/.agent/tools/git/opencode-github-security.md +350 -0
- package/.agent/tools/git/opencode-github.md +328 -0
- package/.agent/tools/git/opencode-gitlab.md +252 -0
- package/.agent/tools/git/security.md +196 -0
- package/.agent/tools/git.md +207 -0
- package/.agent/tools/opencode/oh-my-opencode.md +375 -0
- package/.agent/tools/opencode/opencode-anthropic-auth.md +446 -0
- package/.agent/tools/opencode/opencode.md +651 -0
- package/.agent/tools/social-media/bird.md +437 -0
- package/.agent/tools/task-management/beads.md +336 -0
- package/.agent/tools/terminal/terminal-title.md +251 -0
- package/.agent/tools/ui/shadcn.md +196 -0
- package/.agent/tools/ui/ui-skills.md +115 -0
- package/.agent/tools/wordpress/localwp.md +311 -0
- package/.agent/tools/wordpress/mainwp.md +391 -0
- package/.agent/tools/wordpress/scf.md +527 -0
- package/.agent/tools/wordpress/wp-admin.md +729 -0
- package/.agent/tools/wordpress/wp-dev.md +940 -0
- package/.agent/tools/wordpress/wp-preferred.md +398 -0
- package/.agent/tools/wordpress.md +95 -0
- package/.agent/workflows/branch/bugfix.md +63 -0
- package/.agent/workflows/branch/chore.md +95 -0
- package/.agent/workflows/branch/experiment.md +115 -0
- package/.agent/workflows/branch/feature.md +59 -0
- package/.agent/workflows/branch/hotfix.md +98 -0
- package/.agent/workflows/branch/refactor.md +92 -0
- package/.agent/workflows/branch/release.md +96 -0
- package/.agent/workflows/branch.md +347 -0
- package/.agent/workflows/bug-fixing.md +267 -0
- package/.agent/workflows/changelog.md +129 -0
- package/.agent/workflows/code-audit-remote.md +279 -0
- package/.agent/workflows/conversation-starter.md +69 -0
- package/.agent/workflows/error-feedback.md +578 -0
- package/.agent/workflows/feature-development.md +355 -0
- package/.agent/workflows/git-workflow.md +702 -0
- package/.agent/workflows/multi-repo-workspace.md +268 -0
- package/.agent/workflows/plans.md +709 -0
- package/.agent/workflows/postflight.md +604 -0
- package/.agent/workflows/pr.md +571 -0
- package/.agent/workflows/preflight.md +278 -0
- package/.agent/workflows/ralph-loop.md +773 -0
- package/.agent/workflows/release.md +498 -0
- package/.agent/workflows/session-manager.md +254 -0
- package/.agent/workflows/session-review.md +311 -0
- package/.agent/workflows/sql-migrations.md +631 -0
- package/.agent/workflows/version-bump.md +283 -0
- package/.agent/workflows/wiki-update.md +333 -0
- package/.agent/workflows/worktree.md +477 -0
- package/LICENSE +21 -0
- package/README.md +1446 -0
- package/VERSION +1 -0
- package/aidevops.sh +1746 -0
- package/bin/aidevops +21 -0
- package/package.json +75 -0
- package/scripts/npm-postinstall.js +60 -0
- package/setup.sh +2366 -0
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: MCP transport protocols - stdio, HTTP, SSE
|
|
3
|
+
mode: subagent
|
|
4
|
+
tools:
|
|
5
|
+
read: true
|
|
6
|
+
write: true
|
|
7
|
+
edit: true
|
|
8
|
+
bash: true
|
|
9
|
+
glob: true
|
|
10
|
+
grep: true
|
|
11
|
+
webfetch: true
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# MCP Transports - stdio, HTTP, SSE
|
|
15
|
+
|
|
16
|
+
<!-- AI-CONTEXT-START -->
|
|
17
|
+
|
|
18
|
+
## Quick Reference
|
|
19
|
+
|
|
20
|
+
- **Purpose**: Configure MCP server transports for different deployment scenarios
|
|
21
|
+
- **Recommended**: stdio for local, StreamableHTTP for production
|
|
22
|
+
|
|
23
|
+
| Transport | Protocol | Use Case |
|
|
24
|
+
|-----------|----------|----------|
|
|
25
|
+
| `StdioServerTransport` | stdio | Local dev, spawned by AI assistants |
|
|
26
|
+
| `StreamableHTTPServerTransport` | 2025-03-26 | Production HTTP servers |
|
|
27
|
+
| `SSEServerTransport` | 2024-11-05 | Legacy compatibility |
|
|
28
|
+
|
|
29
|
+
<!-- AI-CONTEXT-END -->
|
|
30
|
+
|
|
31
|
+
## Stdio Transport
|
|
32
|
+
|
|
33
|
+
Best for local development and when AI assistants spawn the MCP server as a subprocess.
|
|
34
|
+
|
|
35
|
+
### Basic Setup
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
39
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
40
|
+
import { z } from 'zod';
|
|
41
|
+
|
|
42
|
+
const server = new McpServer({
|
|
43
|
+
name: 'my-mcp',
|
|
44
|
+
version: '1.0.0',
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// Register tools
|
|
48
|
+
server.tool(
|
|
49
|
+
'hello',
|
|
50
|
+
{ name: z.string() },
|
|
51
|
+
async (args) => ({
|
|
52
|
+
content: [{ type: 'text', text: `Hello, ${args.name}!` }],
|
|
53
|
+
})
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
// Connect via stdio
|
|
57
|
+
const transport = new StdioServerTransport();
|
|
58
|
+
await server.connect(transport);
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### OpenCode Configuration
|
|
62
|
+
|
|
63
|
+
```json
|
|
64
|
+
{
|
|
65
|
+
"mcp": {
|
|
66
|
+
"my-mcp": {
|
|
67
|
+
"type": "local",
|
|
68
|
+
"command": ["bun", "run", "/path/to/my-mcp/src/index.ts"],
|
|
69
|
+
"enabled": true
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Claude Code Configuration
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
claude mcp add my-mcp bun run /path/to/my-mcp/src/index.ts
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Logging with Stdio
|
|
82
|
+
|
|
83
|
+
Since stdout is used for MCP communication, use stderr for logging:
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
// Good - logs to stderr
|
|
87
|
+
console.error('[DEBUG] Processing request');
|
|
88
|
+
|
|
89
|
+
// Bad - interferes with MCP protocol
|
|
90
|
+
console.log('[DEBUG] Processing request');
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Streamable HTTP Transport
|
|
94
|
+
|
|
95
|
+
Best for production deployments and web-accessible MCP servers.
|
|
96
|
+
|
|
97
|
+
### With Express
|
|
98
|
+
|
|
99
|
+
```typescript
|
|
100
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
101
|
+
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
102
|
+
import express from 'express';
|
|
103
|
+
import { randomUUID } from 'crypto';
|
|
104
|
+
|
|
105
|
+
const server = new McpServer({
|
|
106
|
+
name: 'my-mcp',
|
|
107
|
+
version: '1.0.0',
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
// Register tools...
|
|
111
|
+
|
|
112
|
+
const app = express();
|
|
113
|
+
app.use(express.json());
|
|
114
|
+
|
|
115
|
+
app.post('/mcp', async (req, res) => {
|
|
116
|
+
const transport = new StreamableHTTPServerTransport({
|
|
117
|
+
sessionIdGenerator: () => randomUUID(),
|
|
118
|
+
enableJsonResponse: true,
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
res.on('close', () => transport.close());
|
|
122
|
+
await server.connect(transport);
|
|
123
|
+
await transport.handleRequest(req, res, req.body);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
app.listen(3000, () => {
|
|
127
|
+
console.log('MCP Server running on http://localhost:3000/mcp');
|
|
128
|
+
});
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### With ElysiaJS (Recommended)
|
|
132
|
+
|
|
133
|
+
```typescript
|
|
134
|
+
import { Elysia } from 'elysia';
|
|
135
|
+
import { mcp } from 'elysia-mcp';
|
|
136
|
+
import { z } from 'zod';
|
|
137
|
+
|
|
138
|
+
const app = new Elysia()
|
|
139
|
+
.use(
|
|
140
|
+
mcp({
|
|
141
|
+
serverInfo: { name: 'my-mcp', version: '1.0.0' },
|
|
142
|
+
capabilities: { tools: {} },
|
|
143
|
+
setupServer: async (server) => {
|
|
144
|
+
server.tool(
|
|
145
|
+
'hello',
|
|
146
|
+
{ name: z.string() },
|
|
147
|
+
async (args) => ({
|
|
148
|
+
content: [{ type: 'text', text: `Hello, ${args.name}!` }],
|
|
149
|
+
})
|
|
150
|
+
);
|
|
151
|
+
},
|
|
152
|
+
})
|
|
153
|
+
)
|
|
154
|
+
.listen(3000);
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### DNS Rebinding Protection
|
|
158
|
+
|
|
159
|
+
For localhost servers, enable DNS rebinding protection:
|
|
160
|
+
|
|
161
|
+
```typescript
|
|
162
|
+
import { createMcpExpressApp } from '@modelcontextprotocol/sdk/server/express.js';
|
|
163
|
+
|
|
164
|
+
// Protection auto-enabled for localhost
|
|
165
|
+
const app = createMcpExpressApp({ host: '127.0.0.1' });
|
|
166
|
+
|
|
167
|
+
// No protection when binding to all interfaces
|
|
168
|
+
const app = createMcpExpressApp({ host: '0.0.0.0' });
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Session Management
|
|
172
|
+
|
|
173
|
+
```typescript
|
|
174
|
+
const transport = new StreamableHTTPServerTransport({
|
|
175
|
+
sessionIdGenerator: () => randomUUID(),
|
|
176
|
+
enableJsonResponse: true,
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
// Access session ID
|
|
180
|
+
transport.sessionId; // UUID string
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## SSE Transport (Legacy)
|
|
184
|
+
|
|
185
|
+
For backwards compatibility with older clients using protocol version 2024-11-05.
|
|
186
|
+
|
|
187
|
+
### Basic SSE Server
|
|
188
|
+
|
|
189
|
+
```typescript
|
|
190
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
191
|
+
import { SSEServerTransport } from '@modelcontextprotocol/sdk/server/sse.js';
|
|
192
|
+
import express from 'express';
|
|
193
|
+
|
|
194
|
+
const server = new McpServer({
|
|
195
|
+
name: 'my-mcp',
|
|
196
|
+
version: '1.0.0',
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
const app = express();
|
|
200
|
+
const transports = new Map<string, SSEServerTransport>();
|
|
201
|
+
|
|
202
|
+
// SSE endpoint for streaming
|
|
203
|
+
app.get('/sse', (req, res) => {
|
|
204
|
+
const transport = new SSEServerTransport('/messages', res);
|
|
205
|
+
const sessionId = transport.sessionId;
|
|
206
|
+
transports.set(sessionId, transport);
|
|
207
|
+
|
|
208
|
+
res.on('close', () => {
|
|
209
|
+
transports.delete(sessionId);
|
|
210
|
+
transport.close();
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
server.connect(transport);
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
// Message endpoint
|
|
217
|
+
app.post('/messages', express.json(), (req, res) => {
|
|
218
|
+
const sessionId = req.query.sessionId as string;
|
|
219
|
+
const transport = transports.get(sessionId);
|
|
220
|
+
|
|
221
|
+
if (!transport) {
|
|
222
|
+
res.status(404).json({ error: 'Session not found' });
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
transport.handlePostMessage(req, res, req.body);
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
app.listen(3000);
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## Backwards Compatible Server
|
|
233
|
+
|
|
234
|
+
Support both Streamable HTTP and SSE transports:
|
|
235
|
+
|
|
236
|
+
```typescript
|
|
237
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
238
|
+
import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
|
|
239
|
+
import { SSEServerTransport } from '@modelcontextprotocol/sdk/server/sse.js';
|
|
240
|
+
import express from 'express';
|
|
241
|
+
import { randomUUID } from 'crypto';
|
|
242
|
+
|
|
243
|
+
const server = new McpServer({
|
|
244
|
+
name: 'my-mcp',
|
|
245
|
+
version: '1.0.0',
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
const app = express();
|
|
249
|
+
app.use(express.json());
|
|
250
|
+
|
|
251
|
+
const sseTransports = new Map<string, SSEServerTransport>();
|
|
252
|
+
|
|
253
|
+
// Streamable HTTP (new protocol)
|
|
254
|
+
app.post('/mcp', async (req, res) => {
|
|
255
|
+
const transport = new StreamableHTTPServerTransport({
|
|
256
|
+
sessionIdGenerator: () => randomUUID(),
|
|
257
|
+
});
|
|
258
|
+
res.on('close', () => transport.close());
|
|
259
|
+
await server.connect(transport);
|
|
260
|
+
await transport.handleRequest(req, res, req.body);
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
// SSE (legacy protocol)
|
|
264
|
+
app.get('/sse', (req, res) => {
|
|
265
|
+
const transport = new SSEServerTransport('/messages', res);
|
|
266
|
+
sseTransports.set(transport.sessionId, transport);
|
|
267
|
+
res.on('close', () => {
|
|
268
|
+
sseTransports.delete(transport.sessionId);
|
|
269
|
+
transport.close();
|
|
270
|
+
});
|
|
271
|
+
server.connect(transport);
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
app.post('/messages', (req, res) => {
|
|
275
|
+
const sessionId = req.query.sessionId as string;
|
|
276
|
+
const transport = sseTransports.get(sessionId);
|
|
277
|
+
if (transport) {
|
|
278
|
+
transport.handlePostMessage(req, res, req.body);
|
|
279
|
+
} else {
|
|
280
|
+
res.status(404).json({ error: 'Session not found' });
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
app.listen(3000, () => {
|
|
285
|
+
console.log('MCP Server running:');
|
|
286
|
+
console.log(' Streamable HTTP: http://localhost:3000/mcp');
|
|
287
|
+
console.log(' SSE (legacy): http://localhost:3000/sse');
|
|
288
|
+
});
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
## Remote HTTP Configuration
|
|
292
|
+
|
|
293
|
+
For AI assistants connecting to remote MCP servers:
|
|
294
|
+
|
|
295
|
+
### OpenCode
|
|
296
|
+
|
|
297
|
+
```json
|
|
298
|
+
{
|
|
299
|
+
"mcp": {
|
|
300
|
+
"my-mcp": {
|
|
301
|
+
"type": "remote",
|
|
302
|
+
"url": "https://my-mcp.example.com/mcp",
|
|
303
|
+
"enabled": true
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
### Claude Desktop (via proxy)
|
|
310
|
+
|
|
311
|
+
```json
|
|
312
|
+
{
|
|
313
|
+
"mcpServers": {
|
|
314
|
+
"my-mcp": {
|
|
315
|
+
"command": "npx",
|
|
316
|
+
"args": ["-y", "mcp-remote-client", "https://my-mcp.example.com/mcp"]
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
## Transport Selection Guide
|
|
323
|
+
|
|
324
|
+
| Scenario | Transport | Why |
|
|
325
|
+
|----------|-----------|-----|
|
|
326
|
+
| Local development | stdio | Simple, no server needed |
|
|
327
|
+
| AI assistant spawns process | stdio | Direct communication |
|
|
328
|
+
| Web deployment | StreamableHTTP | Standard HTTP, scalable |
|
|
329
|
+
| Multiple clients | StreamableHTTP | Session management |
|
|
330
|
+
| Legacy clients | SSE | Backwards compatibility |
|
|
331
|
+
| Both new and old clients | Both | Maximum compatibility |
|
|
332
|
+
|
|
333
|
+
## Testing Transports
|
|
334
|
+
|
|
335
|
+
### Test stdio
|
|
336
|
+
|
|
337
|
+
```bash
|
|
338
|
+
# Run server
|
|
339
|
+
bun run src/index.ts
|
|
340
|
+
|
|
341
|
+
# Server reads from stdin, writes to stdout
|
|
342
|
+
echo '{"jsonrpc":"2.0","method":"tools/list","id":1}' | bun run src/index.ts
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
### Test HTTP
|
|
346
|
+
|
|
347
|
+
```bash
|
|
348
|
+
# Start server
|
|
349
|
+
bun run src/index.ts
|
|
350
|
+
|
|
351
|
+
# Test with curl
|
|
352
|
+
curl -X POST http://localhost:3000/mcp \
|
|
353
|
+
-H "Content-Type: application/json" \
|
|
354
|
+
-d '{"jsonrpc":"2.0","method":"tools/list","id":1}'
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
### Test with MCP Inspector
|
|
358
|
+
|
|
359
|
+
```bash
|
|
360
|
+
npx @modelcontextprotocol/inspector
|
|
361
|
+
|
|
362
|
+
# Connect to:
|
|
363
|
+
# - stdio: Run command directly
|
|
364
|
+
# - HTTP: http://localhost:3000/mcp
|
|
365
|
+
# - SSE: http://localhost:3000/sse
|
|
366
|
+
```
|