Repository navigation
Serve MCP over stdio and add an embeddings information resource - #1791
Open
adhikbuilds wants to merge 1 commit into
Open
adhikbuilds wants to merge 1 commit into
adhikbuilds wants to merge 1 commit into
Conversation
| return server | ||
|
|
||
|
|
||
| def embeddingsinfo(): |
Member
There was a problem hiding this comment.
Can you explain more on what this adds? It seems clunky to have this defined here.
Perhaps api/base.py makes more sense? Or even app/base.py if it's general enough of a method past API usage.
And maybe another name so it's not confused with Embeddings.info() which like you said you wouldn't want to expose the entire config.
Do we need other ways to help with discovery when things like agents / workflows and pipelines are avaialble?
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1779. Builds on #1763 and #1777.
Serve MCP over stdio
This serves the same tools as
/mcpover stdio, for MCP clients that start local servers as a subprocess (desktop and IDE assistants). It reads the same YAML config, so themcpoptions such astools,mcp_namesand the annotations from #1777 all apply.initializeis split intoconfigure(load config, create the API instance, add routes) andcreatemcp. Building the FastMCP server moved intomcpserver, which both HTTP and stdio use.TOKEN, because stdio has no request headers. The client that starts the process controls access to it, and the docs say so.Embeddings information resource
txtai://embeddings/infois a read-only JSON resource with the document count, vector model path and dimensions, backend, and whether dense, sparse/keyword, content and graph are enabled. Only those fields are returned, never the full index config, since that can hold credentials such as database URLs.Tests
testResourcelists and reads the resource over streamable HTTP, and covers an API with no embeddings index.testStdiorunsmain()with theTOOLSconfig, captures the server passed torun(transport="stdio"), then lists tools, calls the renamedtotaltool and reads the resource with an in-memory FastMCP client.python -m txtai.api.mcpas a subprocess with the MCP SDK's stdio client: it lists 16 tools and returns the resource, and stdout carries only protocol messages.All 8 tests in
testmcp.pypass. black and pylint are clean.Docs
docs/api/mcp.mdhas new "Embeddings information" and "stdio" sections, with a client config example.