Skip to content

Implement local MCP HTTP transport, remove @modelcontextprotocol/sdk dependency - #5671

Merged
pelikhan merged 9 commits into
mainfrom
copilot/implement-mcp-http-transport
Dec 6, 2025
Merged

Implement local MCP HTTP transport, remove @modelcontextprotocol/sdk dependency#5671
pelikhan merged 9 commits into
mainfrom
copilot/implement-mcp-http-transport

Conversation

CopilotAI commented Dec 6, 2025

Copy link
Copy Markdown
Contributor

Implementation Complete: Local MCP HTTP Transport Layer

Summary

Successfully implemented a local MCP HTTP transport layer and completely removed the @modelcontextprotocol/sdk dependency.

Changes Completed

  • Created mcp_logger.cjs with createLogger utility for reusable logging
  • Created mcp_server.cjs with MCPServer class for tool registration and protocol handling
  • Created mcp_http_transport.cjs with MCPHTTPTransport class for HTTP transport
  • Implemented JSON-RPC 2.0 protocol handling
  • Implemented session management (stateful and stateless modes)
  • Updated safe_inputs_mcp_server_http.cjs to use local transport and logger
  • Removed @modelcontextprotocol/sdk from package.json
  • Removed @modelcontextprotocol/sdk from package-lock.json (ran npm install)
  • Registered all new files with bundler script registry in pkg/workflow/scripts.go
  • Added comprehensive unit tests (8 logger + 9 server + 12 http transport)
  • All integration tests passing (7 tests)
  • Removed obsolete SDK test file
  • Code formatted and validated

Test Results

  • ✅ 8 unit tests passing (mcp_logger.test.cjs)
  • ✅ 9 unit tests passing (mcp_server.test.cjs)
  • ✅ 12 unit tests passing (mcp_http_transport.test.cjs)
  • ✅ 7 integration tests passing (safe_inputs_mcp_server_http.test.cjs)
  • ✅ No SDK references remaining in code or dependencies
  • ✅ Build and lint passing

File Structure

pkg/workflow/js/
├── mcp_logger.cjs # Logger utility - timestamp & stderr logging
├── mcp_server.cjs # MCPServer class - tool registration & protocol
├── mcp_http_transport.cjs # MCPHTTPTransport class - HTTP transport layer
├── mcp_logger.test.cjs # Unit tests for logger
├── mcp_server.test.cjs # Unit tests for MCPServer
└── mcp_http_transport.test.cjs # Unit tests for HTTP transport

Script Registry

All files are registered in pkg/workflow/scripts.go for bundling:

  • mcp_logger → mcp_logger.cjs
  • mcp_server → mcp_server.cjs
  • mcp_http_transport → mcp_http_transport.cjs

Dependencies Removed

  • @modelcontextprotocol/sdk completely removed from package.json
  • @modelcontextprotocol/sdk completely removed from package-lock.json
  • ✅ ~85 npm packages eliminated from dependency tree

Implementation Details

  • mcp_logger.cjs: Utility for creating loggers with timestamp and stderr output
  • mcp_server.cjs: Tool registration and JSON-RPC 2.0 protocol handling
  • mcp_http_transport.cjs: HTTP transport with session management, CORS support, proper error handling
Original prompt

Implement the MCP http transport layer locally and remove dependency on the model-context-protocol/sdk package for the MCP-server http implementation. Separate JavaScript file.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.


Changeset

  • Type: patch
  • Description: Implement local MCP HTTP transport layer and remove @modelcontextprotocol/sdk dependency. Adds mcp_logger.cjs, mcp_server.cjs, mcp_http_transport.cjs and accompanying unit/integration tests. Internal refactor and tooling change only; no public CLI breaking changes.

AI generated by Changeset Generator



Smoke Test Summary (19992402761)

Run: 2025-12-06T18:18:12Z | Status: ✅ PASS | All tests passed (GitHub MCP, File Writing, Bash, Playwright)

AI generated by Smoke Copilot No Firewall

AI generated by Smoke Copilot No Firewall

CopilotAIand others added 3 commits December 6, 2025 17:30
- Created mcp_http_transport.cjs with MCPServer and MCPHTTPTransport classes
- Updated safe_inputs_mcp_server_http.cjs to use local transport
- Removed @modelcontextprotocol/sdk from package.json
- All HTTP transport tests passing
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
The test file required @modelcontextprotocol/sdk client which is no longer a dependency
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- Test MCPServer core functionality (initialize, tools/list, tools/call)
- Test MCPHTTPTransport creation and lifecycle
- Test server-transport integration
- All 12 tests passing
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot remove step that non installs the sdk package

CopilotAI changed the title [WIP] Implement MCP http transport layer and remove sdk dependencyImplement local MCP HTTP transport, remove @modelcontextprotocol/sdk dependencyDec 6, 2025
CopilotAI requested a review from pelikhanDecember 6, 2025 17:43
Only modify package.json to remove SDK, keep package-lock.json unchanged
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

CopilotAI commented Dec 6, 2025

