How to Integrate Semantica AGI with Other Tools: MCP, REST API, and Framework Adapters
Semantica AGI exposes its 12 core knowledge graph tools through a Model-Context Protocol (MCP) server and a REST API, enabling seamless integration with agent frameworks like OpenClaw and Agno via configuration files and Python wrappers.
Semantica AGI is architected for interoperability, providing standardized interfaces that allow external agents to consume its extraction, reasoning, and graph-query capabilities. The platform supports both protocol-based integration through MCP and traditional HTTP-based integration, alongside first-class adapters for popular agent frameworks.
Integration Modes: MCP vs REST API
Semantica offers two primary integration pathways depending on your agent's capabilities:
- MCP (Model-Context Protocol) – The recommended approach generates a JSON configuration (
mcporter.json) that instructs agent gateways how to launch the Semantica MCP server and forward tool calls overstdioorssetransport. This is ideal for agents that natively understand MCP, such as OpenClaw or LangChain-MCP adapters. - REST API – A conventional HTTP/JSON interface (default at
http://localhost:8000) that wraps MCP functionality. TheOpenClawKGToolclass provides a lightweight Python wrapper for this endpoint, suitable for agents that cannot run MCP clients but can invoke HTTP endpoints.
Integrating with OpenClaw
The OpenClaw integration ships in integrations/openclaw/mcp_tool.py and exposes two primary classes for connecting Semantica to the OpenClaw gateway.
MCP Configuration with OpenClawMCPConfig
The OpenClawMCPConfig class (lines 27-78 in integrations/openclaw/mcp_tool.py) generates the mcporter.json entry required to wire the Semantica MCP server into OpenClaw. This configuration tells the gateway how to launch the server and route tool calls.
To configure OpenClaw integration:
- Start the MCP server:
python -m semantica.mcp_server
- Generate the configuration:
from integrations.openclaw import OpenClawMCPConfig
print(OpenClawMCPConfig().to_json())
- Paste the output into
~/.openclaw/mcporter.jsonand restart the gateway:
openclaw gateway restart
Once restarted, all 12 Semantica tools become native OpenClaw tools callable directly from running agents.
REST API Wrapper with OpenClawKGTool
For agents that cannot use MCP, the OpenClawKGTool class (lines 86-254 in integrations/openclaw/mcp_tool.py) provides a Python interface to the Semantica REST API. This wrapper exposes methods including extract(), add_entity(), record_decision(), and get_causal_chain().
from integrations.openclaw import OpenClawKGTool
# Connect to local Semantica REST server
kg = OpenClawKGTool(base_url="http://localhost:8000")
# Extract entities and relations
extraction = kg.extract("Alice visited the Eiffel Tower in Paris.")
print(extraction) # {'entities': [...], 'relations': [...]}
# Add custom entities
kg.add_entity(label="Mars", entity_type="Planet")
# Query the knowledge graph
results = kg.query_graph("planet")
# Export as JSON-LD
jsonld = kg.export_graph(fmt="json-ld")
Integrating with Agno
Semantica provides a first-class integration for the Agno framework in the integrations/agno/ directory. These classes map Semantica's core pipelines onto Agno's Toolkit and MemoryDb abstractions, gracefully degrading when Agno is not installed to maintain optional dependencies.
Key Agno Integration Classes
| Class | Role | Source File |
|---|---|---|
AgnoContextStore |
Graph-backed memory store compatible with Agno's MemoryDb interface |
integrations/agno/context_store.py |
AgnoKnowledgeGraph |
Relational AgentKnowledge with multi-hop GraphRAG capabilities |
integrations/agno/knowledge_graph.py |
AgnoDecisionKit |
Exposes decision-intelligence tools as an Agno Toolkit |
integrations/agno/decision_kit.py |
AgnoKGToolkit |
Provides KG-centric tools (extract_entities, add_to_graph, query_graph) as an Agno Toolkit (lines 55-464) |
integrations/agno/kg_toolkit.py |
AgnoSharedContext |
Team-level shared ContextGraph with per-agent scoping |
integrations/agno/shared_context.py |
Install the integration using pip install semantica[agno], then use the toolkit directly:
from integrations.agno import AgnoKGToolkit
from agno.agent import Agent
# Create toolkit with default in-memory graph
kg_toolkit = AgnoKGToolkit()
# Attach to Agno agent
agent = Agent(tools=[kg_toolkit], show_tool_calls=True)
# Agent can now call Semantica functions:
# await agent.run_tool("extract_entities", {"text": "Bob lives in Berlin."})
# await agent.run_tool("query_graph", {"query": "location"})
Direct Pipeline Integration
For use cases requiring no external agent framework, instantiate Semantica's pipeline directly using PipelineBuilder from semantica/pipeline/pipeline_builder.py. This assembles the full AGI pipeline including parsers, extractors, reasoners, and graph storage.
from semantica.pipeline.pipeline_builder import PipelineBuilder
# Build complete pipeline
pipeline = PipelineBuilder().build()
# Process document through full stack
result = pipeline.run("The quick brown fox jumps over the lazy dog.")
# Access populated knowledge graph
graph = pipeline.context.graph
print(graph.find_nodes())
Core Architecture Components
Semantica's integration capabilities rely on several architectural pieces defined in the source:
semantica/mcp/server.py– Routes incoming MCP tool calls to underlying pipelines (extraction, reasoning, vector store operations).semantica/vector_store/registry.py– Provides pluggable vector store backends includingfaiss,pinecone,qdrant,pgvector,milvus,weaviate, andsqlite.semantica/server.py– HTTP/REST gateway exposing the same tool surface as the MCP server, used byOpenClawKGTooland external HTTP clients.semantica/visualization/visualization_provenance.py– Optional provenance tracking for auditability across all integration modes.
All components share a common configuration model (semantica/config.py) and centralized logging (semantica/utils/logging.py), ensuring consistent behavior whether accessed via MCP, REST, or direct import.
Summary
- Semantica AGI exposes 12 core tools through both MCP and REST API interfaces.
- OpenClaw integration offers
OpenClawMCPConfigfor protocol-based setup andOpenClawKGToolfor HTTP-based access, both implemented inintegrations/openclaw/mcp_tool.py. - Agno integration provides
AgnoKGToolkitand related classes inintegrations/agno/that map Semantica capabilities to Agno'sToolkitabstraction. - Direct access is available via
PipelineBuilderfor custom implementations requiring no external framework. - The MCP server (
semantica/mcp/server.py) and REST server (semantica/server.py) share underlying pipelines for consistent behavior across integration modes.
Frequently Asked Questions
What is the difference between MCP and REST API integration in Semantica AGI?
MCP integration uses the Model-Context Protocol to stream tool calls over stdio or sse transport, requiring agents to speak the MCP protocol but offering better context management. The REST API wraps the same functionality behind HTTP endpoints at http://localhost:8000, making it accessible to any client capable of HTTP requests but without MCP's contextual streaming capabilities.
How do I configure OpenClaw to recognize Semantica tools?
Import OpenClawMCPConfig from integrations/openclaw, call to_json() to generate the configuration snippet, and paste it into ~/.openclaw/mcporter.json. After restarting the OpenClaw gateway with openclaw gateway restart, the Semantica MCP server will be available as a native tool provider.
Can I use Semantica with Agno without installing Agno itself?
Yes. The integration classes in integrations/agno/ are designed to gracefully degrade when Agno is not installed. They remain importable and functional for direct use, but cannot be passed to an Agno Agent until you install the optional dependency with pip install semantica[agno].
Which vector stores does Semantica support for integration backends?
According to semantica/vector_store/registry.py, Semantica supports pluggable backends including FAISS, Pinecone, Qdrant, PGVector, Milvus, Weaviate, and SQLite. This registry allows integrations to persist knowledge graph embeddings using your existing vector database infrastructure.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →