-
Notifications
You must be signed in to change notification settings - Fork 13
feat(mcp2.0): add and replace tools with mcp #261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces MCP (Meta Compute Platform) integration across the TinyScientist modules, replacing or augmenting existing local tools with a centralized MCP client/server model. Key changes include:
- Added
tiny_scientist/utils/mcp_client.py
for a generic MCP client and corresponding server implementations undertiny_scientist/mcp/
. - Updated imports in core classes (
Writer
,Thinker
,Reviewer
,Coder
,Scientist
) to accept anmcp_client
and fall back to legacy tools when MCP is unavailable. - Added a convenience script to launch all MCP servers and updated dependencies/config templates to support the new MCP setup.
Reviewed Changes
Copilot reviewed 13 out of 15 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
tiny_scientist/writer.py | Switched to mcp.tool imports, added mcp_client fallback logic for search & diagram tools |
tiny_scientist/utils/mcp_client.py | New MCPClient implementation with start/stop/call methods |
tiny_scientist/mcp/tool.py | Tool definitions updated for MCP namespace (missing os import) |
tiny_scientist/mcp/*.py | Added MCP server modules for paper search, drawer, and code search |
scripts/run_mcp_servers.py | New script to start and interactively manage MCP servers |
pyproject.toml & config.template.toml | Added mcp , fastmcp , httpx deps and MCP server templates |
Comments suppressed due to low confidence (3)
tiny_scientist/utils/mcp_client.py:21
- Type annotation
subprocess.Popen[str]
is invalidβPopen
is not a generic class; usesubprocess.Popen[Any]
or omit the type parameter.
self.servers: Dict[str, subprocess.Popen[str]] = {}
tiny_scientist/utils/mcp_client.py:1
- The new
MCPClient
and MCP server code are significant features but have no accompanying tests; consider adding unit tests for methods likestart_server
,call_tool
, andhealth_check
.
import json
tiny_scientist/mcp/tool.py:11
- The module uses
os.path
but does not importos
; addimport os
at the top to avoid NameError.
import toml
# Create tool call request | ||
request = { | ||
"jsonrpc": "2.0", | ||
"id": 1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using a static JSON-RPC id
for every call can cause conflicts if multiple calls happen concurrently; consider generating unique or incrementing IDs per request.
Copilot uses AI. Check for mistakes.
tiny_scientist/writer.py
Outdated
self.drawer: BaseTool = DrawerTool(model, prompt_template_dir, temperature) | ||
self.mcp_client = mcp_client | ||
# Fallback to traditional tools if MCP is not available | ||
self.searcher: Optional[BaseTool] = PaperSearchTool(s2_api_key=s2_api_key) if not mcp_client else None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fallback initialization of legacy tools when mcp_client
is missing is duplicated in multiple classes; consider extracting into a shared factory/helper to reduce duplication.
Copilot uses AI. Check for mistakes.
pyproject.toml
Outdated
fastmcp = "*" | ||
mcp = "*" | ||
httpx = "*" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Using wildcard versions (*
) for critical dependencies can lead to unpredictable breakage; pin fastmcp
, mcp
, and httpx
to specific version ranges for reproducible builds.
fastmcp = "*" | |
mcp = "*" | |
httpx = "*" | |
fastmcp = "^1.0.0" | |
mcp = "^2.0.0" | |
httpx = "^0.24.0" |
Copilot uses AI. Check for mistakes.
Closes #
π Description
β Checks
type/descript
(e.g.feature/add-llm-agents
)βΉ Additional Information