D3f0 / D3f0/invoke-toolkit

feat: Expose invoke collections as MCP tools via FastMCP 2+

Open
#61 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
3
Forks
0
Avg merge
3h 29m
Merged PRs (30d)
5

Description

## Summary

Add MCP (Model Context Protocol) support to invoke-toolkit, enabling LLMs and AI assistants to execute invoke tasks as tools.

## Approach

Use a **uv workspace** to create a separate `invoke-toolkit-mcp` extension package:

```
extensions/invoke-toolkit-mcp/
├── src/invoke_toolkit_mcp/
│ ├── scanner.py # Collection metadata extraction
│ ├── bridge.py # Invoke ↔ MCP adapter
│ ├── server.py # FastMCP server factory
│ └── cli.py # CLI interface
└── tests/
```

## Key Features

- **Zero coupling**: Core package unchanged, MCP is opt-in
- **Dependency isolation**: `fastmcp` only installed when needed
- **Full type support**: Annotated, enums, Literal types → JSON schemas
- **Multiple transports**: stdio, HTTP, SSE
- **Entry point discovery**: Auto-load all `invoke_toolkit.collection` plugins
- **Namespacing**: Nested collections → prefixed tools

## Usage

```bash
# Install
pip install invoke-toolkit invoke-toolkit-mcp

# Start server
invoke-mcp --file tasks.py
invoke-mcp --collection myapp.tasks --transport http --port 8000

# Claude Desktop integration
{
"mcpServers": {
"invoke-toolkit": {
"command": "invoke-mcp",
"args": ["--file", "/path/to/tasks.py"]
}
}
}
```

## Implementation

Branch: `feat/mcp-extension-workspace`

- [x] Workspace configuration (`[tool.uv.workspace]`)
- [x] Extension package structure
- [x] Scanner module (task → MCP schema)
- [x] Bridge module (invoke ↔ FastMCP)
- [x] Server factory (multiple sources)
- [x] CLI interface
- [x] Test suite
- [x] Documentation

## Dependencies

```toml
dependencies = [
"invoke-toolkit>=2.0.0",
"fastmcp>=2.14.5,<3.0.0",
]
```

## Related

- [FastMCP](https://github.com/jlowin/fastmcp) - MCP server framework
- [Model Context Protocol](https://modelcontextprotocol.io) - Specification

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.