
应对工具过载的MCP
概览
一个强大的模型上下文协议(MCP)服务器,为每个会话提供持久的IPython外壳。服务器只暴露有限数量的工具,核心仅暴露以下两个 - 其他工具更多是支持LLM编写代码或调用相应CLI完成任务的工具。有一些基于树置工具的代码检索工具,但基本就这些了。 比如安装包或安装CLI。或者在ipython shell中对变量做内省。 服务器还支持添加外部MCP服务器。这里的想法是你可以在shell内运行MCP服务器,这样你可以在shell中持久化结果,包含变量和结果等。 我主要注意到的一点是,LLM在提供大量工具时容易出错,而且现在已经很明显了。
概述(AI 翻译)
一个强大的模型上下文协议(MCP)服务器,为每个会话提供持久的IPython壳。 服务器只暴露有限数量的工具,核心内容仅是以下两个——
call_cliexecute_python_code
其余工具更多是支持LLM编写代码或调用相应CLI完成任务的。 有一些基于树状坐图的代码检索工具,但基本就这些了。
比如安装包或安装CLI。或者在ipython shell中对变量做内省。
服务器还支持添加外部MCP服务器。这里的想法是你可以在shell内运行MCP服务器,这样你可以在shell中持久化结果,包含变量和结果等。
我注意到的一个主要问题是,LLM在配备大量工具时容易出错,这一点现在已经很明显了。有许多文章和视频(由比我更有资质的人撰写和分享),它们的主要主题是工具过载和上下文限制的问题。
这个服务器是我试图“解决”这个问题的尝试。
你怎么问?
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
Sherlog Log AI MCP
A powerful Model Context Protocol (MCP) server that provides a persistent IPython shell per session. The server only exposes a limited number of tools and at the core of it just exposes the following 2 -
call_cliexecute_python_code
And the rest of the tools are more for supporting the LLM to write the code or call the appropriate cli to complete the task. There are some tools for code retrieval based on tree sitter but thats pretty much it.
For example, installing packages or installing cli. Or doing introspection of variables in the ipython shell.
The server also supports adding external mcp servers. The idea here is you can run mcp servers inside the shell that allows you to persist results in the shell with variables and results etc.
One of the primary things I have noticed is that LLMs mess up when provided with a lot of tools and also as is quite evident by now. There are multiple articles and videos (written and shared by people way more qualified than me) and they main theme across them is the problems with tools overload and context limitation.
This server is my attempt at “solving” that problem.
How you ask ?
Note: The core of this approach is:
- All tool calls are persisted to a variable in the shell and the LLM would then write code to inspect the variable, slice/dice and get the required part out of a “gigantic” payload. My idea was similar to when us engineers work with large data we get them into dataframes and then slice/dice to get the required part out.
- CLI calls are composable and that helps the LLM to get only the required content
Both are ways of not polluting the context with useless info.
Overview
Sherlog MCP Server transforms Claude Desktop into a stateful data analysis powerhouse by providing:
- Session-Aware IPython Shells: Isolated workspaces per session with automatic persistence
- DataFrame-Centric Architecture: Every operation returns DataFrames, creating a unified data model
- Multi-Session Support: Handle up to 4 concurrent sessions with automatic lifecycle management
- MCP Proxy: Seamlessly integrates any external MCP server, executing all operations within the same IPython context
Think of it as giving Claude a persistent Python notebook that maintains separate workspaces for different conversations, where every piece of data is immediately available for the next operation.
Architecture & Design
Sherlog MCP Server supports different deployment scenarios through specialized Docker containers:
Container Variants
Vanilla Container
A lightweight, general-purpose environment optimized for data analysis and development workflows.
Pre-installed Tools:
- GitHub CLI (
gh) - Complete GitHub integration for repository management, issues, PRs, and workflows - Python Ecosystem - Full scientific computing stack (pandas, numpy, matplotlib, etc.)
安装
npx -y @modelcontextprotocol/server-filesystem /tmp