-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
feat: add anthropic mcp endpoint #5148
base: main
Are you sure you want to change the base?
Conversation
CodSpeed Performance ReportMerging #5148 will not alter performanceComparing Summary
|
for flow in flows: | ||
if flow.user_id is None: | ||
continue | ||
# Generate unique name by appending _N if needed | ||
base_name = flow.name | ||
if base_name in name_count: | ||
name_count[base_name] += 1 | ||
unique_name = f"{base_name}_{name_count[base_name]}" | ||
else: | ||
name_count[base_name] = 0 | ||
unique_name = base_name | ||
|
||
tool = types.Tool( | ||
name=str(flow.id), # Use flow.id instead of name | ||
description=f"{unique_name}: {flow.description}" | ||
if flow.description | ||
else f"Tool generated from flow: {unique_name}", | ||
inputSchema=json_schema_from_flow(flow), | ||
) | ||
tools.append(tool) | ||
|
||
return tools |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Names are unique per user. What if we added the id like name ({id})
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually ended up using the flow.id as the unique name so let's take out the _N stuff
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But it would be good for the user to see the name, wouldn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hitting modelcontextprotocol/python-sdk#103 for progress notifications so we need to disable them for now |
gotta redo the Tools on the components because #5084 |
Anthropic released model context protocol a few days ago https://modelcontextprotocol.io/introduction
It's an open protocol for LLM applications (first one being the claude desktop ui) and external data sources and tools. In this integration, any flow in langflow becomes a tool in mcp and can be accessed directly by claude from claude desktop. Here's a screenshot from mcp inspector https://github.com/modelcontextprotocol/inspector
This pull request introduces the integration of the
mcp
module into the project. The changes include adding themcp
dependency, updating the API routing to includemcp
, and implementing themcp
server functionality.Key changes include:
Dependency Addition
mcp
version0.9.1
to the project dependencies inpyproject.toml
.API Routing Updates
mcp_router
in the API router configurations insrc/backend/base/langflow/api/router.py
. [1] [2]mcp_router
to the list of routers insrc/backend/base/langflow/api/v1/__init__.py
. [1] [2]MCP Server Implementation
src/backend/base/langflow/api/v1/mcp.py
to implement themcp
server with endpoints for handling tool listings, tool execution requests, and server-sent events (SSE).MCP Client components
Also includes two new components for mcp clients sse and stdio