Back to the room

Pass 3 of 3 · Deep dive of PHAROSPass 1 · OverviewPass 2 · How it works

Code Observatory / module

native_server

modules.mcp.native_server

PINNED SOURCE Source and edges from the index at this commit. An execution appears only where one was recorded.

PHAROS at 975a38dMIT license

Around this symbol

Search all symbols

Loading

Contains (4)
SymbolFileResolved by
_errornative_server.pysame file
_transport_securitynative_server.pysame file
build_mcp_servernative_server.pysame file
get_streamable_http_appnative_server.pysame file
Imports (5)
SymbolFileResolved by
contextcontext.pythrough an import
embeddingsembeddings.pythrough an import
retrievalretrieval.pythrough an import
runtimeruntime.pythrough an import
symbolssymbols.pythrough an import
modules.mcp.native_serverbackend/app/modules/mcp/native_server.py, lines 1–40Open source
"""Native MCP server — streamable-HTTP transport at ``/mcp``.MCP clients (Claude Code, Cursor, ...) connect directly::    claude mcp add --transport http pharos http://localhost:8000/mcp \\        --header "Authorization: Bearer $PHAROS_READ_TOKEN"Every tool is read-only and backed by :mod:`app.codeintel`, so it returnsexactly what the REST API returns:``retrieve_context``  assembled context for a question (= POST /api/v1/context/retrieve)``search_code``       chunk-level code search        (= POST /api/v1/search/code)``find_symbol``       definition lookup + call graph (= POST /api/v1/search/symbol)``list_repositories`` indexed repositories           (= GET  /api/v1/repositories)``get_repo_brief``    a repository's brief            (= GET  /api/v1/memory/brief)``search_memory``     learned facts and conventions   (= POST /api/v1/memory/search)``list_skills``       a repository's playbooks        (= GET  /api/v1/memory/skills)``get_skill``         one playbook, levels 1-2        (= GET  /api/v1/memory/skills/{name})Two SDK traps handled here and in ``app/__init__.py``:1. Double path: ``FastMCP.streamable_http_app()`` serves at its   ``streamable_http_path`` (default "/mcp"); mounting that at "/mcp" would   serve "/mcp/mcp". We use ``streamable_http_path="/"``.2. Lifespan: mounted sub-apps do not get the parent's lifespan, and the   session manager must be running or every request 500s. A   ``StreamableHTTPSessionManager`` can only be ``run()`` once, so the server   is built **per application** by :func:`build_mcp_server` (a module-level   singleton broke every second app instance, e.g. in tests)."""from __future__ import annotationsimport loggingfrom typing import Anyfrom mcp.server.fastmcp import FastMCPfrom mcp.server.transport_security import TransportSecuritySettings

Shows the first 40 of 260 lines. The rest is on GitHub at this commit.

What the index recorded

Signature
module backend.app.modules.mcp.native_server
File
backend/app/modules/mcp/native_server.py
Lines
1–260
Parser
python-ast
Git blob
0927865cd82a674fcaaa8c119faa660d8e20a47f
Call sites
1 named, 0 resolved, 1 left unlinked
Outside this subset
7 more edges reach code outside the graph shown here

Read it on GitHub at this commit