MCP-Ghost 👻
Intelligent MCP tool orchestration library with Claude Desktop-level capabilities
MCP-Ghost provides a programmatic interface for interacting with Model Context Protocol (MCP) servers through LLMs. Unlike CLI interfaces, MCP-Ghost accepts inputs directly from Python code and returns structured outputs with advanced tool orchestration features.
✨ Features
- 🔗 Tool Chaining: Automatically executes sequences of dependent tool calls
- 🔄 Backtracking: Retries failed operations with alternative approaches
- 🧠 Context Management: Maintains conversation state across multiple tool interactions
- 🛠️ Error Recovery: Intelligent handling of tool failures with retry strategies
- 📊 Result Synthesis: Combines outputs from multiple tools into coherent responses
🎯 Supported Providers
- OpenAI: GPT-4o, GPT-4o-mini, GPT-4-turbo, GPT-3.5-turbo
- Anthropic (Claude): Claude-4-opus, Claude-4-sonnet, Claude-3.7-sonnet, Claude-3.5-sonnet, Claude-3-opus, Claude-3-sonnet, Claude-3-haiku
- Google (Gemini): Gemini-2.5-pro, Gemini-2.5-flash, Gemini-2.0-flash, Gemini-1.5-pro, Gemini-1.5-flash
💡 Recommended Models: For best cost-performance balance, use Claude-4-sonnet, Gemini-2.5-flash, or GPT-4o-mini. For maximum capability in complex tool orchestration, use Claude-4-opus or Gemini-2.5-pro.
📦 Installation
pip install mcp-ghost
🚀 Quick Start
import asyncio
from mcp_ghost import mcp_ghost, MCPGhostConfig
async def main():
# Option 1: Inline server config
config = MCPGhostConfig(
server_config={
"mcpServers": {
"sqlite": {
"command": "uvx",
"args": ["mcp-server-sqlite", "--db-path", "test.db"]
}
}
},
system_prompt="You are a helpful database assistant.",
provider="openai",
api_key="sk-...",
user_prompt="List all tables and describe their schemas"
)
# Option 2: Load server config from file (Claude Desktop format)
config = MCPGhostConfig(
server_config="path/to/server_config.json", # or dict as above
system_prompt="You are a helpful database assistant.",
provider="openai",
api_key="sk-...",
user_prompt="List all tables and describe their schemas"
)
result = await mcp_ghost(config)
print(f"Success: {result.success}")
print(f"Summary: {result.summary}")
print(f"Tool calls made: {len(result.tool_chain)}")
if __name__ == "__main__":
asyncio.run(main())
🏗️ Architecture
MCP-Ghost is designed for use in larger architectures where:
- Human User provides natural language input
- Prompt Builder processes user input and ensures security constraints
- MCP-Ghost executes the one-shot tool operation with intelligent orchestration
- Results are returned for further processing
🔒 Security Model
- Prompt Builder Responsibility: Input validation and security filtering
- MCP Server Trust: Trusts provided MCP servers completely
- Stdio Isolation: Each MCP server runs in its own subprocess
- Timeout Protection: Tool execution timeouts prevent hanging operations
📖 Documentation
🧪 Testing
MCP-Ghost uses a focused core test suite for fast, reliable development:
# Run core functionality tests (recommended)
make test
# Run all tests (requires external dependencies)
make test-all
# Record new golden tests (requires API keys)
pytest -m record_golden
The core test suite (145 tests) runs in ~1 second and covers all essential functionality without external dependencies.
🤝 Contributing
- Fork the repository
- Create a feature branch
- Add tests (including golden tests for new features)
- Submit a pull request
📄 License
MIT License - see LICENSE file for details.
🙏 Acknowledgments
Built on top of:
- Official MCP Python SDK - Model Context Protocol implementation
Metadata
Release files for mcp-ghost 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| mcp_ghost-0.1.0.tar.gz | 37.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mcp_ghost-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 63.1 kB
Release files / mcp_ghost-0.1.0.tar.gz
| Download URL | mcp_ghost-0.1.0.tar.gz |
|---|---|
| Size | 37.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6cfeea4c93d2d7ae9b8a2a76f135eb5e5dc26e3053f1b93aebac91686729553f
|
|
BLAKE2b-256 checksum How to use checksums |
45faf4fa3c4bc815de6522fff63b0dea868db38c618baa299bdb8e828bf93d47
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.0
|
Release files / mcp_ghost-0.1.0-py3-none-any.whl
| Download URL | mcp_ghost-0.1.0-py3-none-any.whl |
|---|---|
| Size | 25.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e14bd9ec01f3b0f491215110f38e8e5297e2b61483bf9c7d5222f98f6208074c
|
|
BLAKE2b-256 checksum How to use checksums |
52925ad7985610960fed419fc62d1660ed870e4cf11a20cd9ee7937b99c79528
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.0
|
Security for mcp-ghost 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.