Skip to content

openwallet-foundation-labs/tmcp-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TMCP Transport Hook

This Python project implements the TMCP transport hook, allowing you to use MCP over TSP. To use this, you need to use our fork of the MCP Python SDK that adds transport hooks to make it possible to implement TMCP. These can be installed with:

uv add git+https://github.com/openwallet-foundation-labs/mcp-transport-hooks git+https://github.com/openwallet-foundation-labs/tmcp-python

See the ./demo directory for some example TMCP servers and clients.

Example usage

Below is an example TMCP server using FastMCP. By default, it will generate a DID WebVH on initial start up and host it on the TSP test bed. The DID will be named according to the optionally provided format string, and will contain a combination of the provided alias (set to "tmcp" by default) and a random UUIDv4 to ensure uniqueness.

from mcp.server.fastmcp import FastMCP
from tmcp import TmcpManager

# Create a MCP server
mcp = FastMCP("Demo", port=8001, transport_manager=TmcpManager(alias="demo", transport="http://localhost:8001/mcp"))


# Add an addition tool
@mcp.tool()
def add(a: int, b: int) -> int:
    """Add two numbers"""
    return a + b


if __name__ == "__main__":
    # Initialize and run the server
    mcp.run(transport="streamable-http")

The DID format string, DID servers, and other TMCP settings can be passed on to the TmcpManager during initialization. See the TmcpSettings for a full list of the available settings.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages