Skip to content

Conversation

@koch3092
Copy link
Contributor

Description

PR draft for #1912 :

  • add MCPServer decorator to expose class methods as MCP server
  • update GithubToolkit as an MCP server example

Checklist

Go over all the following points, and put an x in all the boxes that apply.

  • I have read the CONTRIBUTION guide (required)
  • I have linked this PR to an issue using the Development section on the right sidebar or by adding Fixes #issue-number in the PR description (required)
  • I have checked if any dependencies need to be added or updated in pyproject.toml and uv lock
  • I have updated the tests accordingly (required for a bug fix or a new feature)
  • I have updated the documentation if needed:
  • I have added examples if this is a new feature

If you are unsure about any of these, don't hesitate to ask. We are here to help!

@koch3092 koch3092 self-assigned this Mar 25, 2025
@koch3092 koch3092 linked an issue Mar 25, 2025 that may be closed by this pull request
2 tasks
@koch3092 koch3092 requested a review from jjyaoao March 25, 2025 20:13
Copy link
Collaborator

@keli-wen keli-wen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, I think users can now clearly understand how to use Camel directly as an MCP.

Copy link
Member

@Wendong-Fan Wendong-Fan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @koch3092 , left some comments below and a fix commit: 40c417e


from typing import Dict, Generator, List, Optional

from mcp.server import FastMCP
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems imported but not used?


from typing import List, Optional

from mcp.server import FastMCP
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lazy import to make dependency optional

from notion_client import Client

self.notion_token = notion_token or os.environ.get("NOTION_TOKEN")
print(self.notion_token)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clean

import inspect
from typing import Any, Callable, Optional

from mcp.server.fastmcp import FastMCP
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lazy import to make the dependecy optional

@Wendong-Fan Wendong-Fan changed the title [Draft] 1912 feature request camel as mcp server feat: camel toolkits as mcp server Mar 30, 2025
@Wendong-Fan Wendong-Fan added this to the Sprint 26 milestone Mar 30, 2025
Copy link
Member

@Wendong-Fan Wendong-Fan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @koch3092 !

@Wendong-Fan Wendong-Fan merged commit ebebdbd into master Apr 1, 2025
4 of 6 checks passed
@Wendong-Fan Wendong-Fan deleted the 1912-feature-request-camel-as-mcp-server branch April 1, 2025 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

4 participants