Skip to content

Commit 91b5f4e

Browse files
committed
feat(shared mcp): add shared mcp module
1 parent 4da34b2 commit 91b5f4e

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

backend/shared_mcp/models.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from pydantic import BaseModel
2+
3+
4+
class ToolRequest(BaseModel):
5+
tool_name: str
6+
a: int
7+
b: int

backend/shared_mcp/tools.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import os
2+
3+
from mcp.server.fastmcp import FastMCP
4+
5+
mcp = FastMCP(
6+
"MCP Server",
7+
host=os.environ["MCP_SERVER_HOST"],
8+
port=os.environ["MCP_SERVER_PORT"],
9+
)
10+
11+
12+
@mcp.tool()
13+
def add(a: int, b: int) -> int:
14+
"""Add two numbers"""
15+
return a + b
16+
17+
18+
@mcp.resource("greeting://{name}")
19+
def get_greeting(name: str) -> str:
20+
"""Get a personalized greeting"""
21+
return f"Hello, {name}!"

0 commit comments

Comments
 (0)