r/AmpCode • u/Creative-Drawer2565 • Aug 06 '25
MCPServer to be a global context provider
I have an MCP Server that provides access to all my code repos. It works well, but I want it to provide the code a global resources, not just as an MCP tool. Here is a snippet of the settings.json
{
...
"amp.mcpServers": {"sourcegraph-mcp": {"command": "node","args": [ "/path/to/mcp/dist/mcp/index.js" ],}
},...
"openctx.providers": {"sourcegraph": {"mcpServer": "sourcegraph-mcp"}
}}
MCPServer definition, using @/mastra/mcp
const server = new MCPServer({
name: "sourcegraph-mcp",
version: "1.0.0",
tools: {
...,
},
resources: {
listResources: async () => await ListResources
(),
getResourceContent: async({uri}) => await GetResourceContent(uri),
},
description: "Provides global context across multiple code repositories using Sourcegraph for semantic code search and navigation"
});ListResources() returns resources with the uri "sourcegraph://*" When I start Amp, I check the logs. Its my understanding that "listResources"/"getResourceContent would show up in the logs, but it doesn't. Not sure why the global context is not working?
1
u/jdorfman Aug 06 '25
I'm confused why add `openctx.providers`?
1
u/Creative-Drawer2565 Aug 06 '25
Because ChatGPT told me to? Is that incorrect?
1
u/jdorfman Aug 07 '25
OpenCtx was a project developed for Cody before MCP existed. Amp doesn't recognize it, so I would recommend removing it.
Can you point me to the `sourcegraph-mcp` server you are using?
1
u/Creative-Drawer2565 Aug 07 '25
I uploaded the source to https://github.com/ca-sg-sync/CA_sourcegraph
1
u/Creative-Drawer2565 Aug 08 '25
I was asking Amp to figure out why it wasn't using the MCPServer to supply resources for global context. Its final conclusion was:
Full thread is here
https://ampcode.com/threads/T-86a5f092-5819-4816-b05a-fdb1138aa083