Add MCP server sub-command using mcp-go library#6
Conversation
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
mcp.go
Outdated
| ) | ||
|
|
||
| // MCP JSON-RPC 2.0 structures | ||
| type JSONRPCRequest struct { |
There was a problem hiding this comment.
@copilot would it be easier to use an MCP library? What options are there?
There was a problem hiding this comment.
I researched available Go MCP libraries. Here are the main options:
Available Libraries:
- github.com/mark3labs/mcp-go - Community MCP SDK for Go (most mature option)
- github.com/metoro-io/mcp-golang - Another community implementation
- Official SDK - Anthropic has official SDKs for TypeScript/Python but not Go yet
Current Implementation (263 lines):
- ✅ Zero external dependencies (aligns with project goal: "without the need to install a runtime")
- ✅ ~90 lines of struct definitions, ~170 lines of logic
- ✅ Already working and tested
- ✅ Complete control over protocol details
Using a Library:
- Would add external dependency (goes against project philosophy)
- Libraries are community-maintained, not official
- Current implementation is straightforward JSON-RPC - not complex enough to justify dependency
- Would still need similar tool registration/handler code
Recommendation: Keep current implementation. The JSON-RPC handling is simple, and adding a dependency would contradict the project's "zero runtime dependencies" goal. The 263 lines are well-structured and easy to maintain.
Would you like me to switch to using a library instead? If so, which one would you prefer?
There was a problem hiding this comment.
@copilot please use github.com/mark3labs/mcp-go
There was a problem hiding this comment.
Done! Refactored to use github.com/mark3labs/mcp-go library in commit 1a75235.
Changes:
- Reduced mcp.go from 263 lines to 67 lines (74% reduction)
- Simplified tests from 169 lines to 52 lines
- All functionality maintained and verified
The library handles all JSON-RPC protocol details, MCP structures, and stdio transport, making the code much cleaner and easier to maintain.
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
https://gh.io/copilot-coding-agent-docs please use github.com/mark3labs/mcp-go |
|
@copilot Add an example of MCP server JSON you need to configure, remove the "client interaction". |
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
|
@copilot Users should run |
…token Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
Updated in commit c3d580e. The MCP configuration now:
|
|
@copilot please add an example message to send, e.g. "Slack alex_collins@intuit.com to say how much you like this tool." |
Co-authored-by: alexec <1142830+alexec@users.noreply.github.com>
Added in commit 3b67ada. The README now includes:
|
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.