Copy link
Copy Markdown
ContributorAuthor

@copilot remove step that non installs the sdk package

Reverted package-lock.json to its original state. Only package.json now has the SDK removed, without running npm install. Commit: 6f56cbb

@pelikhanpelikhan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot make sure new JavaScript files are registered with the bundler script registry

/**
* Simple MCP Server implementation that provides tool registration and protocol handling
*/
class MCPServer {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot move to own file

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved MCPServer class to mcp_server.cjs. Commit: e9fc180

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot refactor logger into own file, register in script registry

- Created mcp_server.cjs with MCPServer class
- Updated mcp_http_transport.cjs to import MCPServer
- Registered both files in script registry (scripts.go)
- Added comprehensive unit tests for mcp_server.cjs
- All 9 new tests passing, plus existing 12+7 tests still passing
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

CopilotAI commented Dec 6, 2025

Copy link
Copy Markdown
ContributorAuthor

@copilot make sure new JavaScript files are registered with the bundler script registry

Registered both mcp_server.cjs and mcp_http_transport.cjs with the bundler script registry in pkg/workflow/scripts.go. Commit: e9fc180

- Created mcp_logger.cjs with createLogger function
- Updated safe_inputs_mcp_server_http.cjs to use mcp_logger
- Registered mcp_logger.cjs in script registry (scripts.go)
- Added comprehensive unit tests (8 tests passing)
- All existing tests still passing (7 HTTP server + 9 mcp_server + 12 http transport)
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

CopilotAI commented Dec 6, 2025

Copy link
Copy Markdown
ContributorAuthor

@copilot refactor logger into own file, register in script registry

Refactored logger into mcp_logger.cjs with createLogger function and registered it in the script registry. Commit: cc2e196

@github-actions

Copy link
Copy Markdown
Contributor

💥 WHOOSH!Smoke Claude springs into action on this pull request! [Panel 1 begins...]

@github-actions

Copy link
Copy Markdown
Contributor

🔮 The ancient spirits stir... Smoke Codex awakens to divine this pull request...

@github-actions

Copy link
Copy Markdown
Contributor

📰 BREAKING: Smoke Copilot is now investigating this pull request. Sources say the story is developing...

@github-actions

Copy link
Copy Markdown
Contributor

📰 BREAKING: Smoke Copilot Playwright is now investigating this pull request. Sources say the story is developing...

@github-actions

github-actionsBot commented Dec 6, 2025

Copy link
Copy Markdown
Contributor

🎉 Yo ho ho! Changeset Generator found the treasure and completed successfully! ⚓💰

@github-actions

Copy link
Copy Markdown
Contributor

🤖 SYSTEM_INIT: Smoke Copilot No Firewall ACTIVATED. PROCESSING pull request. ALL SUBSYSTEMS ONLINE.

@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot remove step that does npm install of the model context protocol sdk package

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test Summary (19992402737)

Status: ✅ PASS

Recent Merged PRs:

Test Results:

  • ✅ GitHub MCP: Listed 2 recent merged PRs
  • ✅ File Writing: Created test file successfully
  • ✅ Bash Tool: Verified file content
  • ✅ Playwright MCP: GitHub page title verified

💥 [THE END] — Illustrated by Smoke Claude fer issue #5671 🗺️

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test Summary (19992402742)

Status: PASS

📰 BREAKING: Report filed by Smoke Copilot fer issue #5671 🗺️

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test: Copilot (No Firewall) - Run 19992402761

Status: PASS

🤖 DIAGNOSTIC REPORT GENERATED BY Smoke Copilot No Firewall fer issue #5671 🗺️

@github-actions

Copy link
Copy Markdown
Contributor

Smoke Test Results

Playwright MCP: Navigated to https://github.com and verified page title contains "GitHub"

Overall Status: PASS

📰 BREAKING: Report filed by Smoke Copilot Playwright fer issue #5671 🗺️

@github-actions

Copy link
Copy Markdown
Contributor

GitHub MCP (last 2 merged PRs): #5667 Add support for configuring default agent and detection models; #5670 Fix update_pull_request default operation and add comprehensive tests
GitHub MCP lookup ✅
File write/read ✅
Playwright title ✅
Overall: PASS

🔮 The oracle has spoken through Smoke Codex fer issue #5671 🗺️

Ran npm install to sync package-lock.json with package.json, removing all @modelcontextprotocol/sdk dependencies
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

CopilotAI commented Dec 6, 2025

Copy link
Copy Markdown
ContributorAuthor

@copilot remove step that does npm install of the model context protocol sdk package

Removed SDK from package-lock.json by running npm install. The SDK and all its dependencies (~85 packages) are now completely removed. Commit: 77ec702

@pelikhan
pelikhan marked this pull request as ready for review December 6, 2025 18:25
@pelikhan
pelikhan merged commit 1f6a4f6 into mainDec 6, 2025
5 checks passed
@pelikhan
pelikhan deleted the copilot/implement-mcp-http-transport branch December 6, 2025 18:25
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@pelikhan