Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support of Model Context Protocol (MCP) #238

Open
ajshedivy opened this issue Dec 9, 2024 · 0 comments
Open

Add support of Model Context Protocol (MCP) #238

ajshedivy opened this issue Dec 9, 2024 · 0 comments

Comments

@ajshedivy
Copy link

Original Issue: i-am-bee/bee-stack#59

MCP was recently open-sourced by Anthropic as a standard way for LLM applications to interact with external datasources.

MCP offers additional compatibility for developing Agents and LLM tools (like database connectors)

Describe the solution you'd like
Allow Bee agents to integrate with external Tools via MCP.

Describe alternatives you've considered
Bee already has great ways to interact with external tools, I built a sample agent that can interact with Db2 for i: https://github.com/ajshedivy/bee-agent-ibmi

In Bee stack I can simulate MCP via REST API. My workaround at the moment is to create a simple webserver on IBM i that can talk to Db2 that accepts requests like:

curl -X POST http://HOST:PORT/api/execute-sql \
     -H "Content-Type: application/json" \
     -d '{"sql": "SELECT * FROM sample.employee"}'

This will return the result set from the given SQL.

I can then create a "proxy tool" for Bee that sends requests to this endpoint:

import requests

def send_sql_query(sql_query) -> dict:
    """
    Sends a SQL statement to the Flask server and returns the result.

    Args:
        sql_query (str): The SQL statement to execute.

    Returns:
        dict: The server's response as a dictionary.
    """
    url = "http://HOST:PORT/api/execute-sql"  # Server endpoint
    headers = {"Content-Type": "application/json"}
    payload = {"sql": sql_query}

    try:
        response = requests.post(url, json=payload, headers=headers)
        response.raise_for_status() 
        return response.json()     
    except requests.exceptions.RequestException as e:
        return {"error": str(e)}

This works decent:
image

Additional context
In summary, MCP gives developers the ability to maintain a single, standardized external tool that would allow for additional flexibility when it comes to creating Agents and LLM apps. This would be a great addition to the Bee framework 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant