Token导航 LogoToken导航TokenDH.com
solvemcp (Answer Dot AI) logo
AI代理stdio官方级别未说明来源级核验

solvemcp (Answer Dot AI)

MCP Server

一个提供多种传输方式(包括stdio、HTTP和HTTP+SSE)以连接和操作MCP服务器的Python客户端工具。

工具数

2

提示词数

0

GitHub Stars

2

资源数

0
代码搜索PythonHTTP传输本地部署

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

AnswerDotAI

提供方

AnswerDotAI

最后核验

2026/5/17 20:22

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

pip install solvemcp

详细介绍

solvemcp

它提供:

  • stdio 本地子流程服务器的传输。
  • 现代MCP服务器的流式HTTP传输。
  • 旧服务器的传统HTTP+SSE回退。
  • 动态Python可调用由返回的工具 tools/list.

安装

pip install solvemcp

快速开始

连接到本地stdio服务器

from solvemcp import MCPClient
with MCPClient.stdio([sys.executable, "-u", "../tests/echoserver.py"]) as mcp:
    print(list(mcp.tools))
    res = mcp.echo(text="hello")
    print(res)
['echo']
{'content': [{'type': 'text', 'text': 'hello'}]}

连接到HTTP MCP服务器

with MCPClient.http("https://mcp.grep.app") as mcp:
    print(list(mcp.tools))
    res = mcp.searchGitHub(query="class PtyProcess", language=["Python"])
['searchGitHub']
mcp = MCPClient.http("https://mcp.grep.app")
print(list(mcp.tools))
res = mcp.searchGitHub(query="class PtyProcess", language=["Python"])
['searchGitHub']
mcp.searchGitHub?
def searchGitHub(
    query:Any, matchCase:Any=False, matchWholeWords:Any=False, useRegexp:Any=False, repo:Any=None, path:Any=None,
    language:list=None
):
Find real-world code examples from over a million public GitHub repositories to help answer programming questions.

**IMPORTANT: This tool searches for literal code patterns (like grep), not keywords. Search for actual code that would appear in files:**
- ✅ Good: 'useState(', 'import React from', 'async function', '(?s)try {.*await'
- ❌ Bad: 'react tutorial', 'best practices', 'how to use'

**When to use this tool:**
- When implementing unfamiliar APIs or libraries and need to see real usage patterns
- When unsure about correct syntax, parameters, or configuration for a specific library
- When looking for production-ready examples and best practices for implementation
- When needing to understand how different libraries or frameworks work together

**Perfect for questions like:**
- "How do developers handle authentication in Next.js apps?" → Search: 'getServerSession' with language=['TypeScript', 'TSX']
- "What are common React error boundary patterns?" → Search: 'ErrorBoundary' with language=['TSX']
- "Show me real useEffect cleanup examples" → Search: '(?s)useEffect\(\(\) => {.*removeEventListener' with useRegexp=true
- "How do developers handle CORS in Flask applications?" → Search: 'CORS(' with matchCase=true and language=['Python']

Use regular expressions with useRegexp=true for flexible patterns like '(?s)useState\(.*loading' to find useState hooks with loading-related variables. Prefix the pattern with '(?s)' to match across multiple lines.

Filter by language, repository, or file path to narrow results.

文件: ~/aai-ws/toolslm/toolslm/funccall.py

类型: 功能

mcp.close()
cts = res['content']
print(len(cts))
10
print(cts[0]['text'][:500])
Repository: sedwards2009/extraterm
Path: extensions/ProxySessionBackend/src/python/ptyprocess/ptyprocess.py
URL: https://github.com/sedwards2009/extraterm/blob/master/extensions/ProxySessionBackend/src/python/ptyprocess/ptyprocess.py
License: MIT

Snippets:
--- Snippet 1 (Line 79) ---
            (intr, eof) = (3, 4)
    
    _INTR = _byte(intr)
    _EOF = _byte(eof)

class PtyProcessError(Exception):
    """Generic error class for this package."""

# setecho and setwinsize are pulled out here b

工具调用如何工作

对于每个具有有效Python标识符名称的服务器工具, MCPClient 动态添加方法。示例:名为的服务器工具 echo 成为 mcp.echo(...).

等效形式:

mcp.echo(text="hi")
mcp.call_tool("echo", text="hi")

流媒体

对于流式HTTP服务器,请使用 rpc_streamcall_tool_stream:

for msg in mcp.rpc_stream("tools/list", params={}): print(msg)

发展

模块布局

  • solvemcp/client.py: MCPClient 请求生命周期、初始化,

工具绑定和RPC帮助程序。

  • solvemcp/transports.py:传输实现加上SSE解析器

以及错误类型。

运行测试:

python tests/tests.py

目录标签

目录标签

代码搜索PythonHTTP传输本地部署MCP协议Python工具动态调用

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

工具数量(toolCount,工具数)

2

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdionone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP