Metadata-Version: 2.4
Name: mcp-resource-tool-adapter
Version: 0.1.0
Summary: Expose MCP resources through generic tools for tool-only MCP clients.
Project-URL: Homepage, https://github.com/vineef/mcp-resource-tool-adapter
Project-URL: Repository, https://github.com/vineef/mcp-resource-tool-adapter
Project-URL: Issues, https://github.com/vineef/mcp-resource-tool-adapter/issues
Author: Vinicius Ferreira
License: MIT License
        
        Copyright (c) 2026 Vinicius Grilo
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: fastmcp,llm,mcp,model-context-protocol,resources,tools
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: mcp>=1.0.0
Provides-Extra: dev
Requires-Dist: build>=1.2.2; extra == 'dev'
Requires-Dist: mypy>=1.13; extra == 'dev'
Requires-Dist: pytest-cov>=6.0; extra == 'dev'
Requires-Dist: pytest>=8.3; extra == 'dev'
Requires-Dist: ruff>=0.8; extra == 'dev'
Requires-Dist: twine>=6.0; extra == 'dev'
Description-Content-Type: text/markdown

# mcp-resource-tool-adapter

[![CI](https://github.com/vineef/mcp-resource-tool-adapter/actions/workflows/ci.yml/badge.svg)](https://github.com/vineef/mcp-resource-tool-adapter/actions/workflows/ci.yml)

# mcp-resource-tool-adapter

Expose MCP resources through generic tools for MCP clients and models that
cannot call `resources/read` directly.

## Why?

Some OpenAI-compatible LLM runtimes support tool calls but do not implement
the MCP resource protocol. This package keeps standard MCP resources available
while exposing a generic `read_resource(uri)` compatibility tool.

## Installation

```bash
pip install mcp-resource-tool-adapter
```

## Example

```python
from mcp.server.fastmcp import FastMCP
from mcp_resource_tool_adapter import ResourceToolAdapter

mcp = FastMCP("example-server")
resources = ResourceToolAdapter(mcp)

@resources.resource("robot://current_state")
def get_robot_state():
    return {"battery_percent": 87, "mode": "standing"}

resources.register_tools()

mcp.run(transport="stdio")
```

A tool-only client can then call:

```json
{
  "uri": "robot://current_state"
}
```

through the `read_resource` tool.

## Available compatibility tools

- `read_resource(uri)`: reads one registered resource.
- `list_resources()`: lists URIs that can be read through `read_resource`.

## Scope

This package does not handle robot control, ROS2, authentication, caching,
authorization, or resource freshness. Those remain responsibilities of the
application server.