Prismatic MCP

Prismatic MCP

160 files AI

Overview

Prismatic MCP implements the Model Context Protocol, providing a standardized interface for AI models (Claude, GPT, local Ollama models) to interact with the Prismatic Platform. It exposes 27 tools covering OSINT queries, security operations, entity management, and platform administration through the MCP specification.

The Model Context Protocol is an open standard that enables AI assistants to interact with external tools and data sources in a structured, validated, and auditable manner. Prismatic MCP transforms the platform's capabilities into MCP-compliant tool definitions, allowing any MCP-capable AI client to query OSINT sources, run security scans, manage entities, and monitor platform health through a single standardized interface.

Architecture

Prismatic.MCP.Application
└── Prismatic.MCP.Supervisor (:one_for_one)
    ├── Prismatic.MCP.Server (GenServer)
    │   └── MCP protocol handler (JSON-RPC 2.0)
    ├── Prismatic.MCP.Transport (GenServer)
    │   ├── :stdio (local Claude/GPT)
    │   └── :sse (remote clients via Plug)
    ├── Prismatic.MCP.Router (GenServer)
    │   └── Pattern-matched tool dispatch
    ├── Prismatic.MCP.ToolRegistry (GenServer)
    │   └── ETS: :mcp_tools (27 tool definitions, hot reload)
    ├── Prismatic.MCP.Auth (GenServer)
    │   └── RBAC with JWT token validation
    └── Prismatic.MCP.AuditLog (GenServer)
        └── Immutable audit trail for all invocations
MCP Client (Claude/GPT) --> Transport Layer --> Router --> Tool Handler --> Platform API --> Result
         |                       |                |            |                |             |
    JSON-RPC 2.0            stdio/SSE       Tool lookup    Validation    Prismatic.*     Formatted
    Messages               transport         + dispatch    + auth       facade call      response
ComponentImplementationPurpose
Transportstdio (local), SSE (remote)Client-server communication
RouterPattern-matched tool dispatchRoute requests to correct handler
ValidatorJSON Schema parameter validation (ex_json_schema)Input sanitization and type checking
Auth LayerRBAC-based tool accessRole-based tool authorization
HandlersPer-tool implementation modulesTool logic and platform API calls
SerializerStructured result formattingConvert Elixir results to MCP format

Key Modules

ModulePurpose
Prismatic.MCPMain API facade
Prismatic.MCP.ApplicationOTP application entry point
Prismatic.MCP.ServerMCP protocol handler implementing JSON-RPC 2.0
Prismatic.MCP.Transportstdio and SSE transport layer management
Prismatic.MCP.RouterTool request routing and dispatch
Prismatic.MCP.ToolRegistryETS-cached tool definitions with hot reload
Prismatic.MCP.AuthRBAC authorization with JWT validation
Prismatic.MCP.AuditLogImmutable audit trail for all tool invocations
Prismatic.MCP.Tools.*Per-domain tool handler modules (OSINT, Security, Storage, Analysis, Admin)

Available Tools (27)

OSINT Tools (8)

ToolParametersReturns
search_entityquery, sources, max_resultsEntity matches with confidence scores
query_sourcesource, query, paramsRaw source results
collect_intelligencetarget, domains, depthMulti-domain intelligence report
entity_profileidentifier, typeComprehensive entity profile
domain_recondomain, scan_typesDomain reconnaissance results
certificate_searchdomain, include_expiredCertificate transparency results
dns_enumerationdomain, record_typesDNS enumeration results
whois_lookupdomainWHOIS registration data

Security Tools (6)

ToolParametersReturns
check_ratingtarget, frameworkSecurity rating (A-F, 300-900)
scan_surfacetarget, scan_typesAttack surface discovery results
assess_compliancetarget, frameworksCompliance assessment (NIS2, ZKB)
vulnerability_checktarget, severityVulnerability findings
exposure_checktargetExposed services and data leaks
threat_intelindicator, typeThreat intelligence report

