Pass 3 of 3 · Deep dive of PHAROSPass 1 · OverviewPass 2 · How it works
Code Observatory / function
build_mcp_server
modules.mcp.native_server.build_mcp_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 symbolsLoading
| Symbol | File | Resolved by |
|---|---|---|
| assemble_context | context.py | through an import |
| ContextRequest | context.py | through an import |
| hit_to_dict | context.py | through an import |
| resolve_repositories | context.py | through an import |
| get_embedder | embeddings.py | through an import |
| Filters | retrieval.py | through an import |
| Retriever | retrieval.py | through an import |
| secret | runtime.py | through an import |
| session_scope | runtime.py | through an import |
| chunk_ref | symbols.py | through an import |
| find_symbol | symbols.py | through an import |
| repository_summary | symbols.py | through an import |
| symbol_graph | symbols.py | through an import |
| _error | native_server.py | same file |
| _transport_security | native_server.py | same file |
| Symbol | File | Resolved by |
|---|---|---|
| get_streamable_http_app | native_server.py | same file |
| Symbol | File | Resolved by |
|---|---|---|
| native_server | native_server.py | same file |
modules.mcp.native_server.build_mcp_serverbackend/app/modules/mcp/native_server.py, lines 79–138Open source
def build_mcp_server() -> FastMCP: server = FastMCP( "pharos", stateless_http=True, json_response=True, streamable_http_path="/", transport_security=_transport_security(), ) @server.tool( description=( "Retrieve the code most relevant to a question about an indexed repository: " "ranked functions/classes with verified source, their callers/callees, what PHAROS learned " "about the repository (brief, conventions for these files, playbooks) and its coding rules, " "plus a Markdown rendering with path:line citations. " "Ask in plain words; optionally pass hints: identifiers or keywords you guess the code uses " "(e.g. ['parse_url', 'redirect'])." ) ) def retrieve_context( query: str, repository: str | None = None, max_chunks: int = 8, include_code: bool = True, max_chars: int = 24000, profile_id: str | None = None, hints: list[str] | None = None, include_memory: bool = True, ) -> dict[str, Any]: with session_scope() as db: try: return assemble_context( db, get_embedder(), ContextRequest( query=query, repository=repository, max_chunks=max(1, min(max_chunks, 50)), include_code=include_code, max_chars=max(1000, min(max_chars, 400_000)), profile_id=profile_id, hints=(hints or [])[:20] or None, include_memory=include_memory, ), fetch_token=secret(get_settings().GIT_CLONE_TOKEN), ) except (ModeUnavailable, RepositoryNotFound) as exc: return _error(exc) @server.tool( description=( "Search indexed code. mode: auto (default), keyword, dense, hybrid or graph. " "Returns chunk pointers (path, lines, symbol) with retrieval evidence, no code. " "Optionally pass hints: identifiers or keywords you guess the code uses." ) ) def search_code( query: str, repository: str | None = None, mode: str = "auto",Shows the first 60 of 177 lines. The rest is on GitHub at this commit.
What the index recorded
- Signature
def build_mcp_server() -> FastMCP:- File
backend/app/modules/mcp/native_server.py- Lines
- 79–255
- Parser
- python-ast
- Git blob
0927865cd82a674fcaaa8c119faa660d8e20a47f- Call sites
- 33 named, 22 resolved, 11 left unlinked
- Outside this subset
- 8 more edges reach code outside the graph shown here
