मुख्य सामग्री पर जाएं

इंस्टॉलेशन

pip install dedalus-mcp dedalus-labs

API कुंजी

डैशबोर्ड से अपनी API कुंजी प्राप्त करें और उसे सेट करें:
export DEDALUS_API_KEY="your-api-key"

सर्वर बनाएँ

# server.py
from dedalus_mcp import MCPServer, tool

@tool(description="Add two numbers")
def add(a: int, b: int) -> int:
    return a + b

@tool(description="दो संख्याएँ गुणा करें")
def multiply(a: int, b: int) -> int:
    return a * b

server = MCPServer("calculator")
server.collect(add, multiply)

if __name__ == "__main__":
    import asyncio
    asyncio.run(server.serve())
इसे चलाएं:
python server.py
सर्वर http://127.0.0.1:8000/mcp पर स्टार्ट हो जाता है।

Client के साथ परीक्षण करें

# client.py
from dedalus_mcp.client import MCPClient
import asyncio

async def main():
    client = await MCPClient.connect("http://127.0.0.1:8000/mcp")
    
    # उपलब्ध tools की सूची बनाएं
    tools = await client.list_tools()
    print([t.name for t in tools.tools])  # ['add', 'multiply']
    
    # एक tool को कॉल करें
    result = await client.call_tool("add", {"a": 2, "b": 3})
    print(result.content[0].text)  # "5"
    
    await client.close()

asyncio.run(main())

डिप्लॉय

क्या आप अपना सर्वर दूरस्थ रूप से होस्ट करने के लिए तैयार हैं? Dedalus प्लेटफ़ॉर्म पर डिप्लॉय करें ताकि आप इसे कहीं से भी एक्सेस कर सकें, दूसरों के साथ साझा कर सकें, या अपने काम से कमाई कर सकें।

डिप्लॉयमेंट गाइड

स्क्रीनशॉट्स के साथ चरण-दर-चरण डिप्लॉयमेंट वॉकथ्रू।

अगले चरण