Spaces:
No application file
No application file
File size: 1,429 Bytes
84473fd |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
import requests
import json
MCP_URL = "http://localhost:8000/mcp"
API_KEY = "dev-key-123"
def call_mcp(tool, params=None):
response = requests.post(
MCP_URL,
headers={"X-API-Key": API_KEY, "Content-Type": "application/json"},
json={"tool": tool, "params": params or {}}
)
return response.json()
# Create workflow
workflow = call_mcp("write_graph", {
"action": "create_node",
"label": "Workflow",
"properties": {
"id": "demo-workflow-1",
"name": "Entity Resolution Demo",
"status": "active",
"max_iterations": 10,
"current_iteration": 0
}
})
print(f"Created workflow: {workflow}")
# Create three instructions
instructions = [
{"id": "inst-1", "sequence": 1, "type": "discover_schema", "status": "pending", "pause_duration": 300},
{"id": "inst-2", "sequence": 2, "type": "generate_sql", "status": "pending", "pause_duration": 300},
{"id": "inst-3", "sequence": 3, "type": "review_results", "status": "pending", "pause_duration": 300}
]
for inst in instructions:
result = call_mcp("write_graph", {
"action": "create_node",
"label": "Instruction",
"properties": inst
})
print(f"Created instruction: {inst['id']}")
print(" Basic seeding complete! Workflow and instructions created.")
print("Note: Relationships skipped due to parameterized query issue - but agent should still work!")
|