Skip to content

v0.2.0

@MaximeRivest MaximeRivest tagged this 19 Oct 15:10
High-Level Load API with Background Event Loop

This release completes Phase 1 of the mcp2py implementation, providing
a production-ready Python interface to MCP servers.

- πŸš€ load() function: Simple, synchronous API to any MCP server
- ⚑ Background event loop: Seamless async/sync bridge in thread
- πŸ”§ Dynamic tool methods: MCP tools become Python methods
- πŸ“¦ Subprocess management: Launch, maintain, and cleanup servers
- 🐍 Pythonic names: Automatic camelCase β†’ snake_case conversion
- πŸ“„ Result unwrapping: Clean content without MCP envelope
- 🧹 Context manager: Automatic resource cleanup
- ❗ Better errors: Helpful messages with available tools

User Code (Sync) β†’ load() β†’ MCPServer β†’ AsyncRunner β†’ MCPClient β†’ Official SDK

- src/mcp2py/event_loop.py (42 LOC) - Background event loop
- src/mcp2py/loader.py (22 LOC) - load() function
- src/mcp2py/server.py (56 LOC) - MCPServer wrapper
- src/mcp2py/schema.py (18 LOC) - Utilities

- βœ… 55/55 tests passing (33 new tests)
- βœ… 92% code coverage
- βœ… mypy --strict clean
- βœ… Full type safety

```python
from mcp2py import load

server = load("python server.py")

result = server.echo(message="Hello!")
result = server.add(a=5, b=3)

server.close()

with load("python server.py") as server:
    result = server.some_tool(arg="value")
```

None - First release with load() API

- Maxime Rivest (@maximerivest)
- Claude Code (implementation assistant)

πŸŽ‰ Ready for Phase 2: .tools attribute, resources, prompts!
Assets 2
Loading