Set up your own AI with the P6M MCP server
The P6M MCP server lets an AI client use P6M through Model Context Protocol tools instead of hand-written HTTP calls. It is a bridge over the public P6M API. It does not read P6M databases directly and it only has the authority of the API token it forwards.
Use it when you want your AI assistant, coding agent, internal operator bot, or customer-support assistant to search P6M knowledge, inspect citations, read graph context, and call safe customer-visible P6M APIs through a standard tool interface.
What you need
- A running P6M environment.
- A P6M Org and Workspace.
- An enabled knowledge service.
- A knowledge collection with ingested documents.
- A P6M API key with only the scopes your AI needs.
- The MCP server endpoint.
For a knowledge assistant, start with these scopes:
knowledge_documents:read
knowledge_queries:create
knowledge_graph:read
Add audit or billing read scopes only if the assistant genuinely needs them.
Hosted P6M endpoint
Hosted deployments expose the MCP server as:
https://mcp.p6m.xyz/mcp
The health endpoint is:
https://mcp.p6m.xyz/healthz
Your MCP client sends its client token to the MCP endpoint:
Authorization: Bearer <P6M_MCP_CLIENT_TOKEN>
The hosted MCP server then forwards its configured P6M API token upstream to:
https://p6m.xyz
Self-hosted endpoint
Run the MCP server next to your P6M API:
P6M_MCP_ADDR=:8089 \
P6M_MCP_PLATFORM_ORIGIN=http://127.0.0.1:8080 \
P6M_MCP_CLIENT_TOKEN=change-me-client-token \
P6M_MCP_API_TOKEN=p6m_ok_... \
./mcp-server
Then point your AI client at:
http://127.0.0.1:8089/mcp
If you leave P6M_MCP_CLIENT_TOKEN empty, the MCP server forwards the caller's bearer token directly to P6M. For shared or hosted environments, require a client token.
Configure an AI client
Use an HTTP MCP server configuration with these values:
name: p6m
url: https://mcp.p6m.xyz/mcp
authorization: Bearer <P6M_MCP_CLIENT_TOKEN>
For local development:
name: p6m-local
url: http://127.0.0.1:8089/mcp
authorization: Bearer change-me-client-token
The exact configuration file format depends on your MCP client, but the important fields are the server URL and bearer token.
First tool call
Ask the client to list tools. The P6M MCP server exposes tools such as:
p6m_health
p6m_openapi_public
p6m_knowledge_query
p6m_knowledge_list_documents
p6m_knowledge_entities
p6m_knowledge_relationships
p6m_audit_logs
p6m_billing_usage_events
For a first knowledge query, provide:
orgId
workspaceId
enabledServiceId
collectionId
query
limit
Example user request to your AI assistant:
Search our P6M knowledge base for "how do I create a service account" and include citations.
The assistant should call p6m_knowledge_query, use the returned cited chunks as context, and include citation metadata in the answer.
Recommended assistant instruction
Give your AI assistant this instruction:
You have access to P6M through MCP. Use P6M tools for product knowledge, citations, Memory Graph context, audit visibility, and usage visibility when the user asks about data held in P6M. Do not invent P6M endpoint paths. Prefer p6m_openapi_public when you need the API contract. Use p6m_knowledge_query for factual answers from documents, and include citations. Never expose API tokens or MCP client tokens in responses.
Security rules
- Use a narrow P6M API key for the MCP server.
- Do not use a platform token unless the assistant is an internal operator tool.
- Do not expose long-lived service keys to browsers.
- Rotate P6M_MCP_CLIENT_TOKEN and P6M_MCP_API_TOKEN if they may have been copied into logs or prompts.
- Treat MCP tools as API access, not as model memory.
- Keep billing, authorization, and policy decisions in P6M or your app backend, not in the model.
When not to use MCP
Use direct P6M HTTP APIs when your backend is doing ordinary deterministic product work. Use MCP when an AI client needs a tool interface for retrieval, explanation, support, operational lookup, or agent-assisted setup.