Storage Tools (5)

ToolParametersReturns
get_entityid, typeEntity record
store_entityentity, typeStorage confirmation
query_graphquery, depth, filtersKnowledge graph traversal results
search_entitiesquery, filters, limitFull-text search results
entity_relationshipsid, depth, typesRelationship graph

Analysis Tools (4) and Admin Tools (4)

ToolParametersReturns
analyze_risktarget, domainsRisk score with evidence
correlate_signalssignals, methodCorrelated findings
detect_anomalyentity, baselineAnomaly report
confidence_assessclaim, evidenceNABLA-compliant confidence score
platform_health--Health status across all subsystems
get_configkey, domainConfiguration value
list_agentsdomain, tier, statusAgent registry query results
quality_status--Quality score, QDP, domain breakdown

Configuration

config :prismatic_mcp, :server,
  transport: :stdio,           # or :sse for remote
  port: 3000,                  # SSE port (if applicable)
  tools_module: PrismaticMcp.Tools,
  auth_module: PrismaticMcp.Auth,
  rate_limit: %{
    requests_per_minute: 60,
    burst: 10
  },
  audit_log: true

config :prismatic_mcp, :auth,
  roles: [:reader, :analyst, :admin],
  default_role: :reader

API Reference

# Direct tool invocation from Elixir
{:ok, result} = PrismaticMcp.invoke("search_entity", %{
  query: "example.com",
  sources: ["shodan", "censys"],
  max_results: 20
})

# Batch tool invocation
{:ok, results} = PrismaticMcp.batch_invoke([
  {"search_entity", %{query: "example.com"}},
  {"check_rating", %{target: "example.com"}},
  {"dns_enumeration", %{domain: "example.com"}}
])

# Tool discovery (MCP clients use tools/list endpoint)
{:ok, tools} = PrismaticMcp.list_tools()

Security: Role-Based Access Control

RoleOSINTSecurityStorageAnalysisAdmin
Readersearch, profilecheck_ratingget, search--health, quality
AnalystAll 8All 6get, search, graphAll 4health, quality
AdminAll 8All 6All 5All 4All 4

Testing

# Run all MCP tests
cd apps/prismatic_mcp && mix test

# Run with coverage
mix test --cover

# Run tool handler tests
mix test test/prismatic_mcp/tools_test.exs

# Run auth and RBAC tests
mix test test/prismatic_mcp/auth_test.exs

Testing covers tool invocation with parameter validation, RBAC permission enforcement, audit log completeness, rate limiting behavior, and transport layer protocol compliance. Integration tests verify end-to-end tool execution against platform facade APIs.

Integration Points

Integrates WithPurpose
PrismaticCore platform API for OSINT and investigation tools
Prismatic PerimeterSecurity rating and EASM tools
Prismatic Storage CoreEntity storage and graph query tools
Prismatic NablaConfidence assessment and epistemic tools
Prismatic OllamaLocal AI inference for analysis tools
Prismatic AgentsAgent listing and status tools

NABLA Compliance

NABLA AxiomEnforcementImplementation
Provenance MandatoryHARD -- every invocation logged with full contextAudit log entry per tool call with client, parameters, result
Signal PluralityHARD -- multi-source queries enforce pluralitysearch_entity fans out to multiple OSINT sources
Time DecayHARD -- result timestamps mandatoryAll tool results include timestamp and TTL metadata
Source IndependenceSOFT -- per-source results distinguishableMulti-source queries return per-source attribution

Performance

MetricValueNotes
Tool Discovery< 10msCached tool definitions
Average Tool Latency50-500msDepends on backend operation
Concurrent Clients50+GenServer per client
Throughput100+ req/sPer MCP server instance
Audit Log Overhead< 1msAsync ETS write

Connect & Contribute

Created by Tomáš Korcak (korczis) | Open Source under GHL