A Model Context Protocol (MCP) server that provides seamless access to the ConceptNet knowledge graph through FastMCP framework.
ConceptNet MCP provides AI assistants and applications with structured access to ConceptNet's semantic knowledge through four powerful MCP tools:
- Concept Lookup: Get detailed information about specific concepts
- Concept Query: Search and filter concepts with advanced criteria
- Related Concepts: Find concepts connected through semantic relationships
- Concept Relatedness: Calculate semantic similarity between concepts
- π FastMCP Integration: Built on the modern FastMCP framework for optimal performance
- π Comprehensive Search: Advanced querying with language filtering and pagination
- π Multi-language Support: Access ConceptNet's multilingual knowledge base
- π Semantic Analysis: Calculate relatedness scores between concepts
- π Async Operations: Full async/await support for non-blocking operations
- π Type Safety: Complete Pydantic v2 type validation and IDE support
- π§ͺ Production Ready: Error handling, logging, and testing
- β‘ Optimized Output Formats: Choose between minimal (~96% smaller) or comprehensive responses
ConceptNet MCP Server supports two output formats for all tools to optimize performance and reduce token usage:
- Size: ~96% smaller than verbose format
- Optimized: Designed specifically for LLM consumption
- Content: Essential data only - concepts, relationships, similarity scores
- Performance: Faster processing and reduced API costs
- Usage: Perfect for most AI applications and chat interfaces
- Size: Full ConceptNet response data
- Content: Complete metadata, statistics, analysis, and original API responses
- Usage: Detailed analysis, debugging, or when full context is needed
- Backward Compatibility: Maintains compatibility with existing integrations
All tools accept a verbose
parameter:
{
"name": "concept_lookup",
"arguments": {
"term": "artificial intelligence",
"verbose": false // Default: minimal format
}
}
{
"name": "related_concepts",
"arguments": {
"term": "machine learning",
"verbose": true // Full detailed format
}
}
Examples of size difference:
- Minimal:
{"concept": "dog", "relationships": {"IsA": ["animal", "mammal"]}}
- Verbose: Full ConceptNet response with complete metadata, statistics, timestamps, etc.
# Clone the repository
git clone https://github.com/infinitnet/conceptnet-mcp.git
cd conceptnet-mcp
# Install in development mode
pip install -e .
The server supports both stdio (for desktop MCP clients) and HTTP (for web clients) transport modes:
# Start with stdio transport (default)
conceptnet-mcp
# Or explicitly specify stdio
conceptnet-mcp-stdio
# Or use Python module
python -m conceptnet_mcp.server
# Start HTTP server on localhost:3001
conceptnet-mcp-http
# Or with custom host/port
python -c "from conceptnet_mcp.server import run_http_server; run_http_server('0.0.0.0', 8080)"
# Development mode with debug logging
conceptnet-mcp-dev
# Production mode with optimized logging
conceptnet-mcp-prod
Add to your MCP client configuration:
{
"mcpServers": {
"conceptnet": {
"command": "python",
"args": ["-m", "conceptnet_mcp.server"]
}
}
}
Add to your MCP client configuration:
{
"mcpServers": {
"conceptnet": {
"command": "python",
"args": ["-m", "conceptnet_mcp.server", "--transport", "http", "--port", "3001"]
}
}
}
Or start the HTTP server manually and connect to:
http://localhost:3001
// Example web client connection
const client = new MCPClient('http://localhost:3001');
await client.connect();
Deploy ConceptNet MCP Server to Cloudflare's global edge network for worldwide access and automatic scaling using a FastAPI-based implementation optimized for Python Workers.
The Cloudflare Workers deployment uses a completely different architecture from the standard FastMCP server:
- FastAPI Framework: Manual MCP protocol implementation using FastAPI for HTTP routing
- Standard Workers Pattern: Uses
fetch(request, env, ctx)
handler (no Durable Objects) - Native HTTP Client: Custom
CloudflareHTTPClient
using Workers' nativefetch()
API - Manual MCP Protocol: JSON-RPC 2.0 MCP messages handled directly without FastMCP framework
- π Global Edge Network: Low-latency access worldwide via Cloudflare's CDN
- π Auto-scaling: Serverless scaling based on demand with zero cold starts
- π Dual Transport Support: Both SSE and Streamable HTTP endpoints for maximum compatibility
- π€ Remote MCP Access: Enable AI agents to access ConceptNet from anywhere
- π° Cost-effective: Pay only for actual usage with generous free tier
# Clone and navigate to Workers directory
git clone https://github.com/infinitnet/conceptnet-mcp.git
cd conceptnet-mcp/cloudflare-workers
# Install Wrangler CLI
npm install -g wrangler
# Authenticate and deploy
wrangler login
wrangler deploy
Your ConceptNet MCP Server will be available at:
# Streamable HTTP Transport (recommended for MCP clients)
https://your-worker.your-domain.workers.dev/mcp
# SSE Transport (legacy support)
https://your-worker.your-domain.workers.dev/sse
# Tools listing endpoint
https://your-worker.your-domain.workers.dev/tools
Example remote client connection (direct HTTP):
import httpx
import json
# Connect to your deployed Workers instance
async with httpx.AsyncClient() as client:
response = await client.post(
"https://your-worker.your-domain.workers.dev/mcp",
json={
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "concept_lookup",
"arguments": {"term": "artificial intelligence"}
}
}
)
result = response.json()
print(result["result"])
For detailed deployment instructions, configuration options, and troubleshooting, see the Cloudflare Workers Documentation.
Get detailed information about a specific concept. Returns all relationships and properties.
{
"name": "concept_lookup",
"arguments": {
"term": "artificial intelligence",
"language": "en",
"limit_results": false,
"target_language": null,
"verbose": false
}
}
Parameters:
term
(required): The concept to look uplanguage
(default: "en"): Language code for the conceptlimit_results
(default: false): Limit to first 20 results for quick queriestarget_language
(optional): Filter results to specific target languageverbose
(default: false): Return detailed format vs minimal format
Advanced querying with sophisticated multi-parameter filtering.
{
"name": "concept_query",
"arguments": {
"start": "car",
"rel": "IsA",
"language": "en",
"limit_results": false,
"verbose": false
}
}
Parameters:
start
(optional): Start concept of relationshipsend
(optional): End concept of relationshipsrel
(optional): Relation type (e.g., "IsA", "PartOf")node
(optional): Concept that must be start or end of edgesother
(optional): Used with 'node' parametersources
(optional): Filter by data sourcelanguage
(default: "en"): Language filterlimit_results
(default: false): Limit to 20 results for quick queriesverbose
(default: false): Return detailed format vs minimal format
Find concepts semantically similar to a given concept using ConceptNet's embeddings.
{
"name": "related_concepts",
"arguments": {
"term": "machine learning",
"language": "en",
"filter_language": null,
"limit": 100,
"verbose": false
}
}
Parameters:
term
(required): The concept to find related concepts forlanguage
(default: "en"): Language code for input termfilter_language
(optional): Filter results to this language onlylimit
(default: 100, max: 100): Maximum number of related conceptsverbose
(default: false): Return detailed format vs minimal format
Calculate precise semantic relatedness score between two concepts.
{
"name": "concept_relatedness",
"arguments": {
"concept1": "artificial intelligence",
"concept2": "machine learning",
"language1": "en",
"language2": "en",
"verbose": false
}
}
Parameters:
concept1
(required): First concept for comparisonconcept2
(required): Second concept for comparisonlanguage1
(default: "en"): Language for first conceptlanguage2
(default: "en"): Language for second conceptverbose
(default: false): Return detailed format vs minimal format
The server can be configured through environment variables:
# ConceptNet API settings
CONCEPTNET_API_BASE_URL=https://api.conceptnet.io
CONCEPTNET_API_VERSION=5.7
# Server settings
MCP_SERVER_HOST=localhost
MCP_SERVER_PORT=3000
LOG_LEVEL=INFO
# Rate limiting
CONCEPTNET_RATE_LIMIT=100
CONCEPTNET_RATE_PERIOD=60
# Clone the repository
git clone https://github.com/infinitnet/conceptnet-mcp.git
cd conceptnet-mcp
# Install in development mode
pip install -e .[dev]
# Install pre-commit hooks
pre-commit install
- Concept: Represents a ConceptNet concept with URI, label, and language
- Edge: Represents relationships between concepts with relation types
- Query: Structured query parameters for concept searches
- Response: Standardized response format with pagination support
- ConceptNetClient: Async HTTP client for ConceptNet API
- PaginationHandler: Automatic pagination for large result sets
- ResponseProcessor: Data processing and normalization
- Text Processing: Normalize text (underscores to spaces)
- Logging: Structured logging with configurable levels
- Error Handling: Comprehensive exception hierarchy
conceptnet_mcp/
βββ client/ # ConceptNet API client
β βββ conceptnet_client.py
β βββ pagination.py
β βββ processor.py
βββ models/ # Pydantic data models
β βββ concept.py
β βββ edge.py
β βββ query.py
β βββ response.py
βββ tools/ # MCP tool implementations
β βββ concept_lookup.py
β βββ concept_query.py
β βββ related_concepts.py
β βββ concept_relatedness.py
βββ utils/ # Utility modules
β βββ exceptions.py
β βββ logging.py
β βββ text_utils.py
βββ server.py # FastMCP server entry point
- Fork the repository: https://github.com/infinitnet/conceptnet-mcp
- Create a feature branch:
git checkout -b feature-name
- Make your changes and add tests
- Run the test suite:
python run_tests.py
- Submit a pull request
- Follow PEP 8 style guidelines
- Add type hints for all functions
- Include docstrings for public APIs
- Write tests for new functionality
- Update documentation as needed
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
- ConceptNet for providing the semantic knowledge base
- FastMCP for the MCP framework
- Model Context Protocol specification
- π Documentation: Read the docs
- π Bug Reports: GitHub Issues
- π¬ Discussions: GitHub Discussions
- π Author's Website: https://infinitnet.io/
Built with β€οΈ for the AI and semantic web community.