Model Context Protocol (MCP) Example logo

Model Context Protocol (MCP) Example

by iddv

A reference implementation of the Model Context Protocol (MCP) for tool calling between LLMs and applications. It demonstrates local and remote tool calling, and integration with AWS Bedrock and Claude 3.7.

View on GitHub

Last updated: N/A

What is Model Context Protocol (MCP) Example?

This project is a client and server implementation of the Model Context Protocol (MCP), which facilitates interaction between LLMs and tools or applications by defining standard formats for function definitions, function calls, and responses. It includes implementations for local tool calling via stdio and remote tool calling via HTTP.

How to use Model Context Protocol (MCP) Example?

To use the MCP example, clone the repository, install the dependencies using Poetry or venv, and then run either the CLI or the FastAPI server. The CLI allows for local tool interaction, while the server provides a remote API for tool calling. Refer to the README for detailed installation and usage instructions, including examples for testing the server and using the HTTP client.

Key features of Model Context Protocol (MCP) Example

  • Local tool calling via stdio

  • Remote tool calling via HTTP

  • Integration with AWS Bedrock and Claude 3.7

  • Support for tool result caching

  • WebSocket streaming for long-running operations

  • Proxy tool for forwarding function calls to remote MCP servers

  • Tool chaining for creating complex workflows

  • AI-assisted development with Claude 3.7

Use cases of Model Context Protocol (MCP) Example

  • Building LLM-powered applications that require external tools

  • Creating a standardized interface for LLMs to interact with various services

  • Implementing tool calling functionality in a local development environment

  • Deploying a remote tool calling API for use by multiple LLMs

  • Integrating LLMs with AWS Bedrock and Claude 3.7 for advanced capabilities

FAQ from Model Context Protocol (MCP) Example

What is the Model Context Protocol (MCP)?

The Model Context Protocol (MCP) is a standard for tool calling between LLMs and applications, defining formats for function definitions, calls, and responses.

How do I install the MCP example?

Clone the repository, set up a virtual environment, and install dependencies using Poetry or venv. Refer to the README for detailed instructions.

How do I run the CLI?

Use the command poetry run python -m mcp_example.adapters.stdio.cli (with Poetry) or python -m mcp_example.adapters.stdio.cli (with venv) to start the CLI.

How do I run the server?

Use the command poetry run python -m mcp_example.server.main --host 0.0.0.0 --port 8000 (with Poetry) or python -m mcp_example.server.main --host 0.0.0.0 --port 8000 (with venv) to start the FastAPI server.

How do I integrate with AWS Bedrock and Claude 3.7?

Configure your AWS credentials and use the provided ClaudeAdapter to interact with Claude 3.7. Refer to the llm/ directory for detailed documentation.