solvemcp
It provides:
stdiotransport for local subprocess servers.- Streamable HTTP transport for modern MCP servers.
- Legacy HTTP+SSE fallback for older servers.
- Dynamic Python callables for tools returned by
tools/list.
Installation
pip install solvemcp
Quick Start
Connect to a local stdio server
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'}]}
Connect to an HTTP MCP server
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.
File: ~/aai-ws/toolslm/toolslm/funccall.py
Type: function
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
How Tool Calls Work
For each server tool with a valid Python identifier name, MCPClient
adds a method dynamically. Example: a server tool named echo becomes
mcp.echo(...).
Equivalent forms:
mcp.echo(text="hi")
mcp.call_tool("echo", text="hi")
Streaming
For Streamable HTTP servers, use rpc_stream or call_tool_stream:
for msg in mcp.rpc_stream("tools/list", params={}): print(msg)
Development
Module Layout
solvemcp/client.py:MCPClientrequest lifecycle, initialization, tool binding, and RPC helpers.solvemcp/transports.py: transport implementations plus SSE parsers and error types.
Run tests:
python tests/tests.py
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
solvemcp-0.0.2.tar.gz
(18.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
solvemcp-0.0.2-py3-none-any.whl
(16.0 kB
view details)
File details
Details for the file solvemcp-0.0.2.tar.gz.
File metadata
- Download URL: solvemcp-0.0.2.tar.gz
- Upload date:
- Size: 18.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d578cdd211b071855bee46c53effc1dd9a5a955837a2ebd8a2a4cc7b1a21372
|
|
| MD5 |
a84de1f4b11cc93e133c67d8009bf9ed
|
|
| BLAKE2b-256 |
d11a013513402cccb58f7c3d9ab7b8e85eea53b415f0601ee57b9fde13f27b70
|
File details
Details for the file solvemcp-0.0.2-py3-none-any.whl.
File metadata
- Download URL: solvemcp-0.0.2-py3-none-any.whl
- Upload date:
- Size: 16.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
81686150718df99b89a4def5ef67f9123ed3b699a4658cfbffc53721124f790d
|
|
| MD5 |
3482051ec398c99a29cecd95ff07c61c
|
|
| BLAKE2b-256 |
d59568a860dee91a46f3833261b90950737bcb5b121d8abbd2f148a887f6a45d
|