Skip to content

[Feature] Standalone local MCP server so Claude Desktop / Cursor / any MCP client can use a local library #540

Description

@Mikesad

Problem

In local mode the agent tools are only reachable in-process, through the framework adapters
(as_openai_tools(), as_claude_mcp(), as_anthropic_tools()). Any MCP-speaking client outside
that Python process — Claude Desktop, Cursor, Cline, etc. — has no endpoint to connect to.
Cloud users can already attach such clients to the hosted MCP server (https://api.pageindex.ai/mcp);
local users cannot use their own library there at all. This is the open half of #137.

The README Today marks "MCP server" as Cloud-only (— in the Local column), which is accurate.

What already exists

  • pageindex/agent_tools.py carries the cloud-identical tool contract plus full local
    implementations: _tool_specs() returns (name, description, schema, invoke) and
    tool_names() gives browse_documents, get_document, get_document_structure,
    get_page_content (+ remove_document behind include_management).
  • integrations/openai_agents.py and integrations/claude_agent_sdk.py already wrap those exact
    specs in an in-process MCP server (CallToolResult.model_validate({"content": blocks, "isError": is_error})), so the result conversion is proven — only a standalone process is missing.
  • mcp>=1.19.0,<3 is already a required dependency, so no new dependency would be added.

Proposal (v1)

  1. New pageindex/mcp_server.py: a server built over _tool_specs(...) for a
    PageIndexLocalClient, with handlers doing await asyncio.to_thread(invoke, arguments) and
    returning CallToolResult (server-side isError carried through).
  2. stdio transport only.
  3. A pageindex-mcp console entry point ([tool.poetry.scripts]), e.g.
    pageindex-mcp --storage-path <dir> [--management], config otherwise via the same env vars
    the SDK uses.
  4. Tests: an in-process MCP session test (tools/list + one tool call round-trip) and a stdio
    smoke test.
  5. README: flip the Local column's "MCP server" cell and add a short client-config snippet.

Client config the server would enable:

{
  "mcpServers": {
    "pageindex-local": {
      "command": "pageindex-mcp",
      "args": ["--storage-path", "/path/to/index-store"]
    }
  }